Commit 71f77149 by wangzhihui

```

refactor(api): 调整预警管理API文件格式化

调整了src/api/earlyWarningManager.js文件中的代码格式,
包括修正分号使用、函数参数格式、字符串引号统一等,
同时新增了一个获取区域运营执行人员列表的API函数。
```
1 parent e7b7faba
<template> <template>
<baseDialog <baseDialog class="detail-content"
:is-show.sync="dialogShow"
:dialog-config="dialogConfig.config"
class="detail-content"
@handleClick="submit"
:config="config" :config="config"
> :dialog-config="dialogConfig.config"
<div :is-show.sync="dialogShow"
class="content" @handleClick="submit">
:key="viewKey" <div :key="viewKey"
> class="content">
<div class="left"> <div class="left">
<div class="title flex">人员列表</div> <div class="title flex">
人员列表
</div>
<div class="left-content"> <div class="left-content">
<div class="search-box flex"> <div class="search-box flex">
<el-input <el-input v-model="searchForm.staffName"
placeholder="搜索员工名称"
size="small"
class="search-input" class="search-input"
clearable clearable
v-model="searchForm.staffName" placeholder="搜索员工名称"
></el-input> size="small">
<el-button </el-input>
<el-button size="small"
type="primary" type="primary"
size="small" @click="handleSearch">
@click="handleSearch" 查询
>查询</el-button> </el-button>
<el-button <el-button size="small"
size="small" @click="handleReset">
@click="handleReset" 重置
>重置</el-button> </el-button>
</div> </div>
<div class="table"> <div class="table">
<d2-table <d2-table ref="multipleTable"
ref="multipleTable" :before-search-fn="beforeSearchFn"
:search-form="searchFormSearch"
:table-params="tableParams"
:get-list-api="getListApi" :get-list-api="getListApi"
:has-num="false" :has-num="false"
:layout="'total, prev, pager, next'" layout="total, prev, pager, next"
:pagerCount="5" :pager-count="5"
@setTableFinishFun="setTableFinishFun" :search-form="searchFormSearch"
@selectionTable="selectionTable" :table-params="tableParams"
@selectRow="selectRow"
@selectAll="selectAll" @selectAll="selectAll"
:before-search-fn="beforeSearchFn" @selectRow="selectRow"
> @selectionTable="selectionTable"
@setTableFinishFun="setTableFinishFun">
</d2-table> </d2-table>
</div> </div>
</div> </div>
</div> </div>
<div class="right"> <div class="right">
<div class="title flex"> <div class="title flex">
已选人员<div class="num">{{ count }}</div>人 已选人员<div class="num">
<el-button {{ count }}
class="clear" </div>人
<el-button class="clear"
type="text" type="text"
@click="clearChooseList" @click="clearChooseList">
>清空</el-button> 清空
</el-button>
</div> </div>
<div class="right-content"> <div class="right-content">
<el-scrollbar class="multiple-tag-box"> <el-scrollbar class="multiple-tag-box">
<div class="multiple-tags"> <div class="multiple-tags">
<template v-for="(i,ind) in chooseList"> <template v-for="(i, ind) in chooseList">
<el-tag <el-tag :key="ind"
closable closable
:key="ind"
@close="remove(i,ind)"
disable-transitions disable-transitions
>{{ i.staffName }}</el-tag> @close="remove(i, ind)">
{{ i.staffName }}
</el-tag>
</template> </template>
</div> </div>
</el-scrollbar> </el-scrollbar>
...@@ -81,26 +78,24 @@ ...@@ -81,26 +78,24 @@
<script> <script>
import { import {
getStrategyStaffList, getStrategyStaffList,
} from "@api/earlyWarningManager" } from "@api/earlyWarningManager";
import multipleMixin from "./multipleMixin"; import multipleMixin from "./multipleMixin";
export default { export default {
name: "MultipleStaff", name: "MultipleStaff",
mixins: [multipleMixin], mixins: [multipleMixin],
mounted () { data() {
},
data () {
return { return {
dialogConfig: { dialogConfig: {
config: { config: {
title: "选择人员", title: "选择人员",
width: "1092px" width: "1092px",
}
}, },
targetId: 'staffUuid', },
targetId: "staffUuid",
getListApi: getStrategyStaffList, getListApi: getStrategyStaffList,
searchForm: { searchForm: {
staffName: '' staffName: "",
}, },
tableParams: { tableParams: {
listName: "list", listName: "list",
...@@ -110,51 +105,54 @@ export default { ...@@ -110,51 +105,54 @@ export default {
{ {
label: "员工姓名", label: "员工姓名",
prop: "staffName", prop: "staffName",
minWidth: 130 minWidth: 130,
}, },
{ {
label: "手机号", label: "手机号",
prop: "phoneNumber", prop: "phoneNumber",
minWidth: 160 minWidth: 160,
}, },
{ {
label: "岗位", label: "岗位",
minWidth: 130, minWidth: 130,
formatter (row) { formatter(row) {
return { return {
0: '驻店人员', 0: "驻店人员",
6: '飞行督导', 6: "飞行督导",
9: '区域运营' 9: "区域运营",
}[row.positionType] }[row.positionType];
}
}, },
]
}, },
} ],
},
};
},
mounted() {
}, },
methods: { methods: {
beforeSearchFn () { beforeSearchFn() {
return new Promise((resolve) => { return new Promise((resolve) => {
let { positionTypeList, merchantList, paramsInfo, delMerchantList } = this;
let { positionTypeList, merchantList, paramsInfo ,delMerchantList} = this, let { staffName } = this.searchForm;
{ staffName } = this.searchForm, let merchantIdList = [];
merchantIdList = [] if (merchantList.length)
if (merchantList.length) merchantIdList = merchantList.map(item => item.merchantId) merchantIdList = merchantList.map(item => item.merchantId);
else merchantIdList = paramsInfo.merchantIds else merchantIdList = paramsInfo.merchantIds;
let params = { let params = {
positionTypeList, positionTypeList,
sceneType: 0, sceneType: 0,
staffName, staffName,
merchantIdList merchantIdList,
} };
if(delMerchantList) params.merchantIdList = [] if (delMerchantList)
params.merchantIdList = [];
this.searchFormSearch = this.deepClone(params) this.searchFormSearch = this.deepClone(params);
resolve() resolve();
}) });
}, },
} },
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -2,69 +2,70 @@ export default { ...@@ -2,69 +2,70 @@ export default {
props: { props: {
visible: { visible: {
type: Boolean, type: Boolean,
default: false default: false,
}, },
chooseData: { chooseData: {
type: Array, type: Array,
default: () => [] default: () => [],
} },
}, },
inject: [ inject: [
'deepClone', "deepClone",
'GET_POSITION_TYPE_LIST', "GET_POSITION_TYPE_LIST",
'GET_PARAMS_INFO', "GET_PARAMS_INFO",
'GET_MERCHANT_LIST', "GET_MERCHANT_LIST",
'GET_BIZ', "GET_BIZ",
'DEL_PARAMS_MERCHANT_LIST' "DEL_PARAMS_MERCHANT_LIST",
], ],
computed: { computed: {
dialogShow: { dialogShow: {
get () { get() {
return this.visible return this.visible;
}, },
set (val) { set(val) {
this.chooseList = [] this.chooseList = [];
this.close() this.close();
}
}, },
count () {
return this.chooseList.length
}, },
positionTypeList () { count() {
return this.GET_POSITION_TYPE_LIST && this.GET_POSITION_TYPE_LIST() return this.chooseList.length;
}, },
paramsInfo () { positionTypeList() {
return this.GET_PARAMS_INFO && this.GET_PARAMS_INFO() return this.GET_POSITION_TYPE_LIST && this.GET_POSITION_TYPE_LIST();
}, },
merchantList () { paramsInfo() {
return this.GET_MERCHANT_LIST && this.GET_MERCHANT_LIST() return this.GET_PARAMS_INFO && this.GET_PARAMS_INFO();
}, },
biz () { merchantList() {
return this.GET_BIZ && this.GET_BIZ() return this.GET_MERCHANT_LIST && this.GET_MERCHANT_LIST();
},
biz() {
return this.GET_BIZ && this.GET_BIZ();
},
delMerchantList() {
return this.DEL_PARAMS_MERCHANT_LIST && this.DEL_PARAMS_MERCHANT_LIST();
}, },
delMerchantList(){
return this.DEL_PARAMS_MERCHANT_LIST && this.DEL_PARAMS_MERCHANT_LIST()
}
}, },
watch: { watch: {
visible: { visible: {
handler (val) { handler(val) {
if (val) { if (val) {
this.searchForm = this.$options.data.call(this).searchForm this.searchForm = this.$options.data.call(this).searchForm;
let multipleTable = this.multipleTable() let multipleTable = this.multipleTable();
if (multipleTable) multipleTable.page.currentPage = 1 if (multipleTable)
this.chooseList = this.deepClone(this.chooseData) multipleTable.page.currentPage = 1;
this.viewKey = Date.now() this.chooseList = this.deepClone(this.chooseData);
this.viewKey = Date.now();
} }
}, },
immediate: true, immediate: true,
deep: true deep: true,
}, },
}, },
mounted () { mounted() {
}, },
data () { data() {
return { return {
viewKey: Date.now(), viewKey: Date.now(),
config: { config: {
...@@ -75,93 +76,97 @@ export default { ...@@ -75,93 +76,97 @@ export default {
}, },
searchFormSearch: {}, searchFormSearch: {},
chooseList: [], chooseList: [],
} };
}, },
methods: { methods: {
getParams () { getParams() {
const params = this.deepClone(this.searchForm) const params = this.deepClone(this.searchForm);
return params return params;
}, },
beforeSearchFn () { beforeSearchFn() {
return new Promise((resolve) => { return new Promise((resolve) => {
this.searchFormSearch = this.getParams() this.searchFormSearch = this.getParams();
resolve() resolve();
}) });
}, },
close () { close() {
this.$emit('dialogClose') this.$emit("dialogClose");
}, },
remove (i, index) { remove(i, index) {
this.chooseList.splice(index, 1) this.chooseList.splice(index, 1);
let tableData = this.multipleTable().data let tableData = this.multipleTable().data;
tableData.map(j => { tableData.map((j) => {
if (i[this.targetId] === j[this.targetId]) { if (i[this.targetId] === j[this.targetId]) {
this.multipleTable().tableRef.toggleRowSelection(j, false) this.multipleTable().tableRef.toggleRowSelection(j, false);
} }
}) });
}, },
async submit () { async submit() {
this.$emit('choose', this.chooseList) this.$emit("choose", this.chooseList);
this.close() this.close();
}, },
handleReset () { handleReset() {
this.searchForm = this.$options.data.call(this).searchForm this.searchForm = this.$options.data.call(this).searchForm;
this.multipleTable().page.currentPage = 1 this.multipleTable().page.currentPage = 1;
this.handleSearch() this.handleSearch();
}, },
handleSearch () { handleSearch() {
this.multipleTable().page.currentPage = 1 this.multipleTable().page.currentPage = 1;
this.multipleTable().refreshTable() this.multipleTable().refreshTable();
}, },
setTableFinishFun (data) { setTableFinishFun(data) {
this.$nextTick(() => { this.$nextTick(() => {
let { chooseList, targetId } = this let { chooseList, targetId } = this;
chooseList.map(item => { chooseList.map((item) => {
let index = data.findIndex(i => i[targetId] === item[targetId]) let index = data.findIndex(i => i[targetId] === item[targetId]);
if (index > -1) this.multipleTable().tableRef.toggleRowSelection(data[index], true) if (index > -1)
}) this.multipleTable().tableRef.toggleRowSelection(data[index], true);
}) });
}, });
selectionTable (list) { },
selectionTable(list) {
this.$nextTick(() => { this.$nextTick(() => {
let { targetId, chooseList } = this let { targetId, chooseList } = this;
if (this.formatTag) list = list.map(e => { if (this.formatTag) {
return this.formatTag(e) list = list.map((e) => {
}) return this.formatTag(e);
});
}
// 合并列表后基于 targetId 去重 // 合并列表后基于 targetId 去重
const mergedList = [...chooseList, ...list] const mergedList = [...chooseList, ...list];
this.chooseList = [...new Map( this.chooseList = [...new Map(
mergedList.map(item => [item[targetId], item]) mergedList.map(item => [item[targetId], item]),
).values()] ).values()];
}) });
}, },
selectRow (list, row) { selectRow(list, row) {
let { targetId } = this, let { targetId } = this;
index = list.findIndex(i => i[targetId] === row[targetId]) let index = list.findIndex(i => i[targetId] === row[targetId]);
if (index == -1) { if (index == -1) {
let delIndex = this.chooseList.findIndex(i => i[targetId] === row[targetId]) let delIndex = this.chooseList.findIndex(i => i[targetId] === row[targetId]);
if (delIndex > -1) this.chooseList.splice(delIndex, 1) if (delIndex > -1)
this.chooseList.splice(delIndex, 1);
} }
}, },
selectAll (list) { selectAll(list) {
if (!list.length) { if (!list.length) {
let tableData = this.multipleTable().data, let tableData = this.multipleTable().data;
{ targetId } = this let { targetId } = this;
// 使用 Set 存储 tableData 中的所有 targetId // 使用 Set 存储 tableData 中的所有 targetId
const tableDataIds = new Set(tableData.map(item => item[targetId])); const tableDataIds = new Set(tableData.map(item => item[targetId]));
// 保留 chooseList 中不在 tableData 的项目 // 保留 chooseList 中不在 tableData 的项目
this.chooseList = this.chooseList.filter(item => this.chooseList = this.chooseList.filter(item =>
!tableDataIds.has(item[targetId]) !tableDataIds.has(item[targetId]),
); );
} }
}, },
multipleTable () { multipleTable() {
return this.$refs.multipleTable return this.$refs.multipleTable;
},
clearChooseList() {
this.chooseList = [];
this.multipleTable().clearMutiSelect();
},
}, },
clearChooseList () {
this.chooseList = []
this.multipleTable().clearMutiSelect()
}
}
}
\ No newline at end of file \ No newline at end of file
};
\ No newline at end of file \ No newline at end of file
...@@ -22,10 +22,11 @@ ...@@ -22,10 +22,11 @@
<el-select v-model="formData.taskType" <el-select v-model="formData.taskType"
placeholder="请选择任务类型" placeholder="请选择任务类型"
style="width: 100%;"> style="width: 100%;">
<el-option label="人员更换评估" value="人员更换评估"></el-option> <el-option v-for="(label, value) in taskTypeOptions"
<el-option label="商务政策更新评估" value="商务政策更新评估"></el-option> :key="value"
<el-option label="多品类拓张" value="多品类拓张"></el-option> :label="label"
<el-option label="流量问题改善" value="流量问题改善"></el-option> :value="Number(value)">
</el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -52,13 +53,15 @@ ...@@ -52,13 +53,15 @@
</el-form-item> </el-form-item>
<el-form-item label="执行人员:" prop="executorUuid"> <el-form-item label="执行人员:" prop="executorUuid">
<el-radio-group v-model="formData.executorUuid"> <el-select v-model="formData.executorUuid"
<el-radio v-for="item in executorList" placeholder="请选择执行人员"
:key="item.staffUuid" style="width: 100%;">
:label="item.staffUuid"> <el-option v-for="item in executorList"
{{ item.staffName }} :key="item.directorUserId"
</el-radio> :label="item.directorName"
</el-radio-group> :value="item.directorUserId">
</el-option>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="任务说明:" prop="description"> <el-form-item label="任务说明:" prop="description">
...@@ -77,7 +80,8 @@ ...@@ -77,7 +80,8 @@
@click="close"> @click="close">
取消 取消
</el-button> </el-button>
<el-button size="small" <el-button :loading="loading"
size="small"
type="primary" type="primary"
@click="confirm"> @click="confirm">
确定 确定
...@@ -95,7 +99,7 @@ ...@@ -95,7 +99,7 @@
</template> </template>
<script> <script>
import { getStrategyStaffList } from "@/api/earlyWarningManager"; import { batchCreateStrategy, getStrategyShopMerchantOperators, getStrategyStaffList } from "@/api/earlyWarningManager";
import MultipleStaff from "../AddStrategy/MultipleStaff.vue"; import MultipleStaff from "../AddStrategy/MultipleStaff.vue";
export default { export default {
...@@ -124,6 +128,13 @@ export default { ...@@ -124,6 +128,13 @@ export default {
}, },
data() { data() {
return { return {
loading: false,
taskTypeOptions: {
9: "人员更换评估",
10: "商务政策更新评估",
11: "多品类拓张",
12: "流量问题改善",
},
formData: { formData: {
taskType: "", taskType: "",
taskTitle: "", taskTitle: "",
...@@ -187,37 +198,24 @@ export default { ...@@ -187,37 +198,24 @@ export default {
this.$refs.form.clearValidate(); this.$refs.form.clearValidate();
} }
}); });
this.loadAllStaffs();
this.loadExecutors(); this.loadExecutors();
}, },
close() { close() {
this.dialogShow = false; this.dialogShow = false;
}, },
loadAllStaffs() {
const params = {
positionTypeList: this.positionTypeList,
sceneType: 0,
staffName: "",
merchantIdList: this.paramsInfo ? this.paramsInfo.merchantIds : [],
};
getStrategyStaffList({ ...params, pageSize: 9999, pageNum: 1 }).then((res) => {
if (res && res.list) {
this.formData.staffList = res.list;
}
});
},
loadExecutors() { loadExecutors() {
// 9: 区域运营
const params = { const params = {
positionTypeList: [9], merchantId: this.paramsInfo ? this.paramsInfo.merchantIds[0] : "",
sceneType: 0, businessType: this.biz,
staffName: "",
merchantIdList: this.paramsInfo ? this.paramsInfo.merchantIds : [],
}; };
getStrategyStaffList({ ...params, pageSize: 9999, pageNum: 1 }).then((res) => { getStrategyShopMerchantOperators(params).then((res) => {
if (res && res.list) { if (res && res.length) {
this.executorList = res.list; this.executorList = res;
} else {
this.executorList = [];
} }
}).catch(() => {
this.executorList = [];
}); });
}, },
openStaffDialog() { openStaffDialog() {
...@@ -231,27 +229,74 @@ export default { ...@@ -231,27 +229,74 @@ export default {
this.$refs.form.validateField("staffList"); this.$refs.form.validateField("staffList");
}, },
confirm() { confirm() {
this.$refs.form.validate((valid) => { try {
this.loading = true;
let { paramsInfo, merchantName, formData, biz } = this;
let { taskType, taskTitle, staffList, executorUuid, description } = formData;
this.$refs.form.validate(async (valid) => {
if (valid) { if (valid) {
const executor = this.executorList.find(item => item.staffUuid === this.formData.executorUuid); const executor = this.executorList.find(item => item.directorUserId === executorUuid);
// TODO: 调用后端接口提交 let params = {
const submitData = { strategyInfo: {
merchantId: this.paramsInfo.merchantIds[0], strategyType: taskType,
merchantName: this.merchantName, biz,
biz: this.biz, title: taskTitle,
taskType: this.formData.taskType, description,
taskTitle: this.formData.taskTitle, },
staffList: this.formData.staffList, merchantList: [
executor, {
description: this.formData.description, merchantId: paramsInfo.merchantIds[0],
merchantName,
},
],
}; };
console.log("提交协同任务:", submitData); let allStaffs = [];
if (staffList && staffList.length) {
if (staffList.length > 100) {
this.loading = false;
this.$message.error("最多只能选择100个问题人员");
return;
}
allStaffs = staffList.map(e => ({
userUuid: e.staffUuid,
userName: e.staffName,
userPhone: e.phoneNumber,
userPosition: 0, // 问题人员
}));
}
if (executor) {
allStaffs.push({
userUuid: executor.directorUserId,
userName: executor.directorName,
userPhone: executor.directorPhone,
userPosition: biz === 2 ? 8 : 9, // 执行人员:轻改=8,权益、延保=9
});
}
this.$message.success("操作成功"); if (allStaffs.length) {
params.staffList = allStaffs;
}
console.log(params);
const data = await batchCreateStrategy(params);
this.loading = false;
if (data) {
this.$emit("refresh"); this.$emit("refresh");
this.dialogShow = false; this.$message.success("操作成功");
this.close();
} else {
this.$message.error("操作失败");
}
} else {
this.loading = false;
} }
}); });
} catch (error) {
console.log(error, "===");
this.loading = false;
if (error)
this.$message.error(error);
console.log(error);
}
}, },
}, },
}; };
......
...@@ -49,7 +49,8 @@ ...@@ -49,7 +49,8 @@
@click="close"> @click="close">
取消 取消
</el-button> </el-button>
<el-button size="small" <el-button :loading="loading"
size="small"
type="primary" type="primary"
@click="confirm"> @click="confirm">
确定 确定
...@@ -67,7 +68,7 @@ ...@@ -67,7 +68,7 @@
</template> </template>
<script> <script>
import { getStrategyStaffList } from "@/api/earlyWarningManager"; import { batchCreateStrategy } from "@/api/earlyWarningManager";
import MultipleStaff from "../AddStrategy/MultipleStaff.vue"; import MultipleStaff from "../AddStrategy/MultipleStaff.vue";
export default { export default {
...@@ -96,6 +97,7 @@ export default { ...@@ -96,6 +97,7 @@ export default {
}, },
data() { data() {
return { return {
loading: false,
formData: { formData: {
staffList: [], staffList: [],
description: "", description: "",
...@@ -146,24 +148,10 @@ export default { ...@@ -146,24 +148,10 @@ export default {
this.$refs.form.clearValidate(); this.$refs.form.clearValidate();
} }
}); });
this.loadAllStaffs();
}, },
close() { close() {
this.dialogShow = false; this.dialogShow = false;
}, },
loadAllStaffs() {
const params = {
positionTypeList: this.positionTypeList,
sceneType: 0,
staffName: "",
merchantIdList: this.paramsInfo ? this.paramsInfo.merchantIds : [],
};
getStrategyStaffList({ ...params, pageSize: 9999, pageNum: 1 }).then((res) => {
if (res && res.list) {
this.formData.staffList = res.list;
}
});
},
openStaffDialog() { openStaffDialog() {
this.staffTagVisible = true; this.staffTagVisible = true;
}, },
...@@ -175,23 +163,61 @@ export default { ...@@ -175,23 +163,61 @@ export default {
this.$refs.form.validateField("staffList"); this.$refs.form.validateField("staffList");
}, },
confirm() { confirm() {
this.$refs.form.validate((valid) => { try {
this.loading = true;
const { paramsInfo, merchantName, formData, biz } = this;
const { staffList, description } = formData;
this.$refs.form.validate(async (valid) => {
if (valid) { if (valid) {
// TODO: 调用后端接口提交 const params = {
const submitData = { strategyInfo: {
merchantId: this.paramsInfo.merchantIds[0], strategyType: 8,
merchantName: this.merchantName, biz,
biz: this.biz, description,
staffList: this.formData.staffList, },
description: this.formData.description, merchantList: [
{
merchantId: paramsInfo.merchantIds[0],
merchantName,
},
],
}; };
console.log("提交带教申请:", submitData); if (staffList && staffList.length) {
if (staffList.length > 100) {
this.$message.success("操作成功"); this.loading = false;
this.$message.error("最多只能选择100个人员");
return;
}
params.staffList = staffList.map((e) => {
return {
userUuid: e.staffUuid,
userName: e.staffName,
userPhone: e.phoneNumber,
userPosition: e.positionType,
};
});
}
console.log(params);
const data = await batchCreateStrategy(params);
this.loading = false;
if (data) {
this.$emit("refresh"); this.$emit("refresh");
this.dialogShow = false; this.$message.success("操作成功");
this.close();
} else {
this.$message.error("操作失败");
}
} else {
this.loading = false;
} }
}); });
} catch (error) {
console.log(error, "===");
this.loading = false;
if (error)
this.$message.error(error);
console.log(error);
}
}, },
}, },
}; };
......
<template> <template>
<div class="strategy-item"> <div class="strategy-item">
<div :class="['strategy-item-line',{'first-line':index == 0},{'last-line':isLast}]"> <div class="strategy-item-line" :class="[{ 'first-line': index == 0 }, { 'last-line': isLast }]">
<div class="icon"></div> <div class="icon"></div>
</div> </div>
<div class="strategy-item-title flex"> <div class="strategy-item-title flex">
<div class="text text-hide"> <div class="text text-hide">
{{ STRATEGYTYPEOPTIONS[item.strategyType]}} {{ STRATEGYTYPEOPTIONS[item.strategyType] }}
</div> </div>
<div class="strategy-item-date"> <div class="strategy-item-status" :style="{ color: formatStatusStyle(item.pushFlag).color, background: formatStatusStyle(item.pushFlag).bg }">
{{ item.createdDateText }} {{ formatPushFlag(item.pushFlag) }}
</div> </div>
</div> </div>
<div class="strategy-item-created">
{{ item.createdDateText }}<span>{{ item.createdBy }}</span>
</div>
<template v-for="(i, ind) in strategyTypeObject"> <template v-for="(i, ind) in strategyTypeObject">
<div <div v-if="!i.hide || !i.hide(item)"
class="content"
:key="ind" :key="ind"
v-if="!i.hide || !i.hide(item)" class="content">
> <div class="label">
<div class="label">{{ i.label }}:</div> {{ i.label }}:
</div>
<div class="value-box"> <div class="value-box">
<template v-if="i.tooltip"> <template v-if="i.tooltip">
<el-tooltip <el-tooltip effect="dark"
effect="dark" placement="top">
placement="top" <template #content>
> <div class="tooltip-content-max">
<div
slot="content"
class="tooltip-content-max"
>
<div v-html="item[i.key]"></div> <div v-html="item[i.key]"></div>
</div> </div>
<span </template>
class="two-line-ellipsis" <span class="two-line-ellipsis"
v-html="item[i.key]" v-html="item[i.key]">
></span> </span>
</el-tooltip> </el-tooltip>
</template> </template>
<template v-else> <template v-else>
<div :class="['value text-hide',i.className]"> <div class="value text-hide" :class="[i.className]">
<template v-if="i.format">{{ i.format(item) }}</template> <template v-if="i.format">
<template v-else>{{ item[i.key] }}</template> {{ i.format(item) }}
</template>
<template v-else>
{{ item[i.key] }}
</template>
</div> </div>
</template> </template>
</div> </div>
</div> </div>
</template> </template>
<div class="btn-list flex"> <div class="btn-list flex">
<template v-if="item.showDel"> <!-- 状态=未下发 -->
<el-button <template v-if="item.pushFlag == 0">
<el-button class="btn-default _btn"
:size="size" :size="size"
class="btn-default _btn" @click="deleteStrategy(item)">
@click="deleteStrategy(item)" 删除
>删除</el-button> </el-button>
</template> </template>
<el-button <el-button class="btn-primary _btn"
plain
:size="size" :size="size"
type="primary" type="primary"
plain @click="$emit('toDetail', item)">
class="btn-primary _btn" 查看详情
@click="$emit('toDetail',item)" </el-button>
>查看详情</el-button>
</div> </div>
</div> </div>
</div>
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import { import {
STRATEGYTYPEOPTIONS, deleteStrategy,
} from "@/api/earlyWarningManager";
import {
STRATEGY_01, STRATEGY_01,
STRATEGY_2456,
STRATEGY_3, STRATEGY_3,
STRATEGY_7 STRATEGY_7,
} from './contant' STRATEGY_8,
import { STRATEGY_9_10_11_12,
deleteStrategy STRATEGY_2456,
} from '@/api/earlyWarningManager' STRATEGYTYPEOPTIONS,
} from "./contant";
export default { export default {
name: 'StrategyItem', name: "StrategyItem",
props: { props: {
item: { item: {
type: Object, type: Object,
default: () => ({}) default: () => ({}),
}, },
index: { index: {
type: Number, type: Number,
default: 0 default: 0,
}, },
isLast: { isLast: {
type: Boolean, type: Boolean,
default: false default: false,
} },
}, },
data() {
return {
size: "small",
STRATEGYTYPEOPTIONS,
};
},
computed: { computed: {
strategyTypeObject () { strategyTypeObject() {
let { strategyType } = this.item, let { strategyType } = this.item;
list = [0, 1].includes(strategyType) let list = [0, 1].includes(strategyType)
? STRATEGY_01 : [2, 4, 5, 6].includes(strategyType) ? ? STRATEGY_01
STRATEGY_2456 : { : [2, 4, 5, 6].includes(strategyType)
? STRATEGY_2456
: [9, 10, 11, 12].includes(strategyType)
? STRATEGY_9_10_11_12
: {
3: STRATEGY_3, 3: STRATEGY_3,
7: STRATEGY_7 7: STRATEGY_7,
}[strategyType] || [] 8: STRATEGY_8,
}[strategyType] || [];
console.log(list, "list");
return [ return [
...list, ...list,
{ {
label: '策略说明', label: this.formatText(strategyType),
tooltip: true, tooltip: true,
key: 'descriptionText' key: "descriptionText",
}]
}
}, },
];
data () {
return {
size: 'small',
STRATEGYTYPEOPTIONS
}
}, },
mounted () { },
mounted() {
}, },
methods: { methods: {
deleteStrategy (item) { formatText(strategyType) {
let text = "策略说明";
text = [9, 10, 11, 12].includes(strategyType)
? "任务说明"
: [8].includes(strategyType) ? "申请说明" : text;
return text;
},
formatPushFlag(state) {
const numState = Number(state);
const obj = { 0: "待下发", 1: "已下发", 2: "未完成", 3: "审批中", 4: "执行中", 5: "已驳回", 6: "完成" };
return obj[numState] || "";
},
formatStatusStyle(state) {
const numState = Number(state);
const obj = { 0: {
color: "#8C8C8C",
bg: "rgba(140, 140, 140, 0.1)",
}, 1: {
color: "#43CF7C",
bg: "rgba(67, 207, 124, 0.1)",
}, 2: { color: "#2A82E4", bg: "rgba(42, 130, 228, 0.1)" }, 3: { color: "#FDB757", bg: "rgba(224, 183, 87, 0.1)" }, 4: {
color: "#2A82E4",
bg: "rgba(42, 130, 228, 0.1)",
}, 5: { color: "#EB4E4E", bg: "rgba(235, 78, 78, 0.1)" }, 6: { color: "#43CF7C", bg: "rgba(67, 207, 124, 0.1)" } };
console.log(obj[numState], "obj[numState]");
return obj[numState] || {};
},
deleteStrategy(item) {
this.$confirm("删除后不可恢复,是否确定删除?", "提示", { this.$confirm("删除后不可恢复,是否确定删除?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning", type: "warning",
closeOnClickModal: false closeOnClickModal: false,
}).then(async () => { }).then(async () => {
const data = await deleteStrategy({ const data = await deleteStrategy({
id: item.id id: item.id,
}) });
if (data) { if (data) {
this.$emit('refresh') this.$emit("refresh");
this.$message.success('操作成功') this.$message.success("操作成功");
this.close() this.close();
} else this.$message.error('操作失败') } else {
}).catch(() => { this.$message.error("操作失败");
})
} }
} }).catch(() => {
} });
},
},
};
</script> </script>
<style scoped lang='scss'> <style scoped lang='scss'>
...@@ -217,11 +262,19 @@ export default { ...@@ -217,11 +262,19 @@ export default {
max-width: calc(100% - 106px); max-width: calc(100% - 106px);
} }
} }
&-date { &-created {
color: #333333;
font-size: 14px;
span {
margin-left: 4px;
}
}
&-status {
margin-left: auto; margin-left: auto;
font-size: 14px; font-size: 14px;
line-height: 20px;
flex-shrink: 0; flex-shrink: 0;
padding: 2px 6px;
border-radius: 2px;
} }
.tooltip-content-max { .tooltip-content-max {
max-height: 320px; max-height: 320px;
......
import dayjs from "dayjs" /*
* @Author: 'wangzhihui' '1733904062@qq.com'
* @Date: 2026-04-01 09:57:49
* @LastEditors: 'wangzhihui' '1733904062@qq.com'
* @LastEditTime: 2026-06-01 15:21:51
* @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
*/
import dayjs from "dayjs";
const STRATEGYTYPEOPTIONS = { const STRATEGYTYPEOPTIONS = {
0: '学习', 0: "学习",
1: '优秀案例分享', 1: "优秀案例分享",
2: '带教', 2: "带教",
3: '任务下发', 3: "任务下发",
4: '销售精英到店提拉', 4: "销售精英到店提拉",
5: '强力促销', 5: "强力促销",
6: '最终盘点与低客单产品购入', 6: "最终盘点与低客单产品购入",
7: '留言' 7: "留言",
} 8: "带教申请",
9: "人员更换评估",
10: "商务政策更新评估",
11: "多品类拓张",
12: "流量问题改善",
};
const DATE_RANGE = { const DATE_RANGE = {
label: '执行周期', label: "执行周期",
format: (val) => { format: (val) => {
let { startDate, endDate } = val let { startDate, endDate } = val;
return `${dayjs(startDate).format('YYYY-MM-DD')}至 ${dayjs(endDate).format('YYYY-MM-DD')}` return `${dayjs(startDate).format("YYYY-MM-DD")}至 ${dayjs(endDate).format("YYYY-MM-DD")}`;
} },
} };
const STAFF_FORMAT = (label) => { function STAFF_FORMAT(label) {
return { return {
label, label,
format: (val) => { format: (val) => {
let { staffList } = val let { staffList } = val;
return staffList.map(item => item.userName).join('/') || '-' return staffList.map(item => item.userName).join("/") || "-";
} },
} };
} }
const STRATEGY_01 = [ const STRATEGY_01 = [
STAFF_FORMAT('学习人员'), STAFF_FORMAT("学习人员"),
{ {
label: '学习内容', label: "学习内容",
className: 'two-line-ellipsis', className: "two-line-ellipsis",
format: (val) => { format: (val) => {
let { courseList, recordingList, strategyType } = val let { courseList, recordingList, strategyType } = val;
return strategyType == 1 ? return strategyType == 1
recordingList.map(item => `《${item.receptionStaffName}${item.receptionDate}》`).join('\t') : ? recordingList.map(item => `《${item.receptionStaffName}${item.receptionDate}》`).join("\t")
courseList.map(item => `《${item.courseName}》`).join('\t') : courseList.map(item => `《${item.courseName}》`).join("\t");
} },
}, },
DATE_RANGE DATE_RANGE,
] ];
const STRATEGY_2456 = [ const STRATEGY_2456 = [
{ {
...STAFF_FORMAT('执行人'), ...STAFF_FORMAT("执行人"),
hide: (val) => { hide: (val) => {
let { strategyType } = val let { strategyType } = val;
return [5, 6].includes(strategyType) return [5, 6].includes(strategyType);
}, },
}, },
DATE_RANGE DATE_RANGE,
] ];
const STRATEGY_3 = [ const STRATEGY_3 = [
{ {
label: '标题', label: "标题",
key: 'title', key: "title",
}, },
STAFF_FORMAT('处理人'), STAFF_FORMAT("处理人"),
{ {
label: '执行时间', label: "执行时间",
format: (val) => { format: (val) => {
let { startDate, createdDate } = val let { startDate, createdDate } = val;
return `${dayjs(startDate ? startDate : createdDate).format('YYYY-MM-DD HH:mm:ss')}` return `${dayjs(startDate || createdDate).format("YYYY-MM-DD HH:mm:ss")}`;
} },
}, },
] ];
const STRATEGY_7 = [ const STRATEGY_7 = [
{ {
label: '留言人', label: "留言人",
key: 'createdBy', key: "createdBy",
}, },
STAFF_FORMAT('处理人') STAFF_FORMAT("处理人"),
] ];
const STRATEGY_8 = [
STAFF_FORMAT("需带教人员"),
];
const STRATEGY_9_10_11_12 = [
STAFF_FORMAT("问题人员"),
STAFF_FORMAT("执行人员"),
];
export { export {
STRATEGYTYPEOPTIONS,
STRATEGY_01, STRATEGY_01,
STRATEGY_2456,
STRATEGY_3, STRATEGY_3,
STRATEGY_7, STRATEGY_7,
STRATEGY_8,
STRATEGY_9_10_11_12,
STRATEGY_2456,
STRATEGYTYPEOPTIONS,
}
\ No newline at end of file \ No newline at end of file
};
\ No newline at end of file \ No newline at end of file
...@@ -50,6 +50,8 @@ ...@@ -50,6 +50,8 @@
:item="currentItem" :item="currentItem"
@openReceptionDialog="$emit('openReceptionDialog', $event)"> @openReceptionDialog="$emit('openReceptionDialog', $event)">
</StrategyDetail> </StrategyDetail>
<AddStrategy :dialogVisible.sync="addStrategyVisible" @refresh="init"></AddStrategy>
</AddStrategy>
<TeachingDetail :item="currentItem" <TeachingDetail :item="currentItem"
:visibleSync.sync="teachingDetailVisible"> :visibleSync.sync="teachingDetailVisible">
</TeachingDetail> </TeachingDetail>
...@@ -150,7 +152,7 @@ export default { ...@@ -150,7 +152,7 @@ export default {
list.map((e) => { list.map((e) => {
e.showDel = dayjs().diff(dayjs(e.startDate), "s") < 0; e.showDel = dayjs().diff(dayjs(e.startDate), "s") < 0;
e.createdDateText = dayjs(e.createdDate).format("YYYY-MM-DD"); e.createdDateText = dayjs(e.createdDate).format("YYYY-MM-DD HH:mm:ss");
e.descriptionText = e.description ? e.description.replace(/<\/?br\s*\/?>|\\n|\n/g, "<br>") : "-"; e.descriptionText = e.description ? e.description.replace(/<\/?br\s*\/?>|\\n|\n/g, "<br>") : "-";
}); });
if (this.pageNum == 1) { if (this.pageNum == 1) {
......
...@@ -64,6 +64,8 @@ ...@@ -64,6 +64,8 @@
</template> </template>
<script> <script>
import { queryStrategyTaskDetailById } from "@/api/earlyWarningManager";
export default { export default {
name: "TeachingDetail", name: "TeachingDetail",
props: { props: {
...@@ -103,42 +105,66 @@ export default { ...@@ -103,42 +105,66 @@ export default {
close() { close() {
this.dialogShow = false; this.dialogShow = false;
}, },
initData() { async initData() {
// 模拟数据,等后端接口提供后替换为实际数据 if (!this.item.id)
this.detailData = [ return;
try {
const res = await queryStrategyTaskDetailById({ id: this.item.id });
if (res) {
this.formatDetailData(res);
}
} catch (error) {
console.error(error);
}
},
formatDetailData(data) {
const staffList = data.staffList || [];
const targetStaffs = staffList.filter(e => e.userPosition === 0).map(e => e.userName).join("/");
const detailData = [
{ {
title: "申请信息", title: "申请信息",
config: [ config: [
{ subtitle: "需带教人员:", value: "张三/李四", fullRow: true }, { subtitle: "需带教人员:", value: targetStaffs || "-", fullRow: true },
{ subtitle: "申请说明:", value: "安排课程学习,进一步跟进驻店人员学习情况及业务情况。安排课程学习,进一步跟进驻店人员学习情况及业务情况。安排课程学习,进一步跟进驻店人员学习情况及业务情况。", fullRow: true }, { subtitle: "申请说明:", value: data.description || "-", fullRow: true },
{ subtitle: "操作人:", value: "杨佳", fullRow: false }, { subtitle: "操作人:", value: data.createdBy || "-", fullRow: false },
{ subtitle: "操作时间:", value: "2025-10-01 12:34:23", fullRow: false }, { subtitle: "操作时间:", value: data.createdDate || "-", fullRow: false },
], ],
}, },
{ ];
const mentoringAppDetail = data.mentoringApplicationDetail || {};
const approvalInfo = mentoringAppDetail.approvalInfo || {};
detailData.push({
title: "审批信息", title: "审批信息",
config: [ config: [
{ subtitle: "状态:", value: "张三/李四", fullRow: true }, { subtitle: "状态:", value: approvalInfo.approvalStatus || "-", fullRow: true },
{ subtitle: "驳回:", value: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", fullRow: true }, ...(approvalInfo.approvalStatus === "驳回" && approvalInfo.rejectReason ? [{ subtitle: "驳回:", value: approvalInfo.rejectReason || "-", fullRow: true }] : []),
{ subtitle: "审批人:", value: "通过", fullRow: false }, { subtitle: "审批人:", value: approvalInfo.approverName || "-", fullRow: false },
{ subtitle: "审批时间:", value: "2025-10-01 12:34:23", fullRow: false }, { subtitle: "审批时间:", value: approvalInfo.approvalTime || "-", fullRow: false },
], ],
}, });
{
const taskDetail = mentoringAppDetail.taskDetail;
if (taskDetail) {
detailData.push({
title: "带教信息", title: "带教信息",
config: [ config: [
{ subtitle: "状态:", value: "执行中", fullRow: false }, { subtitle: "状态:", value: taskDetail.taskStatus || "-", fullRow: false },
{ subtitle: "指定区域督导:", value: "杨佳", fullRow: false }, { subtitle: "指定区域督导:", value: taskDetail.supervisorName || "-", fullRow: false },
{ subtitle: "带教场景:", value: "XXXXXXXXXXXXXXXXXX", fullRow: false }, { subtitle: "带教场景:", value: taskDetail.mentoringScene || "-", fullRow: false },
{ subtitle: "带教时间:", value: "2025-10-01 12:34:23", fullRow: false }, { subtitle: "带教时间:", value: taskDetail.mentoringTime || "-", fullRow: false },
{ subtitle: "带教方式:", value: "XXXXXXXXXXXXXXXXXX", fullRow: false }, { subtitle: "带教方式:", value: taskDetail.mentoringMethod || "-", fullRow: false },
{ subtitle: "带教主题:", value: "XXXXXXXXXXXXXXXXXX", fullRow: false }, { subtitle: "带教主题:", value: taskDetail.mentoringTopic || "-", fullRow: false },
{ subtitle: "推送课程:", value: "XXXXXXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXX", fullRow: true }, { subtitle: "推送课程:", value: taskDetail.pushCourses || "-", fullRow: true },
{ subtitle: "带教内容摘要:", value: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", fullRow: true }, { subtitle: "带教内容摘要:", value: taskDetail.contentSummary || "-", fullRow: true },
{ subtitle: "带教招聘佐证:", value: ["https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg", "https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg"], isImage: true, fullRow: true }, { subtitle: "带教招聘佐证:", value: taskDetail.evidenceImages || [], isImage: true, fullRow: true },
], ],
}, });
]; }
this.detailData = detailData;
}, },
}, },
}; };
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!