index.vue
8.82 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
<template>
<el-drawer class="strategy-drawer"
size="69.44vw"
:visible.sync="dialogShow"
:wrapper-closable="false"
@close="close">
<template #title>
<div class="strategy-drawer-title">
查看详情
</div>
</template>
<div class="drawer-content">
<el-scrollbar class="scrollbar-wrapper">
<div class="detail-container">
<el-row class="section-content">
<el-col v-for="(item, idx) in detailData"
:key="idx"
class="info-item"
:span="item.fullRow ? 24 : 12">
<div class="info-label">
{{ item.subtitle }}:
</div>
<div class="info-value">
<template v-if="!item.isImage">
{{ item.value || '-' }}
</template>
<template v-else>
<div v-if="item.value && item.value.length > 0" class="image-list">
<el-image v-for="(img, imgIdx) in item.value"
:key="imgIdx"
fit="cover"
style="width: 80px; height: 80px; margin-right: 10px; border-radius: 4px;"
:preview-src-list="item.value"
:src="img">
</el-image>
</div>
<div v-else>
-
</div>
</template>
</div>
</el-col>
</el-row>
</div>
</el-scrollbar>
<div class="footer">
<el-button v-preventReClick
:size="size"
@click="close">
返回
</el-button>
</div>
</div>
</el-drawer>
</template>
<script>
import { queryStrategyStudyDetailById } from "@/api/earlyWarningManager";
import { mentoringMethod_offline, mentoringMethod_online, mentoringTopic_options, TASK_OPTIONS } from "./contant.js";
export default {
name: "TaskDetail",
props: {
visibleSync: {
type: Boolean,
default: false,
},
item: {
type: Object,
default: () => ({}),
},
},
data() {
return {
size: "small",
detailData: [],
};
},
computed: {
dialogShow: {
get() {
return this.visibleSync;
},
set(val) {
this.$emit("update:visibleSync", val);
},
},
},
watch: {
visibleSync(val) {
if (val) {
this.initData();
}
},
},
methods: {
close() {
this.dialogShow = false;
},
async initData() {
this.detailData = [];
if (!this.item.id) {
return;
}
try {
const res = await queryStrategyStudyDetailById({ id: this.item.id });
if (res) {
this.formatDetailData(res);
}
} catch (error) {
console.error(error);
}
},
formatDetailData(data) {
const staffList = data.staffList || [];
const { strategyType, strategyExtension, biz } = data;
const mentoringApplicationDetail = data.mentoringApplicationDetail || {};
// 问题人员:userPosition=0
const problemStaffs = staffList.filter(e => e.userPosition === 0).map(e => e.userName).join("、");
// 执行人员:userPosition=8 或 9
const executorStaffs = staffList.filter(e => e.userPosition === 8 || e.userPosition === 9).map(e => e.userName).join("、");
const targetValue = strategyExtension?.targetValue;
const taskTypeName = TASK_OPTIONS[strategyType] || "-";
const collabDetail = data?.collaborativeTaskDetail || {};
const taskStatusName = collabDetail?.taskStatus == "FINISHED" ? "已完成" : "未完成";
const detailData = [
{ subtitle: "任务类型", value: taskTypeName, fullRow: false },
{ subtitle: "操作人", value: data.createdBy || "-", fullRow: false },
{ subtitle: "操作时间", value: data.createdDate || "-", fullRow: false },
];
if (strategyType != 8) {
let isFinished = collabDetail?.taskStatus == "FINISHED";
// 仅 strategyType=9 时展示问题人员
if (strategyType === 9) {
detailData.push({ subtitle: "问题人员", value: problemStaffs || "-", fullRow: true });
}
if (strategyType === 12) {
detailData.push({ subtitle: "目标触客率", value: (targetValue != "" && targetValue != null && targetValue != undefined) ? `${targetValue}%` : "-", fullRow: true });
}
// 剩余基础字段
detailData.push(
{ subtitle: "执行人员", value: executorStaffs || "-", fullRow: true },
{ subtitle: "任务说明", value: data.description || "-", fullRow: true },
{ subtitle: "任务状态", value: taskStatusName, fullRow: true },
);
if ([9, 13, 14].includes(strategyType)) {
detailData.push({ subtitle: "任务执行结果", value: isFinished ? collabDetail.executionResultName || "-" : "-", fullRow: true });
if (strategyType === 9) {
let { personnelChangeTypeCode, personnelChangeTypeName, replacementStaffName, recruitmentQuantity, recruitmentApplyTime } = collabDetail;
let personnelText = "-";
if (isFinished) {
if (["CREATE_RECRUITMENT_DEMAND", "LINK_EXISTING_RECRUITMENT_DEMAND"].includes(personnelChangeTypeCode)) {
personnelText = `${data.merchantName}${recruitmentQuantity || 0}人${recruitmentApplyTime || ""}`;
} else if (personnelChangeTypeCode == "LINK_REPLACEMENT_STAFF") {
personnelText = replacementStaffName || "-";
} else {
personnelText = personnelChangeTypeName || "-";
}
}
detailData.push({ subtitle: "关联招聘或人员", value: personnelText, fullRow: true });
}
}
// 协同任务专有详情 (collaborativeTaskDetail)
detailData.push(
{ subtitle: "完成描述", value: collabDetail.completionDescription || "-", fullRow: true },
{ subtitle: "完成人", value: isFinished ? collabDetail.completedBy || "-" : "-", fullRow: false },
{ subtitle: "完成时间", value: isFinished ? collabDetail.completedTime || "-" : "-", fullRow: false },
);
} else {
let persontoBeMentored = staffList.filter(e => e.relType === 2).map(e => e.userName).join("/");
let supervisor = staffList.filter(e => e.relType === 1).map(e => e.userName).join("/");
let prevText = biz == 2 ? "平均客单价" : "转化率";
let unit = biz == 2 ? "" : "%";
let taskDetail = mentoringApplicationDetail?.taskDetail || {};
let { mentoringScene, mentoringTime, mentoringMethod, mentoringTopic, pushCourses, contentSummary, evidenceImages } = taskDetail;
let mentoringMethodText = mentoringMethod ? mentoringScene == 1 ? mentoringMethod_online[mentoringMethod] : mentoringMethod_offline[mentoringMethod] : "-";
detailData.push(
{ subtitle: "需带教人员", value: persontoBeMentored, fullRow: true },
{ subtitle: "指定带教督导", value: supervisor, fullRow: true },
{ subtitle: "带教目标", value: (targetValue != "" && targetValue != null && targetValue != undefined) ? `${prevText}=${targetValue}${unit}` : "-", fullRow: true },
{ subtitle: "任务状态", value: taskStatusName, fullRow: true },
{ subtitle: "带教场景", value: {
1: "线上",
2: "线下",
}[mentoringScene] || "-", fullRow: true },
{ subtitle: "带教时间", value: mentoringTime, fullRow: true },
{ subtitle: "带教方式", value: mentoringMethodText, fullRow: true },
{ subtitle: "带教主题", value: mentoringTopic ? mentoringTopic_options[mentoringTopic] : "-", fullRow: true },
{ subtitle: "推送课程", value: pushCourses || "-", fullRow: true },
{ subtitle: "带教内容摘要", value: contentSummary || "-", fullRow: true },
{ subtitle: "带教招聘佐证取", value: evidenceImages, fullRow: true, isImage: true },
);
}
this.detailData = detailData;
},
},
};
</script>
<style scoped lang="scss">
::v-deep.strategy-drawer {
.el-drawer__header {
padding: 0;
margin: 0;
border-bottom: 1px solid #e5e5e5;
}
.el-drawer__close-btn {
padding: 0 20px;
.el-dialog__close {
font-weight: 700;
font-size: 24px;
}
}
&-title {
height: 26px;
line-height: 26px;
color: #333333;
font-size: 18px;
padding: 17px 20px;
font-weight: bold;
}
.el-drawer__body {
height: calc(100% - 55px);
overflow: hidden;
}
}
.drawer-content {
height: 100%;
display: flex;
flex-direction: column;
.scrollbar-wrapper {
flex: 1;
overflow: hidden;
::v-deep .el-scrollbar__wrap {
overflow-x: hidden;
}
}
.detail-container {
padding: 20px;
}
.info-item {
display: flex;
margin-bottom: 16px;
line-height: 20px;
font-size: 14px;
.info-label {
color: #666;
width: 120px;
flex-shrink: 0;
text-align: right;
}
.info-value {
color: #333;
flex: 1;
word-break: break-all;
.image-list {
display: flex;
flex-wrap: wrap;
}
}
}
.footer {
padding: 14px 0;
border-top: 1px solid #e5e5e5;
display: flex;
justify-content: flex-end;
padding-right: 20px;
}
}
</style>