Commit ed858a92 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 71f77149 d6748ebe
......@@ -415,7 +415,6 @@ export function getMonitorTypeDictList(data = {}) {
return request(data, RequestMethods.POST);
}
// 策略分析模块
/**
* 策略分析-总数统计
*/
......@@ -648,6 +647,15 @@ export function getStrategyRecordStaticByCondition(data = {}) {
export function getStrategyMerchantAnalysisIndexHistory(data = {}) {
data.method = "dj.api.strategy.merchant.analysis.index.history";
return request(data, RequestMethods.POST);
}
/**
* 招聘概况
*/
export function getRecruitmentDemandOverview(data = {}) {
data.method = "dj.staff.api.recruitment.demand.merchant.overview";
return request(data, RequestMethods.POST);
}
/**
......@@ -659,9 +667,56 @@ export function getRecruitmentDemandOverview(data = {}) {
}
/**
* 项目组选择列表
*/
export function getGroupListAPI(data = {}) {
data.method = "dj.api.strategy.warning.group.list";
return request(data, RequestMethods.POST);
}
/**
* 预警类型下拉列表
*/
export function getWarningTypeList(data = {}) {
data.method = "dj.api.strategy.warning.type.list";
return request(data, RequestMethods.POST);
}
/**
* 预警指标下拉列表
*/
export function getWarningMetricList(data = {}) {
data.method = "dj.api.strategy.warning.metric.list";
return request(data, RequestMethods.POST);
}
/**
* 门店预警汇总列表
*/
export function getWarningSummaryList(data = {}) {
data.method = "dj.api.strategy.warning.summary";
return request(data, RequestMethods.POST);
}
/**
* 区域运营执行人员列表
*/
export function getStrategyShopMerchantOperators(data = {}) {
data.method = "dj.api.strategy.shop.merchant.operators";
return request(data, RequestMethods.POST);
}
/*
* 门店预警员工详情
*/
export function getWarningStoreStaffDetail(data = {}) {
data.method = "dj.api.strategy.warning.store.staff.detail";
return request(data, RequestMethods.POST);
}
/**
* 策略分析-效果分析
*/
export function getStrategyAnalysisEffect(data = {}) {
data.method = "dj.api.strategy.analysis.effect";
return request(data, RequestMethods.POST);
}
<template>
<baseDialog class="effect-detail-dialog"
:config="config"
:dialog-config="dialogConfig.config"
:is-show.sync="dialogShow">
<div v-loading="loading"
class="content">
<div class="block">
<div class="business-box">
<img class="bg"
src="@/assets/strategy/strategy-analyse-bg.png">
<div class="left">
<div class="business-title">
当前周期
</div>
<template v-for="(item, index) in businessForm">
<div :key="index"
class="business-item">
<div class="label">
{{ item.label }}
</div>
<div class="value flex">
<template v-if="businessDetail.beforeLearning[item.key] != null">
{{ businessDetail.beforeLearning[item.key] }}<template v-if="item.unit">
{{ item.unit }}
</template>
</template>
<template v-else>
-
</template>
</div>
</div>
</template>
</div>
<div class="right">
<div class="business-title">
下一周期
</div>
<template v-for="(item, index) in businessForm">
<div :key="index"
class="business-item">
<div class="label">
{{ item.label }}
</div>
<div class="value flex">
<template v-if="businessDetail.afterLearning[item.key] != null">
{{ businessDetail.afterLearning[item.key] }}<template v-if="item.unit">
{{ item.unit }}
</template>
<img class="arrow"
:src="getIconSrc(formatIsRatio(item.key))" />
</template>
<template v-else>
-
</template>
</div>
</div>
</template>
</div>
</div>
</div>
</div>
</baseDialog>
</template>
<script>
import { getStrategyAnalysisEffect } from "@/api/earlyWarningManager";
const decline = require("@/assets/strategy/decline.png");
const just01 = require("@/assets/strategy/just01.png");
const rise = require("@/assets/strategy/rise.png");
export default {
name: "EffectDetailDialog",
props: {
visible: {
type: Boolean,
default: false,
},
row: {
type: Object,
default: () => ({}),
},
searchParams: {
type: Object,
default: () => ({}),
},
},
data() {
return {
loading: false,
config: {
isShowFooter: false,
cancel_name: "关闭",
hideConfirmBtn: true,
},
dialogConfig: {
config: {
title: "效果分析",
width: "720px",
},
},
businessDetail: {
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: "%",
},
],
};
},
computed: {
dialogShow: {
get() {
return this.visible;
},
set() {
this.close();
},
},
},
watch: {
visible(val) {
if (val) {
this.fetchDetail();
}
},
},
methods: {
close() {
this.$emit("update:visible", false);
},
getIconSrc(name) {
return {
rise,
decline,
just01,
}[name] ?? "";
},
formatIsRatio(key) {
const { beforeLearning, afterLearning } = this.businessDetail;
const b = beforeLearning[key];
const a = afterLearning[key];
return a < b ? "decline" : b === a ? "just01" : "rise";
},
async fetchDetail() {
if (!this.row?.merchantId4s) {
return;
}
this.loading = true;
try {
const data = await getStrategyAnalysisEffect({
merchantId: this.row.merchantId4s,
...this.searchParams,
});
this.businessDetail = {
beforeLearning: data?.beforeLearning || data?.beforePeriod || {},
afterLearning: data?.afterLearning || data?.afterPeriod || {},
};
} catch (error) {
console.error("获取效果分析详情失败:", error);
this.businessDetail = {
beforeLearning: {},
afterLearning: {},
};
this.$message.error("获取效果分析详情失败,请稍后重试");
} finally {
this.loading = false;
}
},
},
};
</script>
<style scoped lang="scss">
.flex {
display: flex;
align-items: center;
}
.arrow {
width: 16px;
height: 16px;
transform: translateY(1px);
}
.content {
min-height: 289px;
}
.block {
&-title {
padding: 0 0 8px;
}
&-icon {
width: 16px;
height: 16px;
margin-right: 4px;
}
.business-box {
height: 289px;
border-radius: 4px;
position: relative;
display: flex;
box-sizing: border-box;
padding: 10px;
.bg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.left,
.right {
width: 59%;
display: flex;
flex-direction: column;
gap: 14px;
position: relative;
z-index: 2;
.business-title {
padding-top: 16px;
color: #1d1d1d;
font-size: 14px;
font-weight: 500;
}
.business-item {
display: flex;
align-items: center;
font-size: 13px;
.label {
width: 104px;
color: #888888;
}
.value {
color: #1d1d1d;
}
}
}
.left {
box-sizing: border-box;
padding-left: 15%;
}
.right {
border-radius: 4px;
background: #ffffffcc;
padding-left: 24px;
.business-item {
.value {
color: #2a58ad;
font-size: 16px;
font-weight: 500;
}
}
}
}
}
</style>
......@@ -168,10 +168,21 @@
<span v-else>{{ scope.columnsObj.formatter(scope.scope) }}</span>
</div>
</template>
<!-- 效果分析 -->
<template #nextCycleIndicator="scope">
<span class="effect-cell"
@click="handleEffectDetail(scope.scope)">
{{ scope.columnsObj.formatter(scope.scope) }}
</span>
</template>
</d2-table>
</div>
</div>
</div>
<EffectDetailDialog :row="effectDetailRow"
:search-params="effectSearchParams"
:visible.sync="effectDetailVisible" />
</div>
</template>
......@@ -183,6 +194,7 @@ import { deepClone } from "@/common/util";
import calendarCustom from "../strategyCentre/compoments/clendarCustom.vue";
import HeaderCustom from "../strategyCentre/compoments/headerCustom.vue";
import SelectCustom from "../strategyCentre/compoments/selectCustom.vue";
import EffectDetailDialog from "./components/EffectDetailDialog.vue";
import OnlineOperList from "./components/OnlineOperList";
import StrategyTypeChart from "./components/StrategyTypeChart/index.vue";
// 盯防类型图标配置(配置化管理,易于扩展)
......@@ -210,6 +222,7 @@ export default {
CalendarCustom: calendarCustom,
StrategyTypeChart,
OnlineOperList,
EffectDetailDialog,
},
data() {
return {
......@@ -217,8 +230,8 @@ export default {
currentTab: { label: "延保", value: 1 },
tabs: [
{ label: "延保", value: 1 },
{ label: "权益", value: 2 },
{ label: "轻改", value: 3 },
{ label: "权益", value: 3 },
{ label: "轻改", value: 2 },
],
// 时间范围类型
timeRangeType: { label: "月", value: 2 },
......@@ -261,6 +274,8 @@ export default {
getListApi: null, // 在 mounted 中初始化
// 初始化标志,用于避免初始化阶段 watch 触发重复刷新
isInitializing: false,
effectDetailVisible: false,
effectDetailRow: {},
// 策略类型分布运营人员筛选防抖定时器
_strategyTypeOperatorTimer: null,
tableParams: {
......@@ -361,8 +376,10 @@ export default {
label: "效果分析",
prop: "nextCycleIndicator",
minWidth: 120,
type: "slot",
addHtml: "nextCycleIndicator",
formatter: (cellValue) => {
if (cellValue.nextCycleIndicator == null && cellValue.nextCycleIndicator == undefined) {
if (cellValue.nextCycleIndicator == null || cellValue.nextCycleIndicator === undefined) {
return "-";
}
return `${cellValue.nextCycleIndicator}${this.currentWatchType.value == 1 ? "%" : ""}`;
......@@ -389,6 +406,16 @@ export default {
};
});
},
effectSearchParams() {
return {
startDate: this.startDate,
endDate: this.endDate,
businessType: this.currentTab.value,
monitorType: this.currentWatchType.value || null,
metricTypeId: this.currentIndicatorType.value || null,
periodType: this.timeRangeType.value,
};
},
// 指标类型选项(自动根据当前盯防类型生成)
indicatorTypeOptions() {
// 查找当前选中的盯防类型对应的数据
......@@ -800,6 +827,10 @@ export default {
this.loading.onlineOperData = false;
}
},
handleEffectDetail(row) {
this.effectDetailRow = row;
this.effectDetailVisible = true;
},
handleViewDetail(e) {
// 构建查询参数
const query = {
......@@ -962,6 +993,11 @@ $bg-white: #fff;
}
}
.effect-cell {
color: #2a58ad;
cursor: pointer;
}
::v-deep .emptyBg {
margin-top: 20px;
color: #999ea8;
......
......@@ -67,13 +67,13 @@
</div>
<div class="filter-group">
<span class="label">区域督导:</span>
<el-select v-model="formData.onlineOps"
<el-select v-model="formData.supervisorOps"
class="filter-select"
clearable
filterable
placeholder="全部"
size="small">
<el-option v-for="item in onlineOpsOptions"
<el-option v-for="item in supervisorOpsOptions"
:key="item.value"
:label="item.label"
:value="item.value">
......@@ -97,10 +97,11 @@ export default {
type: Object,
default: () => ({
region: "",
provinceId: "",
provinceId: null,
brand: [],
regionOps: "",
onlineOps: "",
regionOps: "all",
onlineOps: null,
supervisorOps: null,
}),
},
brandOptions: {
......@@ -119,6 +120,10 @@ export default {
type: Array,
default: () => [],
},
supervisorOpsOptions: {
type: Array,
default: () => [],
},
cascaderProps: {
type: Object,
default: () => ({}),
......@@ -220,11 +225,17 @@ $text-sub: #333333;
.label {
flex-shrink: 0;
width: 72px;
width: 92px;
font-size: 14px;
color: $text-sub;
text-align: right;
margin-right: 12px;
&::before {
content: "*";
color: #f56c6c;
margin-right: 4px;
}
}
.filter-select {
......
<template>
<div class="top-header">
<!-- 左侧 Tabs -->
<!-- Tabs -->
<div ref="tabsNav" class="tabs-nav">
<div v-for="(tab, index) in tabs"
:key="getTabKey(tab, index)"
......@@ -16,7 +16,7 @@
</div>
</div>
<!-- 右侧 筛选区 + 按钮 -->
<!-- 筛选区 + 按钮 -->
<div v-if="showRightArea" class="filter-area">
<div class="filter-group">
<span class="label">门店名称:</span>
......@@ -35,10 +35,10 @@
filterable
placeholder="全部"
size="small">
<el-option v-for="item in provinceOptions"
:key="item.code"
:label="item.name"
:value="item.code">
<el-option v-for="item in groupOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</div>
......@@ -114,9 +114,24 @@
</el-option>
</el-select>
</div>
<div class="filter-group filter-more" @click="openFiltrateDialog">
<span class="filter-more-text">更多筛选</span>
<i class="el-icon-arrow-right filter-more-icon"></i>
<div class="filter-actions-right">
<div class="filter-group filter-more" @click="openFiltrateDialog">
<span class="filter-more-text">更多筛选</span>
<i class="el-icon-arrow-right filter-more-icon"></i>
</div>
<div class="btn-group">
<el-button class="btn-search"
size="small"
type="primary"
@click="handleSearch">
查询
</el-button>
<el-button class="btn-reset"
size="small"
@click="handleReset">
重置
</el-button>
</div>
</div>
<FiltrateDialog :brand-options="brandOptions"
......@@ -125,23 +140,9 @@
:online-ops-options="onlineOpsOptions"
:province-options="provinceOptions"
:region-ops-options="regionOpsOptions"
:supervisor-ops-options="supervisorOpsOptions"
:visible.sync="filtrateDialogVisible"
@confirm="handleFiltrateConfirm" />
<!-- 按钮组 -->
<div class="btn-group">
<el-button class="btn-search"
size="small"
type="primary"
@click="handleSearch">
查询
</el-button>
<el-button class="btn-reset"
size="small"
@click="handleReset">
重置
</el-button>
</div>
</div>
</div>
</template>
......@@ -188,6 +189,10 @@ export default {
type: Array,
default: () => [],
},
groupOptions: {
type: Array,
default: () => [],
},
// 城市选项数据
cityOptions: {
type: Array,
......@@ -203,6 +208,11 @@ export default {
type: Array,
default: () => [],
},
// 区域督导选项数据
supervisorOpsOptions: {
type: Array,
default: () => [],
},
// 控制筛选区域是否展示
showRightArea: {
type: Boolean,
......@@ -329,12 +339,13 @@ export default {
this.localFilters = {
...this.localFilters,
region: dialogFilters.region ?? this.localFilters.region,
provinceId: dialogFilters.provinceId || "",
provinceId: dialogFilters.provinceId ?? null,
brand: Array.isArray(dialogFilters.brand)
? dialogFilters.brand.map(item => (Array.isArray(item) ? [...item] : item))
: [],
regionOps: dialogFilters.regionOps || "",
onlineOps: dialogFilters.onlineOps || "",
regionOps: dialogFilters.regionOps ?? "all",
onlineOps: dialogFilters.onlineOps ?? null,
supervisorOps: dialogFilters.supervisorOps ?? null,
};
},
handleSearch() {
......@@ -373,10 +384,9 @@ $text-orange: #ff7d00;
// ================= Top Header =================
.top-header {
background: #fff;
height: 54px;
display: flex;
align-items: center;
padding: 0 24px;
flex-direction: column;
align-items: stretch;
border-radius: 4px;
margin-bottom: 1px;
position: sticky;
......@@ -389,10 +399,11 @@ $text-orange: #ff7d00;
.tabs-nav {
position: relative;
display: flex;
height: 100%;
flex-shrink: 0;
border-bottom: 1px solid #e5e5e5;
padding: 17px 24px;
.tab-item {
height: 100%;
height: 34px;
width: 54px;
display: flex;
align-items: center;
......@@ -427,32 +438,52 @@ $text-orange: #ff7d00;
.filter-area {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: flex-end;
margin-left: auto;
justify-content: flex-start;
width: 100%;
min-width: 0;
box-sizing: border-box;
padding: 16px 24px;
gap: 8px 0;
.filter-group {
display: flex;
align-items: center;
margin-right: 24px;
max-width: 100%;
flex-shrink: 1;
min-width: 0;
.label {
font-size: 14px;
color: $text-sub;
margin-right: 8px;
white-space: nowrap;
flex-shrink: 0;
}
.filter-select {
width: 123px;
width: 300px;
max-width: 100%;
flex-shrink: 1;
min-width: 0;
}
.filter-select-brand {
min-width: 120px;
width: auto;
}
}
.filter-actions-right {
display: flex;
align-items: center;
gap: 12px;
margin-left: auto;
flex-shrink: 0;
&.filter-more {
.filter-more {
width: 88px;
height: 32px;
margin-right: 24px;
height: 34px;
margin-right: 0;
border: 1px solid #e5e5e5;
color: $text-sub-2;
font-size: 14px;
......@@ -461,6 +492,7 @@ $text-orange: #ff7d00;
flex-shrink: 0;
box-sizing: border-box;
border-radius: 4px;
.filter-more-text {
line-height: 1;
}
......
<template>
<div class="monitor-card" :class="{ 'is-checked': cardData.checked }">
<div class="card-head">
<el-tooltip effect="dark"
placement="bottom"
popper-class="dark-tooltip"
:disabled="!cardData.storeName">
<template #content>
<div style="width:236px;line-height:1.6;word-break:break-all;">
{{ cardData.storeName }}
</div>
</template>
<div class="company-name">
{{ cardData.storeName }}
</div>
</el-tooltip>
<el-checkbox v-model="cardData.checked"
class="card-checkbox"
@change="handleCheckboxChange">
</el-checkbox>
<div class="monitor-card" :class="{ 'is-checked': cardData.checked }">
<div class="card-head">
<el-tooltip :disabled="!cardData.storeName"
effect="dark"
placement="bottom"
popper-class="dark-tooltip">
<template #content>
<div style="width:236px;line-height:1.6;word-break:break-all;">
{{ cardData.storeName }}
</div>
</template>
<div class="company-name">
{{ cardData.storeName }}
</div>
</el-tooltip>
<el-checkbox v-model="cardData.checked"
class="card-checkbox"
@change="handleCheckboxChange">
</el-checkbox>
</div>
<div class="card-body" @click="handleViewDetail">
<div class="row-item">
<span class="label">主营品牌:</span>
<el-tooltip effect="dark"
placement="top"
popper-class="dark-tooltip"
:disabled="!cardData.mainBrands">
<template #content>
<div style="max-width:236px;line-height:1.6;word-break:break-all;">
{{ cardData.mainBrands }}
</div>
</template>
<span class="val">{{ cardData.mainBrands || '-' }}</span>
</el-tooltip>
<div class="card-body" @click="handleViewDetail">
<div class="row-item">
<span class="label">主营品牌:</span>
<el-tooltip :disabled="!cardData.mainBrands"
effect="dark"
placement="top"
popper-class="dark-tooltip">
<template #content>
<div style="max-width:236px;line-height:1.6;word-break:break-all;">
{{ cardData.mainBrands }}
</div>
<div class="row-item">
<span class="label">线上运营:</span>
<el-tooltip :disabled="!cardData.onlineOperators"
effect="dark"
placement="top"
popper-class="dark-tooltip">
<template #content>
<div style="max-width:236px;line-height:1.6;">
{{ cardData.onlineOperators }}
</div>
</template>
<span class="val">{{ cardData.onlineOperators || '-' }}</span>
</el-tooltip>
</template>
<span class="val">{{ cardData.mainBrands || '-' }}</span>
</el-tooltip>
</div>
<div class="row-item">
<span class="label">线上运营:</span>
<el-tooltip :disabled="!cardData.onlineOperators"
effect="dark"
placement="top"
popper-class="dark-tooltip">
<template #content>
<div style="max-width:236px;line-height:1.6;">
{{ cardData.onlineOperators }}
</div>
<div class="row-item">
<span class="label">区域运营:</span>
<el-tooltip :disabled="!cardData.regionalOperators"
effect="dark"
placement="top"
popper-class="dark-tooltip">
<template #content>
<div style="max-width:236px;line-height:1.6;">
{{ cardData.regionalOperators }}
</div>
</template>
<span class="val">{{ cardData.regionalOperators || '-' }}</span>
</el-tooltip>
</template>
<span class="val">{{ cardData.onlineOperators || '-' }}</span>
</el-tooltip>
</div>
<div class="row-item">
<span class="label">区域运营:</span>
<el-tooltip :disabled="!cardData.regionalOperators"
effect="dark"
placement="top"
popper-class="dark-tooltip">
<template #content>
<div style="max-width:236px;line-height:1.6;">
{{ cardData.regionalOperators }}
</div>
<div class="row-item">
<span class="label">区域督导:</span>
<el-tooltip :disabled="!cardData.regionalOperators"
effect="dark"
placement="top"
popper-class="dark-tooltip">
<template #content>
<div style="max-width:236px;line-height:1.6;">
{{ cardData.regionalOperators }}
</div>
</template>
<span class="val">{{ cardData.regionalOperators || '-' }}</span>
</el-tooltip>
</template>
<span class="val">{{ cardData.regionalOperators || '-' }}</span>
</el-tooltip>
</div>
<div class="row-item">
<span class="label">区域督导:</span>
<el-tooltip :disabled="!cardData.regionalOperators"
effect="dark"
placement="top"
popper-class="dark-tooltip">
<template #content>
<div style="max-width:236px;line-height:1.6;">
{{ cardData.regionalOperators }}
</div>
</template>
<span class="val">{{ cardData.regionalOperators || '-' }}</span>
</el-tooltip>
</div>
<!-- 预警标签组 -->
<div v-if="cardData.warningSummary && cardData.warningSummary.length > 0" class="alert-group">
<div v-for="(item, index) in cardData.warningSummary"
:key="index"
class="alert-tag"
:class="[item.includes('兜底预警') ? 'red' : 'orange']">
<img :src="getAlertIcon(item)"
alt=""
class="icon-img">
<span style=" font-size: 13px;">{{ item }}</span>
</div>
</div>
<!-- 预警标签组 -->
<div v-if="cardData.warningSummary && cardData.warningSummary.length > 0" class="alert-group">
<div v-for="(item, index) in cardData.warningSummary"
:key="index"
class="alert-tag"
:class="[item.includes('兜底预警') ? 'red' : 'orange']">
<img alt=""
class="icon-img"
:src="getAlertIcon(item)">
<span style=" font-size: 13px;">{{ item }}</span>
</div>
</div>
</div>
<div class="card-foot" @click="handleViewDetail">
<span class="info">共{{ cardData.warningTotalCount }}项预警</span>
<span class="link">
查看详情 <img src="@/assets/strategy/icon-strategy-arrow-r.png"
alt=""
srcset=""
class="icon-arrow">
</span>
</div>
<div class="card-foot" @click="handleViewDetail">
<span class="info">共{{ cardData.warningTotalCount }}项预警</span>
<span class="link">
查看详情 <img alt=""
class="icon-arrow"
src="@/assets/strategy/icon-strategy-arrow-r.png"
srcset="">
</span>
</div>
</div>
</template>
<script>
......
<template>
<el-popover
placement="bottom-start"
:width="popoverWidth"
trigger="click"
popper-class="pure-popover"
v-model="popoverVisible"
>
<ul class="popover-list">
<li
v-for="(item, index) in options"
:key="index"
:class="{ 'is-selected': isSelected(item) }"
@click="handleSelect(item)"
style="font-size: 14px;"
>
<!-- 支持图片图标 -->
<img
v-if="item.iconUrl"
:src="item.iconUrl"
alt=""
class="icon-img"
>
<!-- 支持字体图标 -->
<i
v-else-if="item.icon"
:class="item.icon"
></i>
{{ item.label }}
</li>
</ul>
<div
slot="reference"
class="icon-text-btn"
:class="{ 'has-selected': value && value.label && value.label !== defaultText }"
>
<!-- 触发按钮图标:支持图片和字体图标 -->
<img
v-if="triggerIconType === 'image'"
:src="triggerIcon"
alt=""
class="icon-img"
>
<i
v-else-if="triggerIconType === 'icon'"
:class="triggerIcon"
></i>
<el-dropdown :disabled="disabled"
placement="bottom-start"
trigger="click"
@command="handleSelect">
<div class="icon-text-btn"
:class="{ 'has-selected': value && value.label && value.label !== defaultText, 'is-disabled': disabled }">
<img v-if="triggerIconType === 'image'"
alt=""
class="icon-img"
:src="triggerIcon">
<i v-else-if="triggerIconType === 'icon'"
:class="triggerIcon">
</i>
<span>{{ label }}:{{ currentValue }}</span>
</div>
</el-popover>
<template #dropdown>
<el-dropdown-menu class="select-custom-dropdown"
:style="{ minWidth: `${popoverWidth}px` }">
<el-dropdown-item v-for="(item, index) in options"
:key="index"
:class="{ 'is-selected': isSelected(item) }"
:command="item">
<div class="icon-img">
<img v-if="item.iconUrl"
alt=""
class="icon-img"
:src="item.iconUrl">
<i v-else-if="item.icon"
:class="item.icon">
</i>
</div>
{{ item.label }}
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</template>
<script>
export default {
name: 'SelectCustom',
props: {
// 选项列表
options: {
type: Array,
required: true,
default: () => []
},
// 当前选中的值
value: {
type: Object,
default: () => ({ label: '盯防类型', value: '' })
},
// 标签文本(如"盯防类型"、"指标类型")
label: {
type: String,
required: true
},
// 触发按钮的图标(可以是图片路径或图标类名)
triggerIcon: {
type: String,
required: true
},
// 触发按钮图标类型:'image' | 'icon'
triggerIconType: {
type: String,
default: 'icon',
validator: (value) => ['image', 'icon'].includes(value)
},
// 默认文本(用于判断是否选中状态)
defaultText: {
type: String,
default: '全部'
},
// popover宽度
popoverWidth: {
type: Number,
default: 120
}
},
data() {
return {
popoverVisible: false
};
},
computed: {
// 当前显示的值
currentValue() {
if (this.value && typeof this.value === 'object' && this.value.label) {
return this.value.label;
}
return this.defaultText;
}
},
methods: {
// 处理选择
handleSelect(item) {
this.popoverVisible = false;
// 触发change事件,传递选中的项
this.$emit('change', item);
// 同时触发input事件,支持v-model,传递包含label和value的对象
const selectedValue = {
label: item.label,
value: item.value !== undefined ? item.value : item.label
};
this.$emit('input', selectedValue);
},
// 判断选项是否被选中
isSelected(item) {
if (!this.value) return false;
// 优先比较value属性,如果没有value则比较label
const itemValue = item.value !== undefined ? item.value : item.label;
const currentValue = this.value.value !== undefined ? this.value.value : this.value.label;
return itemValue === currentValue;
}
}
name: "SelectCustom",
props: {
options: {
type: Array,
required: true,
default: () => [],
},
value: {
type: Object,
default: () => ({ label: "盯防类型", value: "" }),
},
label: {
type: String,
required: true,
},
triggerIcon: {
type: String,
required: true,
},
triggerIconType: {
type: String,
default: "icon",
validator: value => ["image", "icon"].includes(value),
},
defaultText: {
type: String,
default: "全部",
},
popoverWidth: {
type: Number,
default: 120,
},
disabled: {
type: Boolean,
default: false,
},
},
computed: {
currentValue() {
if (this.value && typeof this.value === "object" && this.value.label) {
return this.value.label;
}
return this.defaultText;
},
},
methods: {
handleSelect(item) {
this.$emit("change", item);
const selectedValue = {
label: item.label,
value: item.value !== undefined ? item.value : item.label,
};
this.$emit("input", selectedValue);
},
isSelected(item) {
if (!this.value)
return false;
const itemValue = item.value !== undefined ? item.value : item.label;
const currentValue = this.value.value !== undefined ? this.value.value : this.value.label;
return itemValue === currentValue;
},
},
};
</script>
<style lang="scss" scoped>
.icon-text-btn {
cursor: pointer;
display: flex;
align-items: center;
padding: 4px 8px;
border-radius: 4px;
transition: all 0.3s;
font-size: 14px;
color: #333333;
&:hover {
color: #2A58AD;
}
i {
margin-right: 6px;
font-size: 16px;
}
.icon-img {
width: 16px;
height: 16px;
margin-right: 6px;
object-fit: contain;
vertical-align: middle;
}
&.has-selected {
background-color: #EFF3F6;
}
cursor: pointer;
display: flex;
align-items: center;
padding: 4px 8px;
border-radius: 4px;
transition: all 0.3s;
font-size: 14px;
color: #333333;
&:hover {
color: #2a58ad;
}
i {
margin-right: 6px;
font-size: 16px;
}
.icon-img {
width: 16px;
height: 16px;
margin-right: 6px;
object-fit: contain;
vertical-align: middle;
}
&.has-selected {
background-color: #eff3f6;
}
&.is-disabled {
cursor: not-allowed;
color: #c0c4cc;
&:hover {
color: #c0c4cc;
}
}
}
</style>
<style>
/* 全局样式,与父组件保持一致 */
.pure-popover {
padding: 4px 0 !important;
border-color: #E5E6EB !important;
box-shadow: 0 4px 10px rgba(0,0,0,0.1) !important;
.select-custom-dropdown {
padding: 4px 0 !important;
border-color: #e5e6eb !important;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1) !important;
}
.select-custom-dropdown .el-dropdown-menu__item {
display: flex;
align-items: center;
padding: 9px 16px;
font-size: 14px;
color: #333333;
line-height: 1.5;
}
.select-custom-dropdown .el-dropdown-menu__item.is-selected {
background-color: #f7f7f7;
}
.select-custom-dropdown .el-dropdown-menu__item i {
margin-right: 8px;
font-size: 14px;
}
.popover-list {
list-style: none;
margin: 0;
padding: 0;
li {
padding: 9px 16px;
cursor: pointer;
color: #333333;
font-size: 12px;
display: flex;
align-items: center;
&.is-selected {
background-color: #f7f7f7;
}
&:hover {
background-color: #F2F3F5;
}
i {
margin-right: 8px;
font-size: 14px;
}
.icon-img {
width: 18px;
height: 18px;
border-radius: 3px;
margin-right: 8px;
}
}
.select-custom-dropdown .el-dropdown-menu__item .icon-img {
width: 18px;
height: 18px;
border-radius: 3px;
margin-right: 8px;
}
</style>
......@@ -4,16 +4,17 @@
<HeaderCustom v-model="currentTab"
:brand-options="baseData.brandOptions"
:filters="filters"
:group-options="baseData.groupOptions"
:online-ops-options="baseData.onlineOpsList"
:province-options="baseData.provinceInfoList"
:region-ops-options="baseData.regionOpsList"
:show-right-area="true"
:supervisor-ops-options="baseData.supervisorOpsList"
:tabs="tabs"
@reset="handleReset"
@search="handleSearch"
@tab-change="handleTabChange">
</HeaderCustom>
<!-- 2. 中间工具栏 -->
<div class="toolbar-container">
<div class="tool-left">
......@@ -28,7 +29,8 @@
<span class="v-divider">|</span>
<!-- 指标类型 -->
<SelectCustom label="指标类型"
<SelectCustom :disabled="isIndicatorTypeDisabled"
label="指标类型"
:options="indicatorTypeOptions"
:trigger-icon="require('@/assets/strategy/icon-strategy-type06.png')"
trigger-icon-type="image"
......@@ -96,7 +98,7 @@
<script>
import { findMerchantStaffList, merchantStaffByRoleList } from "@api/index";
import { getCarBrandList, getDistrictDetail, getMonitorList, getMonitorTypeDictList } from "@/api/earlyWarningManager";
import { getCarBrandList, getDistrictDetail, getGroupListAPI, getMonitorList, getMonitorTypeDictList } from "@/api/earlyWarningManager";
import noDataImg from "@/assets/strategy/emepty-strategy.png";
import { deepClone } from "@/common/util";
import util from "@/libs/util";
......@@ -144,8 +146,8 @@ export default {
currentTab: { label: "延保", value: 1 },
tabs: [
{ label: "延保", value: 1 },
{ label: "权益", value: 2 },
{ label: "轻改", value: 3 },
{ label: "权益", value: 3 },
{ label: "轻改", value: 2 },
],
filters: {
storeName: "",
......@@ -155,13 +157,16 @@ export default {
brand: [],
regionOps: "",
onlineOps: "",
flightSupervisionId: "",
}, // 顶部筛选项表单
// 选择器数据
baseData: {
provinceInfoList: [],
regionOpsList: [], // 区域运营列表
onlineOpsList: [], // 线上运营列表
supervisorOpsList: [], // 督导列表
brandOptions: [], // 品牌级联选择器数据
groupOptions: [], // 项目组列表
},
timeRangeType: { label: "月", value: 2 }, // 当前选中的时间范围类型
timeRangeOptions: [
......@@ -178,7 +183,7 @@ export default {
// 存储原始监控类型数据(接口返回的完整数据)
monitorTypeData: [],
// 当前选中的盯防类型
currentWatchType: { label: "", value: null },
currentWatchType: { label: "全部", value: null },
// 当前选中的指标类型
currentIndicatorType: { label: "全部", value: null },
// 门店列表数据
......@@ -190,22 +195,35 @@ export default {
computed: {
// 盯防类型选项数据格式化:label: 盯防类型, value: 盯防类型编码, icon: 图标, iconUrl: 图标路径(自动根据原始数据生成)
watchTypeOptions() {
const allOption = { label: "全部", value: null };
if (!this.monitorTypeData || this.monitorTypeData.length === 0) {
return [];
return [allOption];
}
return this.monitorTypeData.map((item) => {
const iconConfig = WATCH_TYPE_ICON_CONFIG[item.typeCode] || WATCH_TYPE_ICON_CONFIG.default;
return {
label: item.typeName,
value: item.typeCode,
icon: iconConfig.icon,
iconUrl: iconConfig.iconUrl,
};
});
return [
allOption,
...this.monitorTypeData.map((item) => {
const iconConfig = WATCH_TYPE_ICON_CONFIG[item.typeCode] || WATCH_TYPE_ICON_CONFIG.default;
return {
label: item.typeName,
value: item.typeCode,
icon: iconConfig.icon,
iconUrl: iconConfig.iconUrl,
};
}),
];
},
// 盯防类型为「全部」时,指标类型不可选
isIndicatorTypeDisabled() {
return this.currentWatchType.value == null;
},
// 指标类型选项(自动根据当前盯防类型生成)
indicatorTypeOptions() {
if (this.currentWatchType.value == null) {
return [{ label: "全部", value: null }];
}
// 查找当前选中的盯防类型对应的数据
const currentTypeData = this.monitorTypeData.find(
item => item.typeCode === this.currentWatchType.value,
......@@ -286,6 +304,10 @@ export default {
this.getRegionOpsList();
// 获取线上运营列表
this.getOnlineOpsList();
// 获取督导列表
this.getSupervisorOpsList();
// 获取项目组列表
this.getGroupList();
// 获取车品牌列表
this.getCarBrandList();
// 获取指标类型列表
......@@ -533,6 +555,36 @@ export default {
}
});
},
// 获取督导列表
getSupervisorOpsList() {
merchantStaffByRoleList({ roleName: "线上运营" }).then((res) => {
console.log("督导列表:", res);
if (res && res.length) {
// 将返回的数据转换为选择器需要的格式
this.baseData.supervisorOpsList = res.map(item => ({
value: item.uuid,
label: item.staffName,
}));
// 在列表前面添加"全部"选项
if (this.baseData.supervisorOpsList.length && this.baseData.supervisorOpsList[0].label !== "全部") {
this.baseData.supervisorOpsList.unshift({
value: null,
label: "全部",
});
}
}
});
},
getGroupList() {
getGroupListAPI().then((res) => {
if (res && res.length) {
this.baseData.groupOptions = res.map(item => ({
value: item.groupId,
label: item.groupName,
}));
}
});
},
// 获取监控类型字典列表(更简洁的实现)
async getIndicatorTypeList() {
try {
......@@ -541,15 +593,8 @@ export default {
if (res && res.length) {
// 保存原始数据(计算属性会自动基于此生成选项)
this.monitorTypeData = res;
// 初始化当前选中的盯防类型为第一个
if (res[0]) {
this.currentWatchType = {
label: res[0].typeName,
value: res[0].typeCode,
};
}
// 初始化当前选中的指标类型为"全部"
// 默认盯防类型、指标类型均为「全部」
this.currentWatchType = { label: "全部", value: null };
this.currentIndicatorType = { label: "全部", value: null };
} else {
console.warn("指标类型列表接口返回为空");
......@@ -610,7 +655,7 @@ export default {
$primary: #2a58ad;
$text-main: #1d2129;
$text-sub: #333333;
$border: #e5e6eb;
$border: #e5e5e5;
$bg-gray: #eff3f6;
$bg-white: #fff;
......@@ -635,7 +680,7 @@ $bg-white: #fff;
gap: 12px;
border-radius: 0 0 4px 4px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
border-top: 1px solid $border;
border-top: 1px solid #eeeeee6b;
border-bottom: 1px solid $border;
}
......
<template>
<div class="overview-box">
<template v-for="(item, index) in overviewList2">
<template v-for="(item, index) in overviewList">
<div :key="index"
class="overview-item"
:class="[{ 'clear-border': index == overviewList2.length - 1 }]">
:class="[{ 'clear-border': index == overviewList.length - 1 }]">
<div class="title flex">
{{ item.title }}
<el-button v-if="hasEHi"
......@@ -134,89 +134,6 @@ const overviewList = [
],
},
];
const overviewList2 = [
{
title: "车窗膜",
list: [
{
label: "成交数",
key: "vehicleWarrantyDealCount",
},
{
label: "单车采购产值",
key: "vehicleWarrantyPenetrationRate",
subKey: "vehicleWarrantyPenetrationBottomTarget",
unit: "%",
},
{
label: "渗透率",
key: "vehicleWarrantyConversionRate",
subKey: "vehicleWarrantyConversionBottomTarget",
unit: "%",
},
{
label: "触客转化率",
key: "vehicleWarrantyConversionRate",
subKey: "vehicleWarrantyConversionBottomTarget",
unit: "%",
},
],
},
{
title: "车身膜",
list: [
{
label: "成交数",
key: "safetyPackageDealCount",
},
{
label: "单车采购产值",
key: "safetyPackagePenetrationRate",
subKey: "safetyPackagePenetrationBottomTarget",
unit: "%",
},
{
label: "渗透率",
key: "safetyPackageConversionRate",
subKey: "safetyPackageConversionBottomTarget",
unit: "%",
},
{
label: "触客转化率",
key: "safetyPackageConversionRate",
subKey: "safetyPackageConversionBottomTarget",
unit: "%",
},
],
},
{
title: "精品附件",
list: [
{
label: "成交数",
key: "batteryWarrantyDealCount",
},
{
label: "单车采购产值",
key: "batteryWarrantyPenetrationRate",
subKey: "batteryWarrantyPenetrationBottomTarget",
unit: "%",
},
{
label: "渗透率",
key: "batteryWarrantyConversionRate",
subKey: "batteryWarrantyConversionBottomTarget",
unit: "%",
},
{
label: "触客转化率",
key: "batteryWarrantyConversionRate",
subKey: "batteryWarrantyConversionBottomTarget",
unit: "%",
},
],
},
];
export default {
name: "OverViewList",
components: { HistoryTarget },
......@@ -263,25 +180,6 @@ export default {
}
return list;
},
overviewList2() {
let { hasEHi, isHarmony } = this;
let list = this.deepClone(overviewList2);
if (hasEHi) {
list.map((e, index) => {
e.list.push({
label: "生态系数",
key: {
0: "vehicleWarrantyEcoCoefficient",
1: "safetyPackageEcoCoefficient",
2: "batteryWarrantyEcoCoefficient",
3: "tireWarrantyEcoCoefficient",
}[index],
hide: !isHarmony,
});
});
}
return list;
},
},
mounted() {
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!