Commit 62786433 by wangzhihui

Merge branch 'feature/strategy-center' of http://192.168.3.233:8090/saas_plus/dj…

…-car-life-system into feature/strategy-center
2 parents 133e9258 8e4da89d
......@@ -13,15 +13,16 @@
<div class="business-title">
当前周期
</div>
<template v-for="(item, index) in businessForm">
<!-- {{ row }} -->
<template v-for="(item, index) in row">
<div :key="index"
class="business-item">
<div class="label">
{{ item.label }}
{{ item.categoryExtension }}
</div>
<div class="value flex">
<template v-if="businessDetail.beforeLearning[item.key] != null">
{{ businessDetail.beforeLearning[item.key] }}<template v-if="item.unit">
<template v-if="item.currentValue >= 0">
{{ item.currentValue }}<template v-if="item.unit">
{{ item.unit }}
</template>
</template>
......@@ -36,19 +37,19 @@
<div class="business-title">
下一周期
</div>
<template v-for="(item, index) in businessForm">
<template v-for="(item, index) in row">
<div :key="index"
class="business-item">
<div class="label">
{{ item.label }}
{{ item.categoryExtension }}
</div>
<div class="value flex">
<template v-if="businessDetail.afterLearning[item.key] != null">
{{ businessDetail.afterLearning[item.key] }}<template v-if="item.unit">
<template v-if="item.nextValue >= 0">
{{ item.nextValue }}<template v-if="item.unit">
{{ item.unit }}
</template>
<img class="arrow"
:src="getIconSrc(formatIsRatio(item.key))" />
:src="getIconSrc(formatIsRatio(item.nextValue - item.currentValue))" />
</template>
<template v-else>
-
......@@ -104,37 +105,7 @@ export default {
beforeLearning: {},
afterLearning: {},
},
businessForm: [
{
label: "转化率",
key: "conversionRate",
unit: "%",
},
{
label: "客单价",
key: "avgOrderAmount",
},
{
label: "套餐销售率",
key: "packageSalesRate",
unit: "%",
},
{
label: "整车延保渗透率",
key: "wholeVehicleWarrantyPenetration",
unit: "%",
},
{
label: "安心包渗透率",
key: "anxinPackagePenetration",
unit: "%",
},
{
label: "电池渗透率",
key: "batteryPenetration",
unit: "%",
},
],
businessForm: [],
};
},
computed: {
......
<template>
<div class="monitor-card" :class="{ 'is-checked': cardData.checked }">
<div class="card-head">
<!-- {{ cardData }} -->
<el-tooltip :disabled="!cardData.storeName"
effect="dark"
placement="bottom"
......@@ -29,52 +30,52 @@
popper-class="dark-tooltip">
<template #content>
<div style="max-width:236px;line-height:1.6;word-break:break-all;">
{{ cardData.mainBrands }}
{{ cardData.mainBrandsStr }}
</div>
</template>
<span class="val">{{ cardData.mainBrands || '-' }}</span>
<span class="val">{{ cardData.mainBrandsStr || '-' }}</span>
</el-tooltip>
</div>
<div class="row-item">
<span class="label">线上运营:</span>
<el-tooltip :disabled="!cardData.onlineOperators"
<el-tooltip :disabled="!onlineOperatorText"
effect="dark"
placement="top"
popper-class="dark-tooltip">
<template #content>
<div style="max-width:236px;line-height:1.6;">
{{ cardData.onlineOperators }}
<div style="max-width:236px;line-height:1.6;word-break:break-all;">
{{ onlineOperatorText }}
</div>
</template>
<span class="val">{{ cardData.onlineOperators || '-' }}</span>
<span class="val">{{ onlineOperatorText || '-' }}</span>
</el-tooltip>
</div>
<div class="row-item">
<span class="label">区域运营:</span>
<el-tooltip :disabled="!cardData.regionalOperators"
<el-tooltip :disabled="!areaOperatorText"
effect="dark"
placement="top"
popper-class="dark-tooltip">
<template #content>
<div style="max-width:236px;line-height:1.6;">
{{ cardData.regionalOperators }}
<div style="max-width:236px;line-height:1.6;word-break:break-all;">
{{ areaOperatorText }}
</div>
</template>
<span class="val">{{ cardData.regionalOperators || '-' }}</span>
<span class="val">{{ areaOperatorText || '-' }}</span>
</el-tooltip>
</div>
<div class="row-item">
<span class="label">区域督导:</span>
<el-tooltip :disabled="!cardData.regionalOperators"
<el-tooltip :disabled="!flightSupervisionText"
effect="dark"
placement="top"
popper-class="dark-tooltip">
<template #content>
<div style="max-width:236px;line-height:1.6;">
{{ cardData.regionalOperators }}
<div style="max-width:236px;line-height:1.6;word-break:break-all;">
{{ flightSupervisionText }}
</div>
</template>
<span class="val">{{ cardData.regionalOperators || '-' }}</span>
<span class="val">{{ flightSupervisionText || '-' }}</span>
</el-tooltip>
</div>
......@@ -153,6 +154,26 @@ export default {
warningOverflowMap: {},
};
},
computed: {
onlineOperatorText() {
const list = this.cardData.onlineOperator;
if (!Array.isArray(list) || !list.length)
return "";
return list.map(item => item.username).filter(Boolean).join("/");
},
areaOperatorText() {
const list = this.cardData.areaOperator;
if (!Array.isArray(list) || !list.length)
return "";
return list.map(item => item.username).filter(Boolean).join("/");
},
flightSupervisionText() {
const list = this.cardData.flightSupervision;
if (!Array.isArray(list) || !list.length)
return "";
return list.map(item => item.username).filter(Boolean).join("/");
},
},
methods: {
handleCheckboxChange() {
// 触发复选框变化事件,传递卡片数据和索引
......@@ -288,6 +309,8 @@ $text-orange: #ff7d00;
white-space: nowrap;
}
.val {
flex: 1;
min-width: 0;
color: $text-main;
white-space: nowrap;
overflow: hidden;
......
......@@ -85,6 +85,20 @@ export default {
},
},
methods: {
// 根据选项 value(即 warningType)动态获取图标,逻辑与 monitorCard.getAlertIcon 一致
getOptionIcon(item) {
if (!item || item.value == null) {
return null;
}
const iconMap = {
2: require("@/assets/strategy/icon-strategy-type01.png"),
3: require("@/assets/strategy/icon-strategy-type02.png"),
4: require("@/assets/strategy/icon-strategy-type07.png"),
5: require("@/assets/strategy/icon-strategy-type08.png"),
};
const key = item.value ?? item.warningType;
return iconMap[key] || iconMap[2];
},
handleSelect(item) {
this.$emit("change", item);
const selectedValue = {
......@@ -167,11 +181,6 @@ export default {
background-color: #f7f7f7;
}
.select-custom-dropdown .el-dropdown-menu__item i {
margin-right: 8px;
font-size: 14px;
}
.select-custom-dropdown .el-dropdown-menu__item .icon-img {
width: 18px;
height: 18px;
......
......@@ -99,7 +99,7 @@
<script>
import { findMerchantStaffList, merchantStaffByRoleList } from "@api/index";
import { getCarBrandList, getDistrictDetail, getGroupListAPI, getMonitorList, getMonitorTypeDictList, getWarningSummaryList } from "@/api/earlyWarningManager";
import { getCarBrandList, getDistrictDetail, getGroupListAPI, getWarningMetricList, getWarningSummaryList, getWarningTypeList } from "@/api/earlyWarningManager";
import noDataImg from "@/assets/strategy/emepty-strategy.png";
import { deepClone } from "@/common/util";
import util from "@/libs/util";
......@@ -110,14 +110,22 @@ import SelectCustom from "./compoments/selectCustom.vue";
import AddStrategy from "./storeSignboard/components/AddStrategy/index.vue";
// 盯防类型图标配置(配置化管理,易于扩展)
const WATCH_TYPE_ICON_CONFIG = {
1: {
2: {
icon: "el-icon-warning-outline",
iconUrl: require("@/assets/strategy/icon-strategy-type01.png"),
},
2: {
3: {
icon: "el-icon-data-line",
iconUrl: require("@/assets/strategy/icon-strategy-type02.png"),
},
4: {
icon: "el-icon-data-line",
iconUrl: require("@/assets/strategy/icon-strategy-type07.png"),
},
5: {
icon: "el-icon-data-line",
iconUrl: require("@/assets/strategy/icon-strategy-type08.png"),
},
// 默认图标配置
default: {
icon: "el-icon-warning-outline",
......@@ -349,7 +357,7 @@ export default {
twoBrandIds: twoBrandIds || [],
regionalOperatorId: regionOps,
onlineOperatorId: onlineOps,
timeDimension: { 1: "W", 2: "M" }[this.timeRangeType.value],
periodType: this.timeRangeType.value,
businessType: this.currentTab.value,
startDate: this.dateRange.startDate,
monitorType: this.currentWatchType.value,
......@@ -467,6 +475,10 @@ export default {
label: item.label,
value: item.value !== undefined ? item.value : item.label,
};
// 选中具体盯防类型时,动态拉取对应指标类型选项
if (this.currentWatchType.value != null) {
this.getWarningMetricListData();
}
},
// 选择指标类型
selectIndicatorType(item) {
......@@ -576,7 +588,7 @@ export default {
},
// 获取督导列表
getSupervisorOpsList() {
merchantStaffByRoleList({ roleName: "线上运营" }).then((res) => {
merchantStaffByRoleList({ roleName: "飞行督导" }).then((res) => {
console.log("督导列表:", res);
if (res && res.length) {
// 将返回的数据转换为选择器需要的格式
......@@ -617,10 +629,15 @@ export default {
async getIndicatorTypeList() {
try {
// 调用接口获取数据
const res = await getMonitorTypeDictList({ businessType: this.currentTab.value });
// const res = await getMonitorTypeDictList({ businessType: this.currentTab.value });
const res = await getWarningTypeList();
if (res && res.length) {
// 保存原始数据(计算属性会自动基于此生成选项)
this.monitorTypeData = res;
// 保存原始数据(指标类型 rules 在选中盯防类型后由 getWarningMetricListData 动态填充)
this.monitorTypeData = res.map(item => ({
typeName: item.warningTypeName,
typeCode: item.warningType,
rules: [],
}));
// 默认盯防类型、指标类型均为「全部」
this.currentWatchType = { label: "全部", value: null };
this.currentIndicatorType = { label: "全部", value: null };
......@@ -631,6 +648,32 @@ export default {
console.error("获取指标类型列表失败:", error);
}
},
// 根据当前盯防类型动态获取指标类型选项
async getWarningMetricListData() {
const warningType = this.currentWatchType.value;
if (warningType == null) {
return;
}
try {
const res = await getWarningMetricList({
businessType: this.currentTab.value,
warningType,
});
// 映射为 indicatorTypeOptions 使用的 rules 结构:label -> rule,value -> id(metricId)
const rules = Array.isArray(res) && res.length
? res.map(item => ({
rule: item.categoryExtension.includes("全部") ? item.metricName : (item.categoryExtension + item.metricName),
id: item.metricId,
}))
: [];
const typeIndex = this.monitorTypeData.findIndex(item => item.typeCode === warningType);
if (typeIndex !== -1) {
this.$set(this.monitorTypeData[typeIndex], "rules", rules);
}
} catch (error) {
console.error("获取指标列表失败:", error);
}
},
// 初始化默认日期范围
initDefaultDateRange() {
// 如果已经有日期值,则不初始化
......
......@@ -119,7 +119,7 @@ export default {
},
{
label: "区域督导",
key: "areaOperatorText",
key: "flightSupervisionext",
tooltip: true,
},
{
......@@ -197,6 +197,8 @@ export default {
data.onlineOperatorText = data.onlineOperator.map(e => e.username).join("/");
if (data.areaOperator && data.areaOperator.length)
data.areaOperatorText = data.areaOperator.map(e => e.username).join("/");
if (data.flightSupervision && data.flightSupervision.length)
data.flightSupervisionText = data.flightSupervision.map(e => e.username).join("/");
this.merchantDetailInfo = data;
},
changeMerchant(e) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!