shortLightDetail.vue
11.3 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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
<!-- 查看(轻改业务详情) -->
<template>
<div class="detail-dialog">
<baseDialog :dialog-config="dialogConfig"
:is-show.sync="visible"
@closeDialog="handleClose"
@handleClick="handleConfirm">
<div v-for="(detail, index) in configData"
:key="index"
class="item">
<div class="title">
{{ detail.title }}
</div>
<div class="detail-content">
<div v-if="detail.infoData && detail.infoData.length"
class="form_div">
<el-form class="edit-sub-block"
:inline="true"
label-width="110px">
<el-row :gutter="20">
<el-col v-for="(item, key) in detail.infoData"
:key="key"
:span="item.col ? item.col : 12">
<el-form-item :label="item.title">
<div v-if="item.className"
:class="[item.className(info)]">
</div>
<template v-if="
item.key === 'merchantName' || item.key === 'superiors'
">
<template v-if="
info[item.key]
&& info[item.key].split(',').length > 1
">
<span>
{{
info[item.key].split(',').slice(0, 1).join('')
}}
</span>
<el-popover placement="top"
trigger="hover"
width="fit-content">
<div :class="{
serverHeight:
info[item.key].split(',').length >= 10,
}">
<div v-for="(txt, i) in info[item.key].split(',')"
:key="i">
{{ txt }}
</div>
</div>
<template #reference>
<span class="more-info">
...({{
info[item.key].split(',').length
}})
</span>
</template>
</el-popover>
</template>
<template v-else>
<span>
{{
info[item.key] ? info[item.key] : "-"
}}
</span>
</template>
</template>
<template v-else>
{{
item.formatter
? item.formatter(info)
: info[item.key]
? info[item.key]
: "-"
}}
</template>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div v-else style="margin-top: 20px">
<d2-table :has-page="false"
:header-cell-style="headerCellStyle"
:table-data="detailInfo.tableData"
:table-params="detail.tableParams">
<template #tagNamesHtml="scope">
<div>
<template v-if="scope.scope.tagNames">
<el-tooltip :content="scope.scope.tagNames"
placement="top"
effect="dark">
<span class="two-line-ellipsis">
{{ scope.scope.tagNames }}
</span>
</el-tooltip>
</template>
<template v-else>
<span>-</span>
</template>
</div>
</template>
</d2-table>
</div>
</div>
</div>
</baseDialog>
</div>
</template>
<script>
import { getLightChangeDetail, getStaffInfo } from "@api/serviceCentre";
import { Util } from "@/common/util";
/** 表头背景色(同 whiteStaffList) */
const HEADER_BG = "#F2F4F7";
export default {
props: {
shortVisible: {
type: Boolean,
default: false,
},
shortInfo: {
type: Object,
default: () => ({}),
},
},
data() {
return {
dialogConfig: {
title: "轻改任务详情",
width: "720px",
},
configData: [
{
title: "个人信息",
infoData: [
{ title: "姓名:", key: "staffName" },
{ title: "门店:", key: "merchantName" },
{ title: "上级:", key: "superiors" },
{ title: "导师:", key: "mentors" },
],
},
{
title: "任务信息",
infoData: [
{ title: "复盘日期:", key: "checkDate" },
{
title: "任务状态:",
key: "taskStatus",
formatter: (cellValue) => {
return { 0: "进行中", 1: "已结束" }[cellValue.taskStatus] || "-";
},
className: (cellValue) => {
return { 0: "orgenSpot", 1: "ashSpot" }[cellValue.taskStatus];
},
},
{
title: "涉及客户数:",
key: "defeatCustomerDetail",
formatter: (cellValue) => {
return `${cellValue.detailList.length || 0}单`;
},
},
{
title: "课程结束时间:",
formatter: (cellValue) => {
return cellValue.deadline
? Util.dateFormate(cellValue.deadline, "YYYY-MM-DD HH:mm:ss")
: "-";
},
},
{
title: "整体完成时间:",
formatter: (cellValue) => {
return cellValue.completeTime
? Util.dateFormate(cellValue.completeTime, "YYYY-MM-DD HH:mm:ss")
: "-";
},
},
],
},
{
title: "客流复盘明细",
tableParams: {
btnId: new Date().getTime() + Number.parseInt(Math.random() * 1000),
tableColumns: [
{ label: "客户姓名", prop: "customerName" },
{ label: "意向车型", prop: "carModel" },
{ label: "靶向学习维度", prop: "tagNames", addHtml: "tagNamesHtml" },
{
label: "对练考核结果",
prop: "reviewStatus",
formatter: (cellValue) => {
// 复盘状态/考核结果,0-待复盘/待对练,1-已结案/已通过
return { 0: "待对练", 1: "已通过" }[cellValue.reviewStatus] || "-";
},
className: (cellValue) => {
return { 0: "orgenSpot", 1: "greenSpot" }[cellValue.reviewStatus];
},
},
{
label: "完成时间",
prop: "completeTime",
formatter: (cellValue) => {
return cellValue.completeTime
? Util.dateFormate(cellValue.completeTime, "YYYY-MM-DD HH:mm:ss")
: "-";
},
},
],
},
},
],
detailInfo: { tableData: [] },
info: {},
headerCellStyle: {
background: HEADER_BG,
},
};
},
computed: {
visible: {
get() {
return this.shortVisible;
},
set(newVal) {
this.$emit("dialogClose", { flag: newVal, attrName: "shortVisible" });
},
},
},
watch: {
shortInfo: {
handler(newVal) {
this.info = newVal || {};
if (!newVal?.staffPhone || !newVal?.checkDate) {
return;
}
this.getSopDetailTagListData();
// this.getStaffInfoData();
},
deep: true,
immediate: true,
},
},
methods: {
getSopDetailTagListData() {
const { staffPhone, checkDate, id, punishFlag } = this.shortInfo || {};
console.log(this.shortInfo, "shortInfo");
if (!staffPhone || !checkDate) {
return;
}
// getSopDetailTagList({ checkDate, staffPhone }).then((res) => {
// this.detailInfo.tableData = res || [];
// });
getLightChangeDetail({ id, punishFlag }).then((res) => {
this.detailInfo.tableData = res.detailList || [];
this.info = res || {};
});
},
getStaffInfoData() {
const { staffPhone } = this.shortInfo || {};
if (!staffPhone) {
return;
}
getStaffInfo({ staffPhone, currentPage: 1, pageSize: 10 }).then((res) => {
if (res && typeof res === "object") {
Object.assign(this.info, res);
}
});
},
handleClose() {
this.visible = false;
},
handleConfirm() {
this.visible = false;
},
},
};
</script>
<style scoped lang="scss">
.detail-dialog {
.two-line-ellipsis {
display: -webkit-box;
overflow: hidden;
text-overflow: ellipsis;
line-clamp: 2;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
word-break: break-all;
}
.item {
margin-bottom: 20px;
.title {
color: #111111;
font-size: 16px;
font-weight: 500;
padding: 10px 0;
border-bottom: 1px solid #e5e5e5;
}
.form_div {
color: #333333;
padding: 20px 30px;
.edit-sub-block {
.el-form-item {
width: 100%;
margin-bottom: 0px;
}
.itemDiv {
display: flex;
.halfItem {
width: 50%;
}
}
.detail-txt {
display: inline-block;
width: 200px;
vertical-align: bottom;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
::v-deep .el-form-item__content {
max-width: calc(100% - 110px);
word-break: break-all;
}
}
.edit-sub-block-two {
.el-form-item {
margin-bottom: 0px;
}
}
}
}
}
</style>