index.vue
4.77 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<template>
<GLDialog :destroy-on-close="isdestroy" :close-on-click-modal="false" title="跟进人配置" mode="mid" :visible.sync="isFollowSync" :before-close="handleCancel">
<GLTable :hasPage="false" :hasNum="true" :tableData="followListData" :tableParams="followTableParams">
<div slot="followName" slot-scope="scope">
<el-form v-if="scope.scope.followName == ''">
<el-form-item style="margin-bottom: 0px">
<el-select v-model="followName" filterable @change="handleSelect" :value-key="'uuid'" placeholder="请选择跟进人">
<el-option v-for="(item, index) in selectList" :key="index" :label="item.staffName" :disabled="followDisabled(item)" :value="item"></el-option>
</el-select>
</el-form-item>
</el-form>
<span v-else>{{ scope.scope.followName }}</span>
</div>
<div class="table-btns" slot="table-btns" slot-scope="scope">
<el-button type="text" size="small" @click="handleDelete(scope.scope, scope.index)">删除</el-button>
</div>
</GLTable>
<div class="add-wrap" @click="addLine">
<i class="el-icon-circle-plus-outline add-icon"></i>
添加
</div>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="handleCancel">取消</el-button>
<el-button type="primary" size="small" @click="handleSave">确定</el-button>
</span>
</GLDialog>
</template>
<script>
export default {
data() {
return {
isdestroy: true,
followListData: [],
followTableParams: {
listName: 'list',
tableOption: false,
tableColumns: [
{
label: '跟进人',
prop: 'followName',
addHtml: 'followName'
},
{
label: '操作',
prop: '',
width: 80,
fixed: 'right',
addHtml: 'table-btns'
}
]
},
selectList: [],
followAccountUuid: '',
followName: ''
}
},
props: {
isFollowSync: {
type: Boolean,
default: false
}
},
created() {
this.getFollowPersonList()
},
mounted() {
// 获取下拉框的跟进人数据
this.getSelectFollowPersonList()
},
methods: {
getFollowPersonList() {
this.$apis.claims
.getFollowPersonList({
pageSize: 10000,
pageNum: 1
})
.then(res => {
this.followListData = res.list
})
},
followDisabled(item) {
let flag = false
this.followListData.forEach(element => {
if (element.followAccountUuid == item.uuid) {
flag = true
}
})
return flag
},
getSelectFollowPersonList() {
this.$apis.claims.getFollowListApi({}).then(res => {
this.selectList = res || []
})
},
addLine() {
if (this.followListData.length > 0 && this.followListData[this.followListData.length - 1].followAccountUuid == '') {
return
}
this.followName = ''
this.followAccountUuid = ''
this.followListData.push({ followName: '', followAccountUuid: '' })
},
handleSelect(item) {
this.$apis.claims.addFollowPerson({ followName: item.staffName, followAccountUuid: item.uuid }).then(res => {
this.$message({
type: 'success',
message: '添加成功',
customClass: 'msgHierarchy'
})
this.getFollowPersonList()
})
},
handleSave() {
if (this.followListData.length > 0 && this.followListData[this.followListData.length - 1].followAccountUuid == '') {
this.$message({
type: 'error',
message: '请选择跟进人',
customClass: 'msgHierarchy'
})
return
}
this.$emit('handleClose')
},
handleCancel() {
this.$emit('handleClose')
},
//删除
handleDelete(data, index) {
if (data.id) {
this.$confirm('确定要删除吗, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
if (data.id) {
this.$apis.claims.delFollowPerson({ id: data.id }).then(res => {})
this.followListData.splice(index, 1)
}
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消删除',
customClass: 'msgHierarchy'
})
})
} else {
this.followListData.splice(index, 1)
}
}
}
}
</script>
<style scoped lang="scss">
.add-wrap {
display: flex;
align-items: center;
font-size: 12px;
color: #2a58ad;
margin-top: 10px;
cursor: pointer;
.add-icon {
margin-right: 6px;
font-size: 20px;
color: #2a58ad;
}
}
</style>