index.vue
3.88 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
<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-input v-model="followName" placeholder="请输入" maxlength="5"></el-input>
</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: [],
followName: '',
followTableParams: {
listName: 'list',
tableOption: false,
tableColumns: [
{
label: '跟进人',
prop: 'followName',
addHtml: 'followName'
},
{
label: '操作',
prop: '',
width: 80,
fixed: 'right',
addHtml: 'table-btns'
}
]
}
}
},
props: {
isFollowSync: {
type: Boolean,
default: false
}
},
created() {
this.getFollowPersonList()
},
methods: {
getFollowPersonList() {
this.$apis.claims
.getFollowPersonList({
pageSize: 10000,
pageNum: 1
})
.then(res => {
this.followListData = res.list
})
},
addLine() {
if (this.followListData.length > 0 && this.followListData[this.followListData.length - 1].followName == '') {
return
}
this.followName = ''
this.followListData.push({ followName: '' })
},
handleSave() {
if (this.followListData[this.followListData.length - 1].followName == '' && this.followName == '') {
this.$message({
type: 'error',
message: '请输入跟进人'
})
return
}
if (this.followName) {
this.$apis.claims.addFollowPerson({ followName: this.followName }).then(res => {
this.$message({
type: 'success',
message: '添加成功!'
})
})
}
this.$emit('handleClose')
},
handleCancel() {
// this.isFollowSync = false
this.$emit('handleClose')
},
handleCalculate() {},
//删除
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: '已取消删除'
})
})
} 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>