Commit 8457cbaa by Jaxon

Merge branch 'SAAS+V5.8.3' of http://192.168.3.233:8090/saas_plus/dj-car-life-sy…

…stem into feature/marketing-sop-push-strategy
2 parents 7f46e36a a60e5744
......@@ -4,9 +4,9 @@
"private": true,
"scripts": {
"备注": "去掉nomock配置命令",
"serve": "vue-cli-service serve",
"start": "set NODE_OPTIONS=--openssl-legacy-provider && npm run serve",
"dev": "set NODE_OPTIONS=--openssl-legacy-provider && npm run serve",
"serve": "set NODE_OPTIONS=--max-old-space-size=4096&& vue-cli-service serve",
"start": "npm run serve",
"dev": "npm run serve",
"build": "vue-cli-service build --no-module",
"build:nomock": "vue-cli-service build --mode nomock",
"lint": "vue-cli-service lint --fix",
......
<template>
<d2-container v-loading="pageLoading" class="customer-group-rel-page">
<div class="page-content">
<CustomerBasicInfoCard
:customer-row="customerRow"
:basic-info="groupData.basicInfo"
/>
<d2-container v-loading="pageLoading" class="customer-group-rel-page">
<div class="page-content">
<CustomerBasicInfoCard :basic-info="groupData.basicInfo"
:customer-row="customerRow" />
<section class="detail-card">
<h3 class="detail-card__title">
群关联
</h3>
<div
v-for="item in groupFieldList"
:key="item.prop"
class="field-row"
>
<span class="field-label">{{ item.label }}:</span>
<span class="field-value">{{ displayGroupInfo[item.prop] || "-" }}</span>
</div>
</section>
<section class="detail-card">
<h3 class="detail-card__title">
群关联
</h3>
<div v-for="item in groupFieldList"
:key="item.prop"
class="field-row">
<span class="field-label">{{ item.label }}:</span>
<span class="field-value">{{ displayGroupInfo[item.prop] || "-" }}</span>
</div>
</section>
<div class="footer-actions">
<el-button type="primary" size="medium" @click="handleBack">
返回
</el-button>
</div>
</div>
</d2-container>
<div class="footer-actions">
<el-button size="medium"
type="primary"
@click="handleBack">
返回
</el-button>
</div>
</div>
</d2-container>
</template>
<script>
......@@ -75,7 +73,7 @@ export default {
}
this.customerRow = resolveCustomerRowFromRoute(
this.$route,
loadCustomerSnapshot()
loadCustomerSnapshot(),
);
this.loadGroupInfo();
},
......
......@@ -14,34 +14,36 @@
</div>
<p class="date-y-line" />
</template>
<el-button icon="el-icon-d-arrow-left"
<el-button class="arrow-left-icon"
icon="el-icon-d-arrow-left"
type="text"
class="arrow-left-icon"
:disabled="currentWeek === 1"
@click="handleWeek(false)" />
<template>
<div class="date-picker">
<div class="wrapper"
v-for="(item, index) in dateList.slice(currentWeek * 7 - 7, currentWeek * 7)"
:key="index">
<div v-for="(item, index) in dateList.slice(currentWeek * 7 - 7, currentWeek * 7)"
:key="index"
class="wrapper">
<span>
<p v-for="(info, infoIndex) in appointData[index].infoList"
:key="infoIndex">
<el-popover placement="bottom-start"
<el-popover open-delay="600"
placement="bottom-start"
title=""
width="200"
open-delay="600"
trigger="hover"
width="200"
:disabled="info.status === 0">
<div>
<p>1、客户姓名,时间,项目</p>
<p>2、客户姓名,时间,项目</p>
<p>余位数:8</p>
</div>
<el-button :class="{'col-width': true, 'hour-template': true, 'status-full': info.status === 2, 'status-remain': info.status === 1 }"
slot="reference"
<el-button slot="reference"
class="col-width hour-template"
:class="{ 'status-full': info.status === 2, 'status-remain': info.status === 1 }"
@click="handleAppoint(item, infoIndex)">
{{ appointStatusList[info.status] }}</el-button>
{{ appointStatusList[info.status] }}
</el-button>
</el-popover>
</p>
</span>
......@@ -49,13 +51,14 @@
</div>
<p class="date-x-line" />
<div class="date-picker">
<div class="wrapper"
v-for="(item, index) in dateList.slice(currentWeek * 7 - 7, currentWeek * 7)"
:key="index">
<el-button type="text"
:class="{'date-btn': true, 'col-width': true, 'active': item.active}"
<div v-for="(item, index) in dateList.slice(currentWeek * 7 - 7, currentWeek * 7)"
:key="index"
class="wrapper">
<el-button class="date-btn col-width"
type="text"
:class="{ active: item.active }"
@click="handleSelectDate(index)">
<p>{{ item.date.split('/')[1] + '.' + item.date.split('/')[2] }}</p>
<p>{{ `${item.date.split('/')[1]}.${item.date.split('/')[2]}` }}</p>
<p>{{ weekList[item.week] }}</p>
</el-button>
</div>
......@@ -70,59 +73,60 @@
</template>
<script>
import { appointDays } from '@/common/format'
export default {
name: 'TimeDate',
data() {
return {
// 7天为一个周期,预约时间为35天,一共5个周期,当前周期
currentWeek: 1,
// 日期
dateIndex: 0,
weekList: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
dateList: new Array(appointDays).fill(null).map((item, index) => {
var date = new Date(new Date().setDate(new Date().getDate() + index))
return {
date: date.toLocaleDateString(),
week: date.getDay(),
active: !index
}
}),
// 时间
appointStatusList: ['空', '余', '满']
}
},
import { appointDays } from "@/common/format";
props: {
appointData: {
type: Array,
default: () => []
},
hoursList: {
type: Array,
default: () => []
}
},
export default {
name: "TimeDate",
mounted() { },
props: {
appointData: {
type: Array,
default: () => [],
},
hoursList: {
type: Array,
default: () => [],
},
},
data() {
return {
// 7天为一个周期,预约时间为35天,一共5个周期,当前周期
currentWeek: 1,
// 日期
dateIndex: 0,
weekList: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
dateList: new Array(appointDays).fill(null).map((item, index) => {
let date = new Date(new Date().setDate(new Date().getDate() + index));
return {
date: date.toLocaleDateString(),
week: date.getDay(),
active: !index,
};
}),
// 时间
appointStatusList: ["空", "余", "满"],
};
},
methods: {
// 日期选择
handleSelectDate(currentIndex) {
// this.dateList[this.dateIndex].active = false
// this.dateIndex = currentIndex
// this.dateList[currentIndex].active = true
},
handleAppoint(date, hourIndex) {
// this.$emit('handleAppoint', { date: date.date, hour: this.hoursList[hourIndex].hour })
},
handleWeek(isAdd) {
isAdd ? this.currentWeek++ : this.currentWeek--
}
}
}
mounted() { },
methods: {
// 日期选择
handleSelectDate(currentIndex) {
// this.dateList[this.dateIndex].active = false
// this.dateIndex = currentIndex
// this.dateList[currentIndex].active = true
},
handleAppoint(date, hourIndex) {
// this.$emit('handleAppoint', { date: date.date, hour: this.hoursList[hourIndex].hour })
},
handleWeek(isAdd) {
isAdd ? this.currentWeek++ : this.currentWeek--;
},
},
};
</script>
<style lang="scss" scoped>
@import "./css/timeDateStyle.scss";
</style>
<template>
<d2-container v-loading="pageLoading" class="customer-portrait-page">
<div class="page-content">
<CustomerBasicInfoCard
:customer-row="customerRow"
:basic-info="portraitData.basicInfo"
/>
<d2-container v-loading="pageLoading" class="customer-portrait-page">
<div class="page-content">
<CustomerBasicInfoCard :basic-info="portraitData.basicInfo"
:customer-row="customerRow" />
<section class="detail-card">
<h3 class="detail-card__title">
消费力标签({{ consumptionScore }}分)
</h3>
<template v-if="consumptionDimensions.length">
<div
v-for="(dimension, index) in consumptionDimensions"
:key="`consumption-${index}`"
class="field-row"
>
<span class="field-label">{{ dimension.dimensionName }}:</span>
<div class="tag-list">
<template v-if="dimension.tags.length">
<el-tag
v-for="(tag, tagIndex) in dimension.tags"
:key="`consumption-tag-${index}-${tagIndex}`"
size="small"
class="tag-item"
>
{{ tag }}
</el-tag>
</template>
<span v-else class="empty-text">-</span>
</div>
</div>
</template>
<div v-else class="field-row">
<span class="empty-text">-</span>
</div>
</section>
<section class="detail-card">
<h3 class="detail-card__title">
消费力标签({{ consumptionScore }}分)
</h3>
<template v-if="consumptionDimensions.length">
<div v-for="(dimension, index) in consumptionDimensions"
:key="`consumption-${index}`"
class="field-row">
<span class="field-label">{{ dimension.dimensionName }}:</span>
<div class="tag-list">
<template v-if="dimension.tags.length">
<el-tag v-for="(tag, tagIndex) in dimension.tags"
:key="`consumption-tag-${index}-${tagIndex}`"
class="tag-item"
size="small">
{{ tag }}
</el-tag>
</template>
<span v-else class="empty-text">-</span>
</div>
</div>
</template>
<div v-else class="field-row">
<span class="empty-text">-</span>
</div>
</section>
<section class="detail-card">
<h3 class="detail-card__title">
产品标签({{ productScore }}分)
</h3>
<template v-if="productDimensions.length">
<div
v-for="(dimension, index) in productDimensions"
:key="`product-${index}`"
class="field-row"
>
<span class="field-label">{{ dimension.dimensionName }}:</span>
<div class="tag-list">
<template v-if="dimension.tags.length">
<el-tag
v-for="(tag, tagIndex) in dimension.tags"
:key="`product-tag-${index}-${tagIndex}`"
size="small"
class="tag-item"
>
{{ tag }}
</el-tag>
</template>
<span v-else class="empty-text">-</span>
</div>
</div>
</template>
<div v-else class="field-row">
<span class="empty-text">-</span>
</div>
</section>
<section class="detail-card">
<h3 class="detail-card__title">
产品标签({{ productScore }}分)
</h3>
<template v-if="productDimensions.length">
<div v-for="(dimension, index) in productDimensions"
:key="`product-${index}`"
class="field-row">
<span class="field-label">{{ dimension.dimensionName }}:</span>
<div class="tag-list">
<template v-if="dimension.tags.length">
<el-tag v-for="(tag, tagIndex) in dimension.tags"
:key="`product-tag-${index}-${tagIndex}`"
class="tag-item"
size="small">
{{ tag }}
</el-tag>
</template>
<span v-else class="empty-text">-</span>
</div>
</div>
</template>
<div v-else class="field-row">
<span class="empty-text">-</span>
</div>
</section>
<section class="detail-card">
<h3 class="detail-card__title">
行为标签({{ behaviorScore }}分)
</h3>
<el-table
:data="behaviorTagList"
border
size="small"
class="behavior-table"
>
<el-table-column
label="序号"
type="index"
width="60"
align="center"
/>
<el-table-column
label="标签维度"
prop="dimensionName"
min-width="200"
align="center"
/>
<el-table-column
label="枚举值"
min-width="120"
align="center"
>
<template slot-scope="scope">
<el-tag
v-if="scope.row.enumName"
size="small"
class="tag-item"
>
{{ scope.row.enumName }}
</el-tag>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column
label="依据"
prop="basis"
min-width="320"
align="left"
>
<template slot-scope="scope">
<span class="basis-text">{{ scope.row.basis || "-" }}</span>
</template>
</el-table-column>
</el-table>
</section>
<section class="detail-card">
<h3 class="detail-card__title">
行为标签({{ behaviorScore }}分)
</h3>
<el-table class="behavior-table"
size="small"
border
:data="behaviorTagList">
<el-table-column align="center"
label="序号"
type="index"
width="60" />
<el-table-column align="center"
label="标签维度"
min-width="200"
prop="dimensionName" />
<el-table-column align="center"
label="枚举值"
min-width="120">
<template #default="scope">
<el-tag v-if="scope.row.enumName"
class="tag-item"
size="small">
{{ scope.row.enumName }}
</el-tag>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column align="left"
label="依据"
min-width="320"
prop="basis">
<template #default="scope">
<span class="basis-text">{{ scope.row.basis || "-" }}</span>
</template>
</el-table-column>
</el-table>
</section>
<div class="footer-actions">
<el-button type="primary" size="medium" @click="handleBack">
返回
</el-button>
</div>
</div>
</d2-container>
<div class="footer-actions">
<el-button size="medium"
type="primary"
@click="handleBack">
返回
</el-button>
</div>
</div>
</d2-container>
</template>
<script>
......@@ -185,7 +165,7 @@ export default {
}
this.customerRow = resolveCustomerRowFromRoute(
this.$route,
loadCustomerSnapshot()
loadCustomerSnapshot(),
);
this.loadPortrait();
},
......@@ -197,12 +177,12 @@ export default {
id: this.customerId,
});
this.applyPortraitData(
mapProfileResponse(res || {}, this.customerRow)
mapProfileResponse(res || {}, this.customerRow),
);
} catch (err) {
this.$message.error(err.message || "加载客户画像失败");
this.applyPortraitData(
mapProfileResponse({}, this.customerRow)
mapProfileResponse({}, this.customerRow),
);
} finally {
this.pageLoading = false;
......
......@@ -52,7 +52,7 @@ export function formatCarModel(row = {}) {
return carModel;
}
const parts = [row.carBrand, row.carSeriesName, row.carTypeName]
.map((item) => (item || "").trim())
.map(item => (item || "").trim())
.filter(Boolean);
return parts.length ? parts.join("-") : "";
}
......@@ -92,10 +92,8 @@ export function formatGroupStatus(row = {}) {
}
export function formatDeliveryTime(row = {}) {
const time = row.deliveryDate
|| row.deliveryTime
|| row.buyTimeStr
|| (row.order && row.order.installUpgradeTime);
const time = row.deliveryDate;
return formatDateValue(time);
}
......@@ -115,7 +113,7 @@ export function formatCustomerStatus(row = {}, statusList = CUSTOMER_STATUS_LIST
if (customerStatus == null || customerStatus === "") {
return "-";
}
const matched = statusList.find((item) => Number(item.confId) === Number(customerStatus));
const matched = statusList.find(item => Number(item.confId) === Number(customerStatus));
return matched ? matched.confLabel : "-";
}
......@@ -187,7 +185,7 @@ function buildProfileCarModel(res = {}) {
return carModel;
}
const parts = [res.carBrand, res.carSeriesName]
.map((item) => (item || "").trim())
.map(item => (item || "").trim())
.filter(Boolean);
return parts.length ? parts.join("-") : "";
}
......@@ -211,34 +209,38 @@ export function mapProfileResponse(res = {}, snapshotRow = {}) {
};
const consumptionTag = res.consumptionTag || {};
// 接口字段名与 categoryName 语义对调:产品数据在 behaviorTag,行为数据在 productTag
const apiProductTag = res.behaviorTag || {};
const apiBehaviorTag = res.productTag || {};
const productTag = res.productTag || {};
const behaviorTag = res.behaviorTag || {};
const consumptionDimensions = (consumptionTag.dimensions || []).map((dimension) => ({
const consumptionDimensions = (consumptionTag.dimensions || []).map(dimension => ({
dimensionName: dimension.dimensionName || "-",
tags: (dimension.enumValues || []).map((item) => item.enumName).filter(Boolean),
tags: (dimension.enumValues || []).map(item => item.enumName).filter(Boolean),
}));
const productDimensions = (apiProductTag.dimensions || []).map((dimension) => ({
dimensionName: dimension.dimensionName || "-",
tags: (dimension.enumValues || []).map((item) => item.enumName).filter(Boolean),
}));
const productDimensions = [];
const dealTags = (productTag.dealEnumValues || [])
.map(item => item.enumName)
.filter(Boolean);
if (dealTags.length) {
productDimensions.push({ dimensionName: "已成交品类", tags: dealTags });
}
const noDealTags = (productTag.noDealEnumValues || [])
.map(item => item.enumName)
.filter(Boolean);
if (noDealTags.length) {
productDimensions.push({ dimensionName: "未成交品类", tags: noDealTags });
}
const behaviorTagList = [];
const behaviorCategory = apiBehaviorTag.categoryName || "行为标签";
(apiBehaviorTag.dealEnumValues || []).forEach((item) => {
behaviorTagList.push({
dimensionName: behaviorCategory,
enumName: item.enumName || "",
basis: item.scoreBasis || "",
});
});
(apiBehaviorTag.noDealEnumValues || []).forEach((item) => {
behaviorTagList.push({
dimensionName: behaviorCategory,
enumName: item.enumName || "",
basis: item.scoreBasis || "",
(behaviorTag.dimensions || []).forEach((dimension) => {
(dimension.enumValues || []).forEach((enumValue) => {
behaviorTagList.push({
dimensionName: dimension.dimensionName || "-",
enumName: enumValue.enumName || "",
basis: enumValue.scoreBasis || "",
});
});
});
......@@ -246,9 +248,9 @@ export function mapProfileResponse(res = {}, snapshotRow = {}) {
basicInfo,
consumptionScore: consumptionTag.totalScore || 0,
consumptionDimensions,
productScore: apiProductTag.totalScore || 0,
productScore: productTag.totalScore || 0,
productDimensions,
behaviorScore: apiBehaviorTag.totalScore || 0,
behaviorScore: behaviorTag.totalScore || 0,
behaviorTagList,
};
}
......
......@@ -55,13 +55,12 @@
:key="item.tagName"
:label="item.tagName"
:value="item.tagName" />
<div class="select-footer">
<el-button size="mini"
type="text"
@click.stop="openTagManage">
管理标签
</el-button>
</div>
<el-option key="manage-tag"
style="color: #2A58AD;cursor: pointer !important;"
disabled
:value="null">
<span @click.stop="openTagManage">管理标签</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
......@@ -219,6 +218,16 @@ export default {
StoreListDialog,
},
mixins: [reportTrackPageMixin],
beforeRouteEnter(to, from, next) {
if (to.query.activityId && to.query.type) {
to.meta.title = "再次创建";
} else if (to.query.activityId) {
to.meta.title = "编辑活动";
} else {
to.meta.title = "新增活动";
}
next();
},
data() {
return {
......@@ -535,7 +544,7 @@ export default {
// 有门店被删除或替换,且存在已选车系或套餐时提示
if (removedIds.length > 0 && (this.selectedSeries.length || this.directPackages.length)) {
this.$confirm("适用门店已变更,已添加的车系及商品/套餐将被清除。", "确认变更?", {
this.$confirm("已添加的商品或套餐需要重新设置,确定继续?", "适用门店移除", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
......@@ -557,7 +566,7 @@ export default {
removeStore(store) {
// 有已选车系或套餐时提示
if (this.selectedSeries.length || this.directPackages.length) {
this.$confirm("适用门店已变更,已添加的车系及商品/套餐将被清除。", "确认移除?", {
this.$confirm("已添加的商品或套餐需要重新设置,确定继续?", "适用门店移除", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
......@@ -953,13 +962,13 @@ export default {
for (const series of this.selectedSeries) {
const count = (this.seriesPackages[series.id] || []).length;
if (count > MAX_LIMIT) {
this.$message.warning(`${series.name} 的套餐/商品数量不能超过${MAX_LIMIT}条(当前${count}条)`);
this.$message.warning(`${series.name}最多添加100个商品及套餐`);
return false;
}
}
} else {
if (this.directPackages.length > MAX_LIMIT) {
this.$message.warning(`套餐/商品数量不能超过${MAX_LIMIT}条(当前${this.directPackages.length}条)`);
this.$message.warning(`最多添加100个商品及套餐`);
return false;
}
}
......@@ -1132,10 +1141,8 @@ export default {
carSeriesMode,
carSeriesList,
};
console.log("提交参数:", params);
eventRequest(params).then((res) => {
this.$message.success(this.pageType == "edit" ? "编辑成功" : "新增成功");
eventRequest({ requestJson: JSON.stringify(params) }).then((res) => {
this.$message.success("操作成功");
this.submitting = false;
this.$router.replace("/marketingActivity");
}).catch(() => {
......
......@@ -635,6 +635,7 @@ export default {
// 上传组件
.upload-cell {
overflow: hidden;
position: relative;
width: 60px;
height: 60px;
......
......@@ -97,7 +97,7 @@
class="sub-table-wrapper">
<div class="sub-table-header">
<span class="sh-col sh-col-name">产品名称</span>
<span class="sh-col sh-col-name">产品别名</span>
<span class="sh-col sh-col-name">商品别名</span>
<span class="sh-col sh-col-id">产品ID</span>
<span class="sh-col sh-col-price">现售价</span>
<span class="sh-col sh-col-min">最低售价</span>
......
......@@ -97,7 +97,7 @@
class="sub-table-wrapper">
<div class="sub-table-header">
<span class="sh-col sh-col-name">产品名称</span>
<span class="sh-col sh-col-name">产品别名</span>
<span class="sh-col sh-col-name">商品别名</span>
<span class="sh-col sh-col-id">产品ID</span>
<span class="sh-col sh-col-price">现售价</span>
<span class="sh-col sh-col-min">最低售价</span>
......
......@@ -227,7 +227,7 @@
<!-- 子商品表头 -->
<div class="sub-table-header">
<span class="sh-col sh-col-name">产品名称</span>
<span class="sh-col sh-col-name">产品别名</span>
<span class="sh-col sh-col-name">商品别名</span>
<span class="sh-col sh-col-id">产品ID</span>
<span class="sh-col sh-col-price">现售价</span>
<span class="sh-col sh-col-min">最低售价</span>
......
......@@ -112,7 +112,7 @@
</template>
</el-table-column>
<el-table-column align="center"
label="产品别名"
label="商品别名"
width="180">
<template #default="scope">
{{ emptyFilter(scope.row.goodsAlias) }}
......
......@@ -16,6 +16,7 @@
<el-select v-model="form.brandId"
placeholder="请选择品牌"
style="width: 100%"
filterable
@change="handleBrandChange">
<el-option v-for="item in brandList"
:key="item.id"
......@@ -27,6 +28,7 @@
<el-select v-model="form.subBrandId"
placeholder="请选择子品牌"
style="width: 100%"
filterable
:disabled="!form.brandId"
@change="handleSubBrandChange">
<el-option v-for="item in subBrandList"
......@@ -39,6 +41,7 @@
<el-select v-model="form.seriesId"
placeholder="请选择车系"
style="width: 100%"
filterable
:disabled="!form.subBrandId">
<el-option v-for="item in seriesList"
:key="item.id"
......
......@@ -172,9 +172,15 @@ export default {
// 删除标签
handleDeleteTag(row) {
deleteActivityTag({ tagId: row.tagId }).then((res) => {
this.$message.success("删除成功");
this.emitChange();
this.$confirm("确认删除标签?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
deleteActivityTag({ tagId: row.tagId }).then((res) => {
this.$message.success("删除成功");
this.emitChange();
});
});
},
......
......@@ -287,7 +287,7 @@ export default {
mockStatus: "NOT_STARTED",
// 门店分页
storePageNum: 1,
storePageSize: 5,
storePageSize: 10,
// 操作日志分页
logPageNum: 1,
logPageSize: 10,
......
<template>
<glsk-form-dialog
v-if="visible"
:selectVisible="visible"
:dialogConfig="dialogConfig"
label-width="120px"
dialog-width="520px"
defaultWidth="320px"
:formRules="formRules"
:editData="editData"
:editFormData="editFormData"
:baseData="baseData"
@handleClose="$emit('update:visible', false)"
@handleConfirm="handleConfirm"
/>
<glsk-form-dialog v-if="visible"
default-width="320px"
dialog-width="520px"
label-width="120px"
:base-data="baseData"
:dialog-config="dialogConfig"
:edit-data="editData"
:edit-form-data="editFormData"
:form-rules="formRules"
:select-visible="visible"
@handleClose="$emit('update:visible', false)"
@handleConfirm="handleConfirm" />
</template>
<script>
import {
createTagDimension,
updateTagDimension,
queryTagDimensionDetail,
updateTagDimension,
} from "@api/tagManagement";
export default {
......@@ -41,10 +39,6 @@ export default {
type: Array,
default: () => [],
},
defaultCategoryId: {
type: [Number, String],
default: "",
},
},
data() {
return {
......@@ -92,7 +86,7 @@ export default {
placeholder: "请选择所属标签类别",
filterable: true,
optionsName: "categoryOptions",
optionId: "value",
optionId: "id",
optionLabel: "fullPath",
optionList: [],
disabled: this.categoryReadonly,
......@@ -119,13 +113,27 @@ export default {
},
categoryOptions: {
handler(val) {
this.baseData.categoryOptions = val || [];
this.baseData.categoryOptions = (val || []).map(item => ({
...item,
id: item.id != null ? item.id : item.value,
fullPath: item.fullPath || item.categoryName || "",
}));
},
immediate: true,
deep: true,
},
},
methods: {
resolveCategoryId(categoryId) {
if (categoryId == null || categoryId === "") {
return "";
}
const options = this.baseData.categoryOptions || [];
const matched = options.find(
item => String(item.id) === String(categoryId),
);
return matched ? matched.id : categoryId;
},
async initForm() {
if (this.isEdit) {
try {
......@@ -135,7 +143,7 @@ export default {
this.editData = {
id: detail.id,
dimensionName: detail.dimensionName || "",
categoryId: detail.categoryId,
categoryId: this.resolveCategoryId(detail.categoryId),
};
} catch (err) {
this.$message.error(err.message || "获取维度详情失败");
......@@ -143,14 +151,14 @@ export default {
this.editData = {
id: row.id,
dimensionName: row.dimensionName || "",
categoryId: row.categoryId,
categoryId: this.resolveCategoryId(row.categoryId),
};
}
} else {
this.editData = {
id: "",
dimensionName: "",
categoryId: this.defaultCategoryId || "",
categoryId: "",
};
}
},
......
......@@ -84,6 +84,7 @@ export default {
{
label: "标签枚举值名称",
name: "enumName",
labelRequired: true,
type: "input",
placeholder: "请输入",
maxlength: 20,
......@@ -95,6 +96,7 @@ export default {
{
label: "命中客户分",
name: "score",
labelRequired: true,
type: "input",
placeholder: "请输入0~100的整数",
maxlength: 3,
......
......@@ -32,6 +32,13 @@
</el-button>
</template>
</d2-table>
<div class="footer-actions">
<el-button size="medium"
type="primary"
@click="handleBack">
返回
</el-button>
</div>
</div>
<EnumFormDialog :dimension-data="dimensionDetail"
......@@ -186,6 +193,9 @@ export default {
handleEnumFormSuccess() {
this.refreshTable();
},
handleBack() {
this.$router.push({ name: "tagManagement" });
},
},
};
</script>
......@@ -211,5 +221,11 @@ export default {
.d2-container-content {
padding: 16px 20px;
}
.footer-actions {
margin-top: 8px;
padding: 16px 0 8px;
text-align: center;
}
}
</style>
......@@ -69,7 +69,6 @@
:visible.sync="categoryDialogVisible"
@success="handleCategorySuccess" />
<DimensionFormDialog :category-options="dimensionCategoryOptions"
:default-category-id="selectedCategoryId"
:dimension-data="currentDimension"
:mode="dimensionDialogMode"
:visible.sync="dimensionDialogVisible"
......@@ -213,6 +212,31 @@ export default {
this.$refs.dimensionTable.refreshTable();
}
},
findCategoryInTree(list, id) {
for (const item of list || []) {
if (String(item.id) === String(id)) {
return item;
}
if (item.children && item.children.length) {
const found = this.findCategoryInTree(item.children, id);
if (found) {
return found;
}
}
}
return null;
},
syncSelectedCategory() {
if (this.selectedCategoryId === "" || this.selectedCategoryId == null) {
this.selectedCategory = null;
return;
}
const found = this.findCategoryInTree(
this.categoryTree,
this.selectedCategoryId,
);
this.selectedCategory = found;
},
handleAddCategory() {
this.categoryDialogMode = "add";
this.currentCategory = {};
......@@ -260,15 +284,20 @@ export default {
},
});
},
handleCategorySuccess() {
this.loadCategoryTree();
this.loadCategoryLeafOptions();
this.loadDimensionCategoryOptions();
async handleCategorySuccess() {
await this.loadCategoryTree();
this.syncSelectedCategory();
await Promise.all([
this.loadCategoryLeafOptions(),
this.loadDimensionCategoryOptions(),
]);
this.refreshTable();
},
handleDimensionSuccess() {
async handleDimensionSuccess() {
await this.loadCategoryTree();
this.syncSelectedCategory();
await this.loadDimensionCategoryOptions();
this.refreshTable();
this.loadCategoryTree();
this.loadDimensionCategoryOptions();
},
},
};
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!