Commit 4cd3dc78 by wangzhihui

```

feat(earlyWarning): 新增任务详情组件并优化策略列表展示

- 在AddTask组件中添加问题人员字段的条件显示和验证逻辑,
  仅在任务类型为9时显示并进行必填验证
- 调整StrategyList组件中的策略常量拆分,将STRATEGY_9_10_11_12
  拆分为独立的STRATEGY_9和STRATEGY_10_11_12
- 更新策略数据格式化逻辑,对问题人员和执行人员按职位过滤显示
- 新增TaskDetail组件用于任务详情展示,并在策略列表中
  根据策略类型打开对应的详情弹窗
- 优化TeachingDetail组件样式并修复接口调用问题
```
1 parent 3445ddc0
...@@ -37,7 +37,9 @@ ...@@ -37,7 +37,9 @@
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="问题人员:" prop="staffList"> <el-form-item v-if="formData.taskType === 9"
label="问题人员:"
prop="staffList">
<el-button size="small" @click="openStaffDialog"> <el-button size="small" @click="openStaffDialog">
选择人员 选择人员
</el-button> </el-button>
...@@ -147,7 +149,16 @@ export default { ...@@ -147,7 +149,16 @@ export default {
{ required: true, message: "请选择任务类型", trigger: "change" }, { required: true, message: "请选择任务类型", trigger: "change" },
], ],
staffList: [ staffList: [
{ type: "array", required: true, message: "请选择问题人员", trigger: "change" }, {
validator: (rule, value, callback) => {
if (this.formData.taskType === 9 && (!value || value.length === 0)) {
callback(new Error("请选择问题人员"));
} else {
callback();
}
},
trigger: "change",
},
], ],
executorUuid: [ executorUuid: [
{ required: true, message: "请选择执行人员", trigger: "change" }, { required: true, message: "请选择执行人员", trigger: "change" },
...@@ -183,6 +194,18 @@ export default { ...@@ -183,6 +194,18 @@ export default {
this.init(); this.init();
} }
}, },
"formData.taskType": function (val) {
// 切换任务类型时,如果不是人员更换评估,清空问题人员
if (val !== 9) {
this.formData.staffList = [];
}
// 触发重新校验
this.$nextTick(() => {
if (this.$refs.form) {
this.$refs.form.validateField("staffList");
}
});
},
}, },
methods: { methods: {
init() { init() {
......
...@@ -79,7 +79,8 @@ import { ...@@ -79,7 +79,8 @@ import {
STRATEGY_3, STRATEGY_3,
STRATEGY_7, STRATEGY_7,
STRATEGY_8, STRATEGY_8,
STRATEGY_9_10_11_12, STRATEGY_9,
STRATEGY_10_11_12,
STRATEGY_2456, STRATEGY_2456,
STRATEGYTYPEOPTIONS, STRATEGYTYPEOPTIONS,
} from "./contant"; } from "./contant";
...@@ -115,15 +116,15 @@ export default { ...@@ -115,15 +116,15 @@ export default {
? STRATEGY_01 ? STRATEGY_01
: [2, 4, 5, 6].includes(strategyType) : [2, 4, 5, 6].includes(strategyType)
? STRATEGY_2456 ? STRATEGY_2456
: [9, 10, 11, 12].includes(strategyType) : [10, 11, 12].includes(strategyType)
? STRATEGY_9_10_11_12 ? STRATEGY_10_11_12
: { : {
3: STRATEGY_3, 3: STRATEGY_3,
7: STRATEGY_7, 7: STRATEGY_7,
8: STRATEGY_8, 8: STRATEGY_8,
9: STRATEGY_9,
}[strategyType] || []; }[strategyType] || [];
console.log(list, "list");
return [ return [
...list, ...list,
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 'wangzhihui' '1733904062@qq.com' * @Author: 'wangzhihui' '1733904062@qq.com'
* @Date: 2026-04-01 09:57:49 * @Date: 2026-04-01 09:57:49
* @LastEditors: 'wangzhihui' '1733904062@qq.com' * @LastEditors: 'wangzhihui' '1733904062@qq.com'
* @LastEditTime: 2026-06-01 15:21:51 * @LastEditTime: 2026-06-02 17:54:09
* @FilePath: \dj-car-life-system\src\views\earlyWarningManager\strategyCentre\storeSignboard\components\StrategyList\contant.js * @FilePath: \dj-car-life-system\src\views\earlyWarningManager\strategyCentre\storeSignboard\components\StrategyList\contant.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
...@@ -35,7 +35,7 @@ function STAFF_FORMAT(label) { ...@@ -35,7 +35,7 @@ function STAFF_FORMAT(label) {
label, label,
format: (val) => { format: (val) => {
let { staffList } = val; let { staffList } = val;
return staffList.map(item => item.userName).join("/") || "-"; return staffList.filter(item => !item.userPosition).map(item => item.userName).join("/") || "-";
}, },
}; };
} }
...@@ -88,9 +88,25 @@ const STRATEGY_7 = [ ...@@ -88,9 +88,25 @@ const STRATEGY_7 = [
const STRATEGY_8 = [ const STRATEGY_8 = [
STAFF_FORMAT("需带教人员"), STAFF_FORMAT("需带教人员"),
]; ];
const STRATEGY_9_10_11_12 = [ const STRATEGY_9 = [
STAFF_FORMAT("问题人员"), STAFF_FORMAT("问题人员"),
STAFF_FORMAT("执行人员"), {
label: "执行人员",
format: (val) => {
let { staffList } = val;
return staffList.filter(item => item.userPosition != 0).map(item => item.userName).join("/") || "-";
},
},
];
const STRATEGY_10_11_12 = [
{
label: "执行人员",
format: (val) => {
let { staffList } = val;
return staffList.filter(item => item.userPosition != 0).map(item => item.userName).join("/") || "-";
},
},
]; ];
export { export {
...@@ -98,7 +114,8 @@ export { ...@@ -98,7 +114,8 @@ export {
STRATEGY_3, STRATEGY_3,
STRATEGY_7, STRATEGY_7,
STRATEGY_8, STRATEGY_8,
STRATEGY_9_10_11_12, STRATEGY_9,
STRATEGY_10_11_12,
STRATEGY_2456, STRATEGY_2456,
STRATEGYTYPEOPTIONS, STRATEGYTYPEOPTIONS,
......
...@@ -51,10 +51,10 @@ ...@@ -51,10 +51,10 @@
@openReceptionDialog="$emit('openReceptionDialog', $event)"> @openReceptionDialog="$emit('openReceptionDialog', $event)">
</StrategyDetail> </StrategyDetail>
<AddStrategy :dialogVisible.sync="addStrategyVisible" @refresh="init"></AddStrategy> <AddStrategy :dialogVisible.sync="addStrategyVisible" @refresh="init"></AddStrategy>
</AddStrategy>
<TeachingDetail :item="currentItem" <TeachingDetail :item="currentItem"
:visibleSync.sync="teachingDetailVisible"> :visibleSync.sync="teachingDetailVisible">
</TeachingDetail> </TeachingDetail>
<TaskDetail :item="currentItem" :visibleSync.sync="taskDetailVisible"></TaskDetail>
</div> </div>
</template> </template>
...@@ -67,6 +67,7 @@ import AddStrategy from "../AddStrategy/index.vue"; ...@@ -67,6 +67,7 @@ import AddStrategy from "../AddStrategy/index.vue";
import AddTask from "../AddTask/index.vue"; import AddTask from "../AddTask/index.vue";
import AddTeaching from "../AddTeaching/index.vue"; import AddTeaching from "../AddTeaching/index.vue";
import StrategyDetail from "../StrategyDetail/index.vue"; import StrategyDetail from "../StrategyDetail/index.vue";
import TaskDetail from "../taskDetail/index.vue";
import TeachingDetail from "../TeachingDetail/index.vue"; import TeachingDetail from "../TeachingDetail/index.vue";
import StrategyItem from "./StrategyItem.vue"; import StrategyItem from "./StrategyItem.vue";
...@@ -79,6 +80,7 @@ export default { ...@@ -79,6 +80,7 @@ export default {
AddTask, AddTask,
StrategyDetail, StrategyDetail,
TeachingDetail, TeachingDetail,
TaskDetail,
}, },
inject: ["GET_PARAMS_INFO"], inject: ["GET_PARAMS_INFO"],
data() { data() {
...@@ -89,6 +91,7 @@ export default { ...@@ -89,6 +91,7 @@ export default {
addTaskVisible: false, addTaskVisible: false,
strategyDetailVisible: false, strategyDetailVisible: false,
teachingDetailVisible: false, teachingDetailVisible: false,
taskDetailVisible: false,
currentItem: {}, currentItem: {},
viewKey: Date.now(), viewKey: Date.now(),
loading: false, loading: false,
...@@ -131,8 +134,10 @@ export default { ...@@ -131,8 +134,10 @@ export default {
}, },
toDetail(item) { toDetail(item) {
this.currentItem = item; this.currentItem = item;
if (item.strategyType == 2) { if (item.strategyType === 8) {
this.teachingDetailVisible = true; this.teachingDetailVisible = true;
} else if ([9, 10, 11, 12].includes(item.strategyType)) {
this.taskDetailVisible = true;
} else { } else {
this.strategyDetailVisible = true; this.strategyDetailVisible = true;
} }
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
</template> </template>
<script> <script>
import { queryStrategyTaskDetailById } from "@/api/earlyWarningManager"; import { queryStrategyStudyDetailById } from "@/api/earlyWarningManager";
export default { export default {
name: "TeachingDetail", name: "TeachingDetail",
...@@ -109,7 +109,8 @@ export default { ...@@ -109,7 +109,8 @@ export default {
if (!this.item.id) if (!this.item.id)
return; return;
try { try {
const res = await queryStrategyTaskDetailById({ id: this.item.id }); this.item.id = 115;
const res = await queryStrategyStudyDetailById({ id: this.item.id });
if (res) { if (res) {
this.formatDetailData(res); this.formatDetailData(res);
} }
...@@ -215,18 +216,15 @@ export default { ...@@ -215,18 +216,15 @@ export default {
} }
.detail-container { .detail-container {
padding: 20px; padding: 0 20px;
} }
.detail-section { .detail-section {
margin-bottom: 24px;
.section-title { .section-title {
font-size: 15px; color: #333333;
font-weight: 600; font-size: 16px;
color: #333; padding: 16px 0;
padding: 12px 0; border-bottom: 1px solid #e5e5e5;
border-bottom: 1px solid #eee;
margin-bottom: 16px; margin-bottom: 16px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
...@@ -239,7 +237,8 @@ export default { ...@@ -239,7 +237,8 @@ export default {
.info-item { .info-item {
display: flex; display: flex;
margin-bottom: 16px; margin-bottom: 16px;
line-height: 24px; line-height: 20px;
font-size: 14px;
.info-label { .info-label {
color: #666; color: #666;
......
<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"
:preview-src-list="item.value"
:src="img"
style="width: 80px; height: 80px; margin-right: 10px; border-radius: 4px;">
</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";
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() {
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 || [];
// 问题人员: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 taskTypeMap = {
9: "人员更换评估",
10: "商务政策更新评估",
11: "多品类拓张",
12: "流量问题改善",
};
const taskTypeName = taskTypeMap[data.strategyType] || "-";
const taskStatusName = data.pushFlag === 6 ? "已完成" : "未完成";
const detailData = [
{ subtitle: "任务类型:", value: taskTypeName, fullRow: false },
{ subtitle: "操作人:", value: data.createdBy || "-", fullRow: false },
{ subtitle: "操作时间:", value: data.createdDate || "-", fullRow: false },
];
// 仅 strategyType=9 时展示问题人员
if (data.strategyType === 9) {
detailData.push({ subtitle: "问题人员:", value: problemStaffs || "-", fullRow: true });
}
// 剩余基础字段
detailData.push(
{ subtitle: "执行人:", value: executorStaffs || "-", fullRow: true },
{ subtitle: "任务说明:", value: data.description || "-", fullRow: true },
{ subtitle: "任务状态:", value: taskStatusName, fullRow: true },
);
// 协同任务专有详情 (collaborativeTaskDetail)
const collabDetail = data.collaborativeTaskDetail || {};
detailData.push(
{ subtitle: "完成描述:", value: collabDetail.completionDescription || "-", fullRow: true },
{ subtitle: "完成人:", value: collabDetail.completedBy || "-", fullRow: false },
{ subtitle: "完成时间:", value: collabDetail.completedTime || "-", fullRow: false },
);
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: 110px;
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>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!