remarkDialog.vue
4.13 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<!-- 备注 -->
<template>
<GLDialog
bigTitle="备注"
:visible.sync="dialogShow"
class="accountDailog"
width="720px"
mode="big"
:close-on-click-modal="false"
:before-close="handleClose"
@onOk="handleAddConfirm"
@onCancel="dialogShow = false"
>
<!-- 表格区域 开始 -->
<GLTable
:tableData="infoForm.remarks"
:tableParams="tableParams"
:hasPage="false"
>
<template
slot="ramark"
slot-scope="scope"
>
<template v-if="isEdit && scope.index == 0">
<el-input
v-model="scope.scope.remark"
type="text"
placeholder="请输入内容"
maxlength="15"
size="small"
></el-input>
</template>
<template v-else>
{{ scope.scope.remark || '-'}}
</template>
</template>
<template
slot="auth-button"
slot-scope="scope"
>
<template v-if="scope.index == 0">
<template v-if="isEdit">
<el-button
type="text"
size="mini"
@click="cancel"
>
取消
</el-button>
</template>
<template v-else>
<el-button
type="text"
size="mini"
@click="handleRamrk(scope.scope.remark)"
>
编辑备注
</el-button>
</template>
</template>
<template v-else>
-
</template>
</template>
</GLTable>
</GLDialog>
</template>
<script>
import * as dayjs from 'dayjs'
export default {
name: 'RemarkDialog',
data () {
return {
infoForm: {
remarks: []
},
dialogConfig: {
title: '跟进记录',
width: '720px'
},
originData: '',
isEdit: false,
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableOption: {
width: '120px'
},
tableColumns: [
{
label: '跟进时间',
formatter: (cellValue) => {
return dayjs(cellValue.updatedDate).format("YYYY-MM-DD HH:mm:ss")
},
width: '170',
}, {
label: '跟进人',
prop: "userName",
width: '80',
}, {
label: '事件',
width: '100',
formatter: (cellValue) => {
return {
1: "车主领券",
2: "车主预约",
3: "预约时间",
4: "修改时间",
5: "取消预约",
}[cellValue.eventType] || '-'
}
}, {
label: '备注',
prop: 'remark',
addHtml: 'ramark'
}
]
},
}
},
props: {
visible: {
type: Boolean,
default: false
},
paramsObj: {
type: Object,
default: null
}
},
computed: {
dialogShow: {
get () {
return this.visible
},
set (newVal) {
this.$emit('dialogClose', { flag: newVal })
}
}
},
mounted () {
console.log('paramsObj', this.paramsObj)
this.isEdit = false
this.originData = ''
this.infoForm.remarks = this.$common.utils.deepClone(this.paramsObj.remarks)
},
methods: {
handleRamrk (e) {
this.originData = e
this.isEdit = true
},
cancel () {
this.isEdit = false
this.infoForm.remarks[0].remark = this.originData
},
handleAddConfirm () {
let { remark } = this.infoForm.remarks[0],
{ inviteFollowRecordId } = this.paramsObj,
params = {
remark,
inviteFollowRecordId
}
if (!remark) {
return this.dialogShow = true
}
this.$apis.invitation.followRecordUpdate(params).then(res => {
this.$notify({
type: 'success',
title: '操作成功'
})
this.dialogShow = true
})
}
}
}
</script>
<style lang="scss" scoped>
.reject-dialog {
margin-top: 20px;
}
.default-width {
width: 400px;
}
</style>