Commit a18deb4d by 李伟康

feat(earlyWarningManager): 完成策略中心多模块功能迭代优化

1. 新增统一策略详情查询接口queryStrategyInfoById和策略明细分页接口
2. 优化表单字段命名统一化:maxOrderNum改为maxOrders、avgOrderAmount改为avgTransactionValue等
3. 重构带教任务表单配置,统一字段key和校验规则
4. 优化员工选择组件逻辑,移除冗余判断
5. 新增策略分析页面导出功能和策略明细分页表格
6. 修复策略类型判断的类型转换问题
7. 优化下拉选择框popper挂载位置,修复弹窗层级问题
1 parent 274921c2
...@@ -661,3 +661,26 @@ export function getStrategyGoodsSummaryWithWarnZJ(data = {}) { ...@@ -661,3 +661,26 @@ export function getStrategyGoodsSummaryWithWarnZJ(data = {}) {
data.method = "dj.api.strategy.merchant.analysis.goods.summary.withWarnZJ"; data.method = "dj.api.strategy.merchant.analysis.goods.summary.withWarnZJ";
return request(data, RequestMethods.POST); return request(data, RequestMethods.POST);
} }
/**
* 策略中心-获取督导带教下发时可选的带教督导和被带教人员列表
*/
export function getStrategySupervisorOperators(data = {}) {
data.method = "dj.api.strategy.supervisor.operator.list";
return request(data, RequestMethods.POST);
}
/**
* 查询策略详情(统一入口,适配14种类型)
*/
export function queryStrategyInfoById(data = {}) {
data.method = "dj.api.strategy.info.queryStrategyInfoById";
return request(data, RequestMethods.POST);
}
/**
*策略分析-策略明细分页
*/
export function queryStrategyDetailPage(data = {}) {
data.method = "dj.api.strategy.find.strategy.detail.page";
return request(data, RequestMethods.POST);
}
\ No newline at end of file \ No newline at end of file
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
<el-select size="mini" <el-select size="mini"
style="width: 120px;" style="width: 120px;"
filterable filterable
:popper-append-to-body="false"
:value="operatorFilter" :value="operatorFilter"
@change="handleOperatorChange"> @change="handleOperatorChange">
<el-option v-for="operator in operatorList" <el-option v-for="operator in operatorList"
......
...@@ -13,8 +13,9 @@ ...@@ -13,8 +13,9 @@
:time-range-options="timeRangeOptions" :time-range-options="timeRangeOptions"
@date-range-change="handleDateRangeChange" @date-range-change="handleDateRangeChange"
@time-range-change="handleTimeRangeChange" /> @time-range-change="handleTimeRangeChange" />
</div>
<div class="border-bottom-line"></div> <div class="border-bottom-line"></div>
</div>
<div class="content-area"> <div class="content-area">
<!-- 2. KPI 核心指标 --> <!-- 2. KPI 核心指标 -->
<div class="top-content"> <div class="top-content">
...@@ -189,18 +190,40 @@ ...@@ -189,18 +190,40 @@
<div class="bottom-content"> <div class="bottom-content">
<div class="d2-container-content"> <div class="d2-container-content">
<d2-table-header title="策略明细"> <d2-table-header title="策略明细">
<el-button size="small" type="primary"> <el-button size="small"
type="primary"
@click="handleExport">
导出 导出
</el-button> </el-button>
</d2-table-header> </d2-table-header>
<d2-table ref="table" <d2-table ref="table2"
no-data-text="暂无数据" no-data-text="暂无数据"
:before-search-fn="beforeSearchFn" :before-search-fn="beforeSearchFn"
:get-list-api="getListApi" :get-list-api="getStrategyDetailPageApi"
:no-data-img="noDataImg" :no-data-img="noDataImg"
:search-form="searchFormSearch" :search-form="searchFormSearch"
:table-params="detailTableParams"> :table-params="detailTableParams">
<template #pushFlagName="scope">
<div class="strategy-item-status" :class="[`strategy-item-status-${scope.scope.pushFlag}`]">
{{ scope.scope.pushFlagName }}
</div>
</template>
<template #description="scope">
<div>
<el-tooltip v-if="scope.scope.description"
effect="dark"
placement="top">
<template #content>
<div class="tooltip-content-max">
<div>{{ scope.scope.description }}</div>
</div>
</template>
<span class="two-line-ellipsis">{{ scope.scope.description }}</span>
</el-tooltip>
<span v-else>-</span>
</div>
</template>
<template #auth-button="scope"> <template #auth-button="scope">
<el-button type="text" <el-button type="text"
@click="handleViewDetail(scope.scope)"> @click="handleViewDetail(scope.scope)">
...@@ -220,7 +243,9 @@ ...@@ -220,7 +243,9 @@
<script> <script>
import dayjs from "dayjs"; import dayjs from "dayjs";
import { getStrategyAnalysisEffect, getStrategyEffectList, getStrategyOnlineDist, getStrategyTotal, getStrategyTypeDist, getWarningTypeList } from "@/api/earlyWarningManager";
import { mapActions, mapState } from "vuex";
import { exportStrategyDetail, getStrategyAnalysisEffect, getStrategyEffectList, getStrategyOnlineDist, getStrategyTotal, getStrategyTypeDist, getWarningTypeList, queryStrategyDetailPage } from "@/api/earlyWarningManager";
import noDataImg from "@/assets/strategy/emepty-strategy.png"; import noDataImg from "@/assets/strategy/emepty-strategy.png";
import { deepClone } from "@/common/util"; import { deepClone } from "@/common/util";
import calendarCustom from "../strategyCentre/compoments/clendarCustom.vue"; import calendarCustom from "../strategyCentre/compoments/clendarCustom.vue";
...@@ -310,6 +335,7 @@ export default { ...@@ -310,6 +335,7 @@ export default {
// 表格相关数据 // 表格相关数据
searchFormSearch: {}, searchFormSearch: {},
getListApi: null, // 在 mounted 中初始化 getListApi: null, // 在 mounted 中初始化
getStrategyDetailPageApi: null,
effectDetailVisible: false, effectDetailVisible: false,
effectDetailRow: [], effectDetailRow: [],
// 策略类型分布运营人员筛选防抖定时器 // 策略类型分布运营人员筛选防抖定时器
...@@ -425,62 +451,76 @@ export default { ...@@ -425,62 +451,76 @@ export default {
tableColumns: [ tableColumns: [
{ {
label: "门店名称", label: "门店名称",
prop: "storeName", prop: "merchantName",
minWidth: 160, minWidth: 160,
}, },
{ {
label: "策略类型", label: "策略类型",
prop: "storeName", prop: "strategyTypeName",
minWidth: 160, minWidth: 160,
}, },
{ {
label: "创建人", label: "创建人",
prop: "storeName", prop: "createdBy",
minWidth: 160, minWidth: 160,
}, },
{ {
label: "创建时间", label: "创建时间",
prop: "storeName", prop: "createdDate",
minWidth: 160, minWidth: 160,
}, },
{ {
label: "策略目标", label: "策略目标",
prop: "storeName", prop: "strategyTarget",
minWidth: 160, minWidth: 160,
formatter: (cellValue) => {
console.log(cellValue);
let businessType = this.currentTab.value;
if (cellValue.strategyTarget == "-" || cellValue.strategyTarget == null || cellValue.strategyTarget == undefined || cellValue.strategyTarget == "") {
return "-";
}
let text = "";
if (businessType == 2) {
text = `平均客单价${cellValue.strategyTarget}`;
} else {
text = `转化率${cellValue.strategyTarget}%`;
}
return text;
},
}, },
{ {
label: "策略说明", label: "策略说明",
prop: "storeName",
minWidth: 160, minWidth: 160,
addHtml: "description",
}, },
{ {
label: "执行周期", label: "执行周期",
prop: "storeName", prop: "executeCycle",
minWidth: 160, minWidth: 180,
}, },
{ {
label: "策略状态", label: "策略状态",
prop: "storeName", minWidth: 120,
minWidth: 160, addHtml: "pushFlagName",
}, },
{ {
label: "执行人", label: "执行人",
prop: "storeName", prop: "executePersons",
minWidth: 160, minWidth: 160,
}, },
{ {
label: "完成时间", label: "完成时间",
prop: "storeName", prop: "finishTime",
minWidth: 160, minWidth: 160,
}, },
{ {
label: "执行结果", label: "执行结果",
prop: "storeName", prop: "executeResult",
minWidth: 160, minWidth: 160,
}, },
{ {
label: "任务描述", label: "任务描述",
prop: "storeName", prop: "taskDescription",
minWidth: 160, minWidth: 160,
}, },
], ],
...@@ -488,6 +528,9 @@ export default { ...@@ -488,6 +528,9 @@ export default {
}; };
}, },
computed: { computed: {
...mapState({
dowloadList: state => state.d2admin.user.dowloadList,
}),
// 盯防类型选项(自动根据原始数据生成) // 盯防类型选项(自动根据原始数据生成)
watchTypeOptions() { watchTypeOptions() {
if (!this.monitorTypeData || this.monitorTypeData.length === 0) { if (!this.monitorTypeData || this.monitorTypeData.length === 0) {
...@@ -545,6 +588,7 @@ export default { ...@@ -545,6 +588,7 @@ export default {
mounted() { mounted() {
// 初始化包装后的 API 方法 // 初始化包装后的 API 方法
this.getListApi = this.wrapStrategyEffectList; this.getListApi = this.wrapStrategyEffectList;
this.getStrategyDetailPageApi = this.queryStrategyDetailPage;
// 启用页面滚动 // 启用页面滚动
this.enablePageScroll(); this.enablePageScroll();
// 调用策略总数接口 // 调用策略总数接口
...@@ -563,6 +607,11 @@ export default { ...@@ -563,6 +607,11 @@ export default {
} }
}, },
methods: { methods: {
...mapActions({
get: "d2admin/base/get",
close: "d2admin/page/close",
}),
...mapActions("d2admin/user", ["actionSetDownloadList"]),
/** /**
* 包装 API 方法,将数组响应转换为 d2-table 期望的对象格式 * 包装 API 方法,将数组响应转换为 d2-table 期望的对象格式
*/ */
...@@ -603,11 +652,40 @@ export default { ...@@ -603,11 +652,40 @@ export default {
}; };
} }
}, },
async queryStrategyDetailPage(params) {
// 周、自定义周期不请求效果分析列表
try {
// const data = await getStrategyEffectList(params);
params.startDate = dayjs(this.startDate).format("YYYY-MM-DD") + " 00:00:00";
params.endDate = dayjs(this.endDate).format("YYYY-MM-DD") + " 23:59:59";
delete params.periodType;
delete params.warningType;
const data = await queryStrategyDetailPage(params);
console.log("queryStrategyDetailPage", data);
// axios 响应拦截器已返回 data 字段的内容(数组)
// 需要包装成 d2-table 期望的格式:{ data: [...], total: number }
return {
data: data.list || [],
total: data.total,
pageNum: data.pageNum,
pageSize: data.pageSize,
};
} catch (error) {
console.error("获取策略效果分析列表失败:", error);
return {
data: [],
total: 0,
pageNum: 1,
pageSize: 1000,
};
}
},
/** /**
* 刷新效果分析表格(beforeSearchFn 会同步 businessType 等参数,再调用 wrapStrategyEffectList) * 刷新效果分析表格(beforeSearchFn 会同步 businessType 等参数,再调用 wrapStrategyEffectList)
*/ */
refreshEffectTable() { refreshEffectTable() {
this.$refs.table && this.$refs.table.refreshTable(); this.$refs.table && this.$refs.table.refreshTable();
this.$refs.table2 && this.$refs.table2.refreshTable();
}, },
/** /**
* 搜索前处理 * 搜索前处理
...@@ -880,6 +958,24 @@ export default { ...@@ -880,6 +958,24 @@ export default {
query, query,
}); });
}, },
handleExport() {
const params = {
method: "dj.api.smartcarlife.strategy.detail.export",
startDate: dayjs(this.startDate).format("YYYY-MM-DD") + " 00:00:00",
endDate: dayjs(this.endDate).format("YYYY-MM-DD") + " 23:59:59",
businessType: this.currentTab.value,
};
const list = [
...this.dowloadList,
{
name: "策略明细" + Date.now(),
exportParam: JSON.stringify(params),
status: "waiting",
timeid: new Date().getTime(),
},
];
this.actionSetDownloadList({ list, type: "dowloadList" });
},
}, },
}; };
</script> </script>
...@@ -900,10 +996,16 @@ export default { ...@@ -900,10 +996,16 @@ export default {
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
background-color: #fff; background-color: #fff;
position: sticky;
top: 0;
z-index: 2;
} }
.border-bottom-line { .border-bottom-line {
margin-top: -1px; position: absolute;
bottom: 0;
left: 0;
width: 100%;
border-bottom: 1px solid #e5e5e5; border-bottom: 1px solid #e5e5e5;
} }
...@@ -1036,4 +1138,35 @@ export default { ...@@ -1036,4 +1138,35 @@ export default {
height: 86px; height: 86px;
} }
} }
.strategy-item-status {
font-size: 14px;
flex-shrink: 0;
padding: 0 6px;
border-radius: 2px;
line-height: 21px;
width: fit-content;
margin: 0 auto;
}
.strategy-item-status-0 {
background: #fdb7571a;
color: #fdb757;
}
.strategy-item-status-1 {
background: #2a82e41a;
color: #2a82e4;
}
.strategy-item-status-2,
.strategy-item-status-7,
.strategy-item-status-9 {
background: #eb4e4e1a;
color: #eb4e4e;
}
.strategy-item-status-6 {
background: #8c8c8c1a;
color: #8c8c8c;
}
.strategy-item-status-8 {
background: #43cf7c1a;
color: #43cf7c;
}
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -34,19 +34,19 @@ ...@@ -34,19 +34,19 @@
:value="item.value"> :value="item.value">
</el-option> </el-option>
</el-select> </el-select>
<el-input v-model="searchForm.staffName" <el-input v-model="searchForm.customerName"
class="search-input" class="search-input"
placeholder="搜索客户名称" placeholder="搜索客户名称"
size="small" size="small"
clearable> clearable>
</el-input> </el-input>
<el-input v-model="searchForm.staffName" <el-input v-model="searchForm.carModel"
class="search-input" class="search-input"
placeholder="搜索车型" placeholder="搜索车型"
size="small" size="small"
clearable> clearable>
</el-input> </el-input>
<el-input v-model="searchForm.staffName" <el-input v-model="searchForm.productName"
class="search-input" class="search-input"
placeholder="搜索产品名称" placeholder="搜索产品名称"
size="small" size="small"
...@@ -198,7 +198,7 @@ export default { ...@@ -198,7 +198,7 @@ export default {
}, },
{ {
label: "产品名称", label: "产品名称",
prop: "carModel", prop: "productName",
minWidth: 90, minWidth: 90,
}, },
], ],
......
...@@ -77,7 +77,6 @@ ...@@ -77,7 +77,6 @@
<script> <script>
import { import {
getStrategyStaffList,
getStrategyStaffListNew, getStrategyStaffListNew,
} from "@api/earlyWarningManager"; } from "@api/earlyWarningManager";
import multipleMixin from "./multipleMixin"; import multipleMixin from "./multipleMixin";
...@@ -105,19 +104,13 @@ export default { ...@@ -105,19 +104,13 @@ export default {
}; };
}, },
computed: { computed: {
isPhoneMode() {
return this.strategyType == 0 || this.strategyType == 1;
},
targetId() {
return this.isPhoneMode ? "phoneNumber" : "staffUuid";
},
getListApi() { getListApi() {
return this.isPhoneMode ? getStrategyStaffListNew : getStrategyStaffList; return getStrategyStaffListNew;
}, },
tableParams() { tableParams() {
return { return {
listName: "list", listName: "list",
mutiSelectUniqueKey: this.targetId, mutiSelectUniqueKey: "phoneNumber",
mutiSelectName: "contentIndex", mutiSelectName: "contentIndex",
tableColumns: [ tableColumns: [
{ {
......
...@@ -85,7 +85,8 @@ const STRATEGY_FORM_2456 = [ ...@@ -85,7 +85,8 @@ const STRATEGY_FORM_2456 = [
let { strategyType } = val; let { strategyType } = val;
return [5, 6].includes(strategyType); return [5, 6].includes(strategyType);
}, },
positionTypeList: [0, 6, 9], positionTypeList: [0],
// positionTypeList: [0, 6, 9],
tagNameKey: "staffName", tagNameKey: "staffName",
delMerchantList: true, delMerchantList: true,
}, },
...@@ -101,7 +102,7 @@ const STRATEGY_FORM_2456 = [ ...@@ -101,7 +102,7 @@ const STRATEGY_FORM_2456 = [
{ {
label: "最大订单数", label: "最大订单数",
type: "numberInput", type: "numberInput",
key: "maxOrderNum", key: "maxOrders",
filterRule: "decimalRange", filterRule: "decimalRange",
min: 0, min: 0,
max: 999999, max: 999999,
...@@ -211,7 +212,7 @@ const STRATEGY_FORM_RULES_1 = { ...@@ -211,7 +212,7 @@ const STRATEGY_FORM_RULES_1 = {
const STRATEGY_FORM_RULES_2456 = { const STRATEGY_FORM_RULES_2456 = {
dateRange: RANGE_DATE, dateRange: RANGE_DATE,
description: DESCRIPTION_RULES, description: DESCRIPTION_RULES,
maxOrderNum: MAX_ORDER_NUM_RULES, maxOrders: MAX_ORDER_NUM_RULES,
}; };
const STRATEGY_FORM_RULES_3 = { const STRATEGY_FORM_RULES_3 = {
title: TITLE_RULES, title: TITLE_RULES,
......
...@@ -263,6 +263,8 @@ export default { ...@@ -263,6 +263,8 @@ export default {
courseList: [], courseList: [],
recordingList: [], recordingList: [],
pushTime: "", pushTime: "",
maxOrders: "",
targetValue: "",
}, },
staffTagVisible: false, staffTagVisible: false,
staffTag1Visible: false, staffTag1Visible: false,
...@@ -297,7 +299,7 @@ export default { ...@@ -297,7 +299,7 @@ export default {
list.push({ list.push({
label: "学习目标", label: "学习目标",
type: "numberInput", type: "numberInput",
key: "learningTarget", key: "targetValue",
placeholder: "请输入学习目标", placeholder: "请输入学习目标",
filterRule: "decimalRange", filterRule: "decimalRange",
min: 0, min: 0,
...@@ -481,7 +483,7 @@ export default { ...@@ -481,7 +483,7 @@ export default {
try { try {
this.loading = true; this.loading = true;
let { paramsInfo, merchantName, formData, strategyType, merchantList, currentBiz: biz } = this; let { paramsInfo, merchantName, formData, strategyType, merchantList, currentBiz: biz } = this;
let { title, subTitle, content, staffList, staffList_1, courseList, recordingList, handlerType, description, pushType, dateRange, pushTime } = formData; let { title, subTitle, content, staffList, staffList_1, courseList, recordingList, handlerType, description, pushType, dateRange, pushTime, targetValue, maxOrders } = formData;
this.$refs.addRef.validate(async (valid) => { this.$refs.addRef.validate(async (valid) => {
if (valid) { if (valid) {
let params = { let params = {
...@@ -496,7 +498,13 @@ export default { ...@@ -496,7 +498,13 @@ export default {
pushType, pushType,
}, },
courseList, courseList,
strategyExtension: {
targetValue,
},
}; };
if ([0, 1].includes(strategyType) && (targetValue !== "" || targetValue !== null || targetValue !== undefined)) {
params.strategyExtension.targetValue = targetValue;
}
if (merchantList.length) { if (merchantList.length) {
params.merchantList = merchantList; params.merchantList = merchantList;
} else { } else {
...@@ -544,6 +552,9 @@ export default { ...@@ -544,6 +552,9 @@ export default {
}; };
}); });
} }
if ([5, 6].includes(strategyType)) {
params.strategyExtension.maxOrders = maxOrders;
}
if (recordingList && recordingList.length) { if (recordingList && recordingList.length) {
params.recordingList = recordingList.map((e) => { params.recordingList = recordingList.map((e) => {
return { return {
......
...@@ -21,14 +21,14 @@ const TASK_FORM_8 = [ ...@@ -21,14 +21,14 @@ const TASK_FORM_8 = [
key: "executorUuid", key: "executorUuid",
placeholder: "请选择指定带教督导", placeholder: "请选择指定带教督导",
options: [], options: [],
labelKey: "directorName", labelKey: "name",
valueKey: "directorUserId", valueKey: "uuid",
filterable: true, filterable: true,
}, },
{ {
label: "带教目标", label: "带教目标",
type: "numberInput", type: "numberInput",
key: "learningTarget", key: "targetValue",
placeholder: "请输入带教目标", placeholder: "请输入带教目标",
filterRule: "decimalRange", filterRule: "decimalRange",
min: 0, min: 0,
...@@ -41,7 +41,7 @@ const TASK_FORM_8 = [ ...@@ -41,7 +41,7 @@ const TASK_FORM_8 = [
{ {
label: "带教场景", label: "带教场景",
type: "select", type: "select",
key: "scene", key: "mentoringScene",
placeholder: "请选择带教场景", placeholder: "请选择带教场景",
options: [ options: [
{ label: "线上", value: 1 }, { label: "线上", value: 1 },
...@@ -51,40 +51,40 @@ const TASK_FORM_8 = [ ...@@ -51,40 +51,40 @@ const TASK_FORM_8 = [
{ {
label: "带教时间", label: "带教时间",
type: "datetime", type: "datetime",
key: "datetime", key: "mentoringDate",
placeholder: "请选择带教时间", placeholder: "请选择带教时间",
pickerOptions: "afterPickerOptions", pickerOptions: "afterPickerOptions",
}, },
{ {
label: "带教方式", label: "带教方式",
type: "select", type: "select",
key: "type", key: "mentoringMethod",
placeholder: "请选择带教方式", placeholder: "请选择带教方式",
disabledFun: (data) => { disabledFun: (data) => {
let { scene } = data; let { mentoringScene } = data;
return !scene; return !mentoringScene;
}, },
optionsFun: (data) => { optionsFun: (data) => {
let { scene } = data; let { mentoringScene } = data;
return scene == 1 return mentoringScene == 1
? [ ? [
{ label: "视频培训", value: 1 }, { label: "视频培训", value: 1 },
{ label: "语音培训", value: 2 }, { label: "语音培训", value: 2 },
{ label: "课程推送", value: 3 }, { label: "课程推送", value: 3 },
] ]
: [ : [
{ label: "陪同谈客", value: 4 }, { label: "陪同谈客", value: 1 },
{ label: "话术演练", value: 5 }, { label: "话术演练", value: 2 },
{ label: "知识赋能", value: 6 }, { label: "知识赋能", value: 3 },
{ label: "心态疏导", value: 7 }, { label: "心态疏导", value: 4 },
{ label: "新人带教", value: 8 }, { label: "新人带教", value: 5 },
]; ];
}, },
}, },
{ {
label: "带教主题", label: "带教主题",
type: "select", type: "select",
key: "", key: "mentoringTopic",
placeholder: "请选择带教主题", placeholder: "请选择带教主题",
options: [ options: [
{ label: "新品知识培训", value: 1 }, { label: "新品知识培训", value: 1 },
...@@ -94,7 +94,7 @@ const TASK_FORM_8 = [ ...@@ -94,7 +94,7 @@ const TASK_FORM_8 = [
{ label: "客户服务标准", value: 5 }, { label: "客户服务标准", value: 5 },
{ label: "门店管理规范", value: 6 }, { label: "门店管理规范", value: 6 },
{ label: "系统操作培训", value: 7 }, { label: "系统操作培训", value: 7 },
{ label: "其他", value: 8 }, { label: "其他", value: 99 },
], ],
}, },
]; ];
...@@ -115,7 +115,7 @@ const TASK_FORM_DEFAULT = [ ...@@ -115,7 +115,7 @@ const TASK_FORM_DEFAULT = [
{ {
label: "目标触客率", label: "目标触客率",
type: "numberInput", type: "numberInput",
key: "targetRate", key: "targetValue",
placeholder: "请输入目标触客率", placeholder: "请输入目标触客率",
filterRule: "decimalRange", filterRule: "decimalRange",
min: 0, min: 0,
...@@ -141,7 +141,7 @@ const TASK_FORM_DEFAULT = [ ...@@ -141,7 +141,7 @@ const TASK_FORM_DEFAULT = [
const TASK_FORM_RULES_8 = { const TASK_FORM_RULES_8 = {
staffList: [{ required: true, message: "请选择需带教人员" }], staffList: [{ required: true, message: "请选择需带教人员" }],
executorUuid: [{ required: true, message: "请选择指定带教督导", trigger: "change" }], executorUuid: [{ required: true, message: "请选择指定带教督导", trigger: "change" }],
learningTarget: [{ required: true, message: "请输入带教目标", trigger: "blur" }], targetValue: [{ required: true, message: "请输入带教目标", trigger: "blur" }],
}; };
const EXECUTOR_UUID_RULES = [{ required: true, message: "请选择执行人员", trigger: "change" }]; const EXECUTOR_UUID_RULES = [{ required: true, message: "请选择执行人员", trigger: "change" }];
const DESCRIPTION_RULES = [{ required: true, message: "请输入任务说明", trigger: "blur" }]; const DESCRIPTION_RULES = [{ required: true, message: "请输入任务说明", trigger: "blur" }];
...@@ -150,7 +150,7 @@ const TASK_FORM_RULES_9 = { ...@@ -150,7 +150,7 @@ const TASK_FORM_RULES_9 = {
executorUuid: EXECUTOR_UUID_RULES, executorUuid: EXECUTOR_UUID_RULES,
}; };
const TASK_FORM_RULES_12 = { const TASK_FORM_RULES_12 = {
targetRate: [{ required: true, message: "请输入目标率", trigger: "blur" }], targetValue: [{ required: true, message: "请输入目标触客率", trigger: "blur" }],
executorUuid: EXECUTOR_UUID_RULES, executorUuid: EXECUTOR_UUID_RULES,
}; };
const TASK_FORM_RULES_13_14 = { const TASK_FORM_RULES_13_14 = {
......
...@@ -169,7 +169,7 @@ ...@@ -169,7 +169,7 @@
</template> </template>
<script> <script>
import { batchCreateStrategy, getStrategyShopMerchantOperators } from "@/api/earlyWarningManager"; import { batchCreateStrategy, getStrategyShopMerchantOperators, getStrategySupervisorOperators } from "@/api/earlyWarningManager";
import { import {
afterPickerOptions, afterPickerOptions,
} from "@/common/format"; } from "@/common/format";
...@@ -213,44 +213,20 @@ export default { ...@@ -213,44 +213,20 @@ export default {
}, },
formData: { formData: {
taskType: "", taskType: "",
taskTitle: "",
staffList: [], staffList: [],
executorUuid: "", executorUuid: "",
description: "", description: "",
scene: "", mentoringScene: "",
type: "", mentoringMethod: "",
}, mentoringDate: "",
rules: { mentoringTopic: "",
taskType: [ targetValue: "",
{ required: true, message: "请选择任务类型", trigger: "change" },
],
staffList: [
{ 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: [
{ required: true, message: "请选择执行人员", trigger: "change" },
],
description: [
{ required: true, message: "请输入任务说明", trigger: "blur" },
],
targetRate: [
{ required: true, message: "请输入目标率", trigger: "blur" },
],
}, },
staffTagVisible: false, staffTagVisible: false,
positionTypeList: [0], // 0:驻店人员 positionTypeList: [0], // 0:驻店人员
executorList: [], // 区域运营列表 executorList: [], // 区域运营列表
positionTypeListSale: null, positionTypeListSale: null,
supervisorList: [], // 带教督导列表
}; };
}, },
...@@ -271,15 +247,13 @@ export default { ...@@ -271,15 +247,13 @@ export default {
}, },
taskTypeFormList() { taskTypeFormList() {
const { taskType } = this.formData; const { taskType } = this.formData;
const { executorList } = this; const { executorList, supervisorList } = this;
const list = deepClone(taskType == 8 ? TASK_FORM_8 : TASK_FORM_DEFAULT); const list = deepClone(taskType == 8 ? TASK_FORM_8 : TASK_FORM_DEFAULT);
if (taskType != 8) {
list.forEach((item) => { list.forEach((item) => {
if (item.key == "executorUuid") { if (item.key == "executorUuid") {
item.options = executorList; item.options = taskType != 8 ? executorList : supervisorList;
} }
}); });
}
return [ return [
...list, ...list,
{ {
...@@ -299,7 +273,8 @@ export default { ...@@ -299,7 +273,8 @@ export default {
8: TASK_FORM_RULES_8, 8: TASK_FORM_RULES_8,
9: TASK_FORM_RULES_9, 9: TASK_FORM_RULES_9,
12: TASK_FORM_RULES_12, 12: TASK_FORM_RULES_12,
13_14: TASK_FORM_RULES_13_14, 13: TASK_FORM_RULES_13_14,
14: TASK_FORM_RULES_13_14,
}; };
return { return {
taskType: [ taskType: [
...@@ -320,10 +295,10 @@ export default { ...@@ -320,10 +295,10 @@ export default {
this.init(); this.init();
this.formData.taskType = val; this.formData.taskType = val;
}, },
"formData.scene": { "formData.mentoringScene": {
handler(val) { handler(val) {
if (this.formData.type) { if (this.formData.mentoringMethod) {
this.formData.type = ""; this.formData.mentoringMethod = "";
} }
}, },
immediate: true, immediate: true,
...@@ -335,10 +310,14 @@ export default { ...@@ -335,10 +310,14 @@ export default {
this.loading = false; this.loading = false;
this.formData = { this.formData = {
taskType: "", taskType: "",
taskTitle: "",
staffList: [], staffList: [],
executorUuid: "", executorUuid: "",
description: "", description: "",
mentoringScene: "",
mentoringMethod: "",
mentoringDate: "",
mentoringTopic: "",
targetValue: "",
}; };
this.$nextTick(() => { this.$nextTick(() => {
if (this.formRef) { if (this.formRef) {
...@@ -348,6 +327,9 @@ export default { ...@@ -348,6 +327,9 @@ export default {
if (!this.executorList.length) { if (!this.executorList.length) {
this.loadExecutors(); this.loadExecutors();
} }
if (!this.supervisorList.length) {
this.loadSupervisors();
}
}, },
close() { close() {
this.dialogShow = false; this.dialogShow = false;
...@@ -371,6 +353,17 @@ export default { ...@@ -371,6 +353,17 @@ export default {
this.executorList = []; this.executorList = [];
}); });
}, },
loadSupervisors() {
getStrategySupervisorOperators().then((res) => {
if (res && res.length) {
this.supervisorList = res;
} else {
this.supervisorList = [];
}
}).catch(() => {
this.supervisorList = [];
});
},
openStaffDialog() { openStaffDialog() {
this.staffTagVisible = true; this.staffTagVisible = true;
}, },
...@@ -397,16 +390,18 @@ export default { ...@@ -397,16 +390,18 @@ export default {
confirm() { confirm() {
try { try {
this.loading = true; this.loading = true;
let { paramsInfo, merchantName, formData, biz } = this; let { paramsInfo, merchantName, formData, biz, executorList, supervisorList } = this;
let { taskType, taskTitle, staffList, executorUuid, description } = formData; let { taskType, staffList, executorUuid, description, targetValue, mentoringScene, mentoringMethod, mentoringDate, mentoringTopic } = formData;
this.formRef.validate(async (valid) => { this.formRef.validate(async (valid) => {
if (valid) { if (valid) {
const executor = this.executorList.find(item => item.directorUserId === executorUuid); let executorKey = taskType == 8 ? "uuid" : "directorUserId";
let list = taskType == 8 ? supervisorList : executorList;
console.log(list, executorUuid);
const executor = list.find(item => item[executorKey] == executorUuid);
let params = { let params = {
strategyInfo: { strategyInfo: {
strategyType: taskType, strategyType: taskType,
biz, biz,
title: taskTitle,
description, description,
}, },
merchantList: [ merchantList: [
...@@ -416,6 +411,20 @@ export default { ...@@ -416,6 +411,20 @@ export default {
}, },
], ],
}; };
let strategyExtension = {};
if ([8, 12].includes(+taskType)) {
if ((targetValue !== "" || targetValue !== null || targetValue !== undefined)) {
strategyExtension.targetValue = targetValue;
}
if (taskType == 8) {
strategyExtension.mentoringScene = mentoringScene;
strategyExtension.mentoringMethod = mentoringMethod;
strategyExtension.mentoringDate = mentoringDate;
strategyExtension.mentoringTopic = mentoringTopic;
}
params.strategyExtension = strategyExtension;
}
let allStaffs = []; let allStaffs = [];
if (staffList && staffList.length) { if (staffList && staffList.length) {
if (staffList.length > 100) { if (staffList.length > 100) {
...@@ -423,25 +432,44 @@ export default { ...@@ -423,25 +432,44 @@ export default {
this.$message.error("最多只能选择100个问题人员"); this.$message.error("最多只能选择100个问题人员");
return; return;
} }
allStaffs = staffList.map(e => ({ allStaffs = staffList.map((e) => {
let i = {
userUuid: e.staffUuid, userUuid: e.staffUuid,
userName: e.staffName, userName: e.staffName,
userPhone: e.phoneNumber, userPhone: e.phoneNumber,
userPosition: 0, // 问题人员 userPosition: 0, // 问题人员
})); };
if (taskType == 8) {
i.relType = 2;
}
return i;
});
} }
if (executor) { if (executor) {
allStaffs.push({ let userName = taskType == 8 ? executor.name : executor.directorName;
// eslint-disable-next-line style/multiline-ternary
let executorItem = taskType == 8 ? {
userUuid: executor.uuid,
userName,
userPhone: executor.phone,
userPosition: executor.userPosition,
relType: 1,
} : {
userUuid: executor.directorUserId, userUuid: executor.directorUserId,
userName: executor.directorName, userName,
userPhone: executor.directorPhone, userPhone: executor.directorPhone,
userPosition: biz === 2 ? 8 : 9, // 执行人员:轻改=8,权益、延保=9 userPosition: biz === 2 ? 8 : 9, // 执行人员:轻改=8,权益、延保=9
}); };
allStaffs.push(executorItem);
if (taskType != 8) {
params.strategyInfo.title = `${userName}的${TASKTYPEOPTION.find(item => item.value == taskType).label}`;
}
} }
if (allStaffs.length) { if (allStaffs.length) {
params.staffList = allStaffs; params.staffList = allStaffs;
} }
const { code, data, message } = await batchCreateStrategy(params); const { code, data, message } = await batchCreateStrategy(params);
this.loading = false; this.loading = false;
if (code == 0) { if (code == 0) {
......
...@@ -385,7 +385,7 @@ export default { ...@@ -385,7 +385,7 @@ export default {
}, },
{ {
label: "平均客单价", label: "平均客单价",
key: "avgOrderAmount", key: "avgTransactionValue",
}, },
{ {
label: "套餐销售率", label: "套餐销售率",
......
...@@ -69,7 +69,7 @@ const STRATEGY_FORM_2456 = [ ...@@ -69,7 +69,7 @@ const STRATEGY_FORM_2456 = [
}, },
{ {
label: "最大订单数", label: "最大订单数",
key: "maxOrderNum", key: "maxOrders",
hide: (val) => { hide: (val) => {
let { let {
strategyType, strategyType,
......
...@@ -110,6 +110,7 @@ ...@@ -110,6 +110,7 @@
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import dayjs from "dayjs"; import dayjs from "dayjs";
import { import {
queryStrategyInfoById,
queryStrategyStudyDetailById, queryStrategyStudyDetailById,
queryStrategyTaskDetailById, queryStrategyTaskDetailById,
} from "@/api/earlyWarningManager"; } from "@/api/earlyWarningManager";
......
...@@ -137,7 +137,7 @@ export default { ...@@ -137,7 +137,7 @@ export default {
}, },
toDetail(item) { toDetail(item) {
this.currentItem = item; this.currentItem = item;
if ([8, 9, 10, 11, 12, 13, 14].includes(item.strategyType)) { if ([8, 9, 10, 11, 12, 13, 14].includes(+item.strategyType)) {
this.taskDetailVisible = true; this.taskDetailVisible = true;
} else { } else {
this.strategyDetailVisible = true; this.strategyDetailVisible = true;
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
</template> </template>
<script> <script>
import { queryStrategyStudyDetailById } from "@/api/earlyWarningManager"; import { queryStrategyInfoById, queryStrategyStudyDetailById } from "@/api/earlyWarningManager";
export default { export default {
name: "TaskDetail", name: "TaskDetail",
...@@ -124,7 +124,6 @@ export default { ...@@ -124,7 +124,6 @@ export default {
10: "商务政策更新评估", 10: "商务政策更新评估",
11: "多品类扩张", 11: "多品类扩张",
12: "流量类-提升触客率", 12: "流量类-提升触客率",
// 👇
13: "流量类-多场景拓展", 13: "流量类-多场景拓展",
14: "流量类-拓新店流量", 14: "流量类-拓新店流量",
}; };
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!