1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<template>
  <div class="high-view-scope">
    <el-dialog title="分配" :visible.sync="editConfig.visible" :width="dialogWidth" :before-close="handleClose">
      <el-form
        ref="form"
        :model="editConfig.infomation"
        :rules="rules"
        label-position="right"
        label-width="130px"
        size="mini"
        style="height: 80px; margin-top: 40px; overflow-x: hidden"
      >
        <el-form-item label="销售负责人" prop="member_id">
          <el-select v-model="editConfig.infomation.member_id" placeholder="请选择" size="mini" style="width: 63%">
            <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id">
            </el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" size="small" @click="sureClick">确认</el-button>
        <el-button size="small" @click="editConfig.visible = false">取消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
 
<script>
import { getAllData } from "@/api/client/client"
import { getAssign } from "@/api/common/other"
export default {
  name: "AllocationDialog",
  props: {
    editCommonConfig: {
      type: Object,
      default: () => {
        return {
          visible: false,
          infomation: {}
        }
      }
    }
  },
  components: {},
  computed: {},
  watch: {},
  data() {
    return {
      dialogWidth: "25%",
      editConfig: this.editCommonConfig,
      memberOptions: [],
      rules: {
        member_id: [{ required: true, message: "请选择销售负责人", trigger: "change" }]
      }
    }
  },
  created() {
    this.getCommonData()
  },
  methods: {
    getCommonData() {
      getAllData().then((res) => {
        this.memberOptions = res.data.member
      })
    },
    handleClose() {
      this.editConfig.visible = false
    },
    // 确认
    async sureClick() {
      await getAssign({
        ids: [this.editConfig.infomation.id],
        member_id: this.editConfig.infomation.member_id,
        type: "client"
      }).then((res) => {
        this.editConfig.visible = false
        if (res.code === 200) {
          this.$message.success("添加成功")
          this.$parent.getData()
        }
      })
    }
  }
}
</script>
 
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
.high-view-scope {
  // .view-sel-bg {
  //   display: flex;
  //   align-items: center;
  //   margin: 20px 20px 0;
  //   .el-input {
  //     width: 240px;
  //     margin-left: 5px;
  //   }
  //   .el-checkbox {
  //     margin-left: 5px;
  //     margin-right: 0;
  //   }
  // }
  .dialog-footer {
    background-color: #f5f5f5;
    height: 55px;
    line-height: 55px;
  }
}
</style>