Commit 6edff81a by Lin

fix(strategyAnalysis): 更新盯防类型与指标类型字段名称及数据处理逻辑

- 将盯防类型字段名称从areaOperator更改为flightSupervision,确保字段名称更符合实际含义。
- 更新指标类型字段名称从nextCycleIndicator更改为metrics,提升代码可读性与一致性。
- 优化数据请求逻辑,确保从API获取的数据格式与组件需求一致,提升数据处理的准确性。
- 新增tooltip展示逻辑,增强用户界面的交互性与信息可读性。
1 parent fece6599
...@@ -158,6 +158,21 @@ ...@@ -158,6 +158,21 @@
<span v-else>{{ scope.columnsObj.formatter(scope.scope) }}</span> <span v-else>{{ scope.columnsObj.formatter(scope.scope) }}</span>
</div> </div>
</template> </template>
<template #flightSupervision="scope">
<div>
<el-tooltip v-if="scope.columnsObj.formatter(scope.scope) && scope.columnsObj.formatter(scope.scope) !== '-' && scope.columnsObj.formatter(scope.scope) !== '、'"
effect="dark"
placement="top">
<template #content>
<div class="tooltip-content-max">
<div>{{ scope.columnsObj.formatter(scope.scope) }}</div>
</div>
</template>
<span class="two-line-ellipsis">{{ scope.columnsObj.formatter(scope.scope) }}</span>
</el-tooltip>
<span v-else>{{ scope.columnsObj.formatter(scope.scope) }}</span>
</div>
</template>
<!-- 效果分析 --> <!-- 效果分析 -->
<template #nextCycleIndicator="scope"> <template #nextCycleIndicator="scope">
<span class="effect-cell" <span class="effect-cell"
...@@ -277,7 +292,7 @@ export default { ...@@ -277,7 +292,7 @@ export default {
tableColumns: [ tableColumns: [
{ {
label: "门店名称", label: "门店名称",
prop: "merchantName4s", prop: "storeName",
minWidth: 160, minWidth: 160,
}, },
{ {
...@@ -327,15 +342,15 @@ export default { ...@@ -327,15 +342,15 @@ export default {
}, },
{ {
label: "区域督导", label: "区域督导",
prop: "areaOperator", prop: "flightSupervision",
minWidth: 80, minWidth: 80,
type: "slot", type: "slot",
addHtml: "areaOperator", addHtml: "flightSupervision",
formatter: (cellValue) => { formatter: (cellValue) => {
if (!cellValue.areaOperator || !Array.isArray(cellValue.areaOperator)) { if (!cellValue.flightSupervision || !Array.isArray(cellValue.flightSupervision)) {
return "-"; return "-";
} }
return cellValue.areaOperator return cellValue.flightSupervision
.map(item => item.username) .map(item => item.username)
.filter(username => username) .filter(username => username)
.join("/") || "、"; .join("/") || "、";
...@@ -368,10 +383,10 @@ export default { ...@@ -368,10 +383,10 @@ export default {
}, },
{ {
label: "效果分析", label: "效果分析",
prop: "nextCycleIndicator", prop: "metrics",
minWidth: 120, minWidth: 120,
type: "slot", type: "slot",
addHtml: "nextCycleIndicator", addHtml: "metrics",
formatter: (cellValue) => { formatter: (cellValue) => {
if (cellValue.nextCycleIndicator == null || cellValue.nextCycleIndicator === undefined) { if (cellValue.nextCycleIndicator == null || cellValue.nextCycleIndicator === undefined) {
return "-"; return "-";
...@@ -461,15 +476,18 @@ export default { ...@@ -461,15 +476,18 @@ export default {
async wrapStrategyEffectList(params) { async wrapStrategyEffectList(params) {
try { try {
// const data = await getStrategyEffectList(params); // const data = await getStrategyEffectList(params);
params.cycleType = params.periodType; params.cycleType = params.periodType == 1 ? 2 : params.periodType == 2 ? 3 : params.periodType;
params.startDate = dayjs(this.startDate).format("YYYY-MM-DD");
params.endDate = dayjs(this.endDate).format("YYYY-MM-DD");
const data = await getStrategyAnalysisEffect(params); const data = await getStrategyAnalysisEffect(params);
console.log("getStrategyAnalysisEffect", data);
// axios 响应拦截器已返回 data 字段的内容(数组) // axios 响应拦截器已返回 data 字段的内容(数组)
// 需要包装成 d2-table 期望的格式:{ data: [...], total: number } // 需要包装成 d2-table 期望的格式:{ data: [...], total: number }
return { return {
data: data || [], data: data.list || [],
total: (data && data.length) || 0, total: data.total,
pageNum: params.pageNum || 1, pageNum: data.pageNum,
pageSize: params.pageSize || 1000, pageSize: data.pageSize,
}; };
} catch (error) { } catch (error) {
console.error("获取策略效果分析列表失败:", error); console.error("获取策略效果分析列表失败:", error);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!