Commit 9b1085a2 by 张立顺

fix bug修复

1 parent f57bb1a0
...@@ -38,7 +38,7 @@ export const routerName = { ...@@ -38,7 +38,7 @@ export const routerName = {
{ {
authId: "9230102", authId: "9230102",
parentId: "92301", parentId: "92301",
label: "新增行为标签维度", label: "新增标签维度",
category: "Button", category: "Button",
type: "primary", type: "primary",
handle: "handleAddDimension", handle: "handleAddDimension",
......
...@@ -41,37 +41,30 @@ ...@@ -41,37 +41,30 @@
<h3 class="detail-card__title"> <h3 class="detail-card__title">
产品标签({{ productScore }}分) 产品标签({{ productScore }}分)
</h3> </h3>
<div class="field-row"> <template v-if="productDimensions.length">
<span class="field-label">已成交品类:</span> <div
<div class="tag-list"> v-for="(dimension, index) in productDimensions"
<template v-if="purchasedTags.length"> :key="`product-${index}`"
<el-tag class="field-row"
v-for="(tag, index) in purchasedTags" >
:key="`purchased-${index}`" <span class="field-label">{{ dimension.dimensionName }}:</span>
size="small" <div class="tag-list">
class="tag-item" <template v-if="dimension.tags.length">
> <el-tag
{{ tag }} v-for="(tag, tagIndex) in dimension.tags"
</el-tag> :key="`product-tag-${index}-${tagIndex}`"
</template> size="small"
<span v-else class="empty-text">-</span> class="tag-item"
</div> >
</div> {{ tag }}
<div class="field-row"> </el-tag>
<span class="field-label">未成交品类:</span> </template>
<div class="tag-list"> <span v-else class="empty-text">-</span>
<template v-if="unpurchasedTags.length"> </div>
<el-tag
v-for="(tag, index) in unpurchasedTags"
:key="`unpurchased-${index}`"
size="small"
class="tag-item tag-item--plain"
>
{{ 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> </div>
</section> </section>
...@@ -157,9 +150,8 @@ export default { ...@@ -157,9 +150,8 @@ export default {
consumptionScore: 0, consumptionScore: 0,
consumptionDimensions: [], consumptionDimensions: [],
productScore: 0, productScore: 0,
productDimensions: [],
behaviorScore: 0, behaviorScore: 0,
purchasedTags: [],
unpurchasedTags: [],
behaviorTagList: [], behaviorTagList: [],
}, },
}; };
...@@ -177,11 +169,8 @@ export default { ...@@ -177,11 +169,8 @@ export default {
consumptionDimensions() { consumptionDimensions() {
return this.portraitData.consumptionDimensions || []; return this.portraitData.consumptionDimensions || [];
}, },
purchasedTags() { productDimensions() {
return this.portraitData.purchasedTags || []; return this.portraitData.productDimensions || [];
},
unpurchasedTags() {
return this.portraitData.unpurchasedTags || [];
}, },
behaviorTagList() { behaviorTagList() {
return this.portraitData.behaviorTagList || []; return this.portraitData.behaviorTagList || [];
...@@ -225,9 +214,8 @@ export default { ...@@ -225,9 +214,8 @@ export default {
consumptionScore: res.consumptionScore || 0, consumptionScore: res.consumptionScore || 0,
consumptionDimensions: res.consumptionDimensions || [], consumptionDimensions: res.consumptionDimensions || [],
productScore: res.productScore || 0, productScore: res.productScore || 0,
productDimensions: res.productDimensions || [],
behaviorScore: res.behaviorScore || 0, behaviorScore: res.behaviorScore || 0,
purchasedTags: res.purchasedTags || [],
unpurchasedTags: res.unpurchasedTags || [],
behaviorTagList: res.behaviorTagList || [], behaviorTagList: res.behaviorTagList || [],
}; };
}, },
......
...@@ -204,29 +204,34 @@ export function mapProfileResponse(res = {}, snapshotRow = {}) { ...@@ -204,29 +204,34 @@ export function mapProfileResponse(res = {}, snapshotRow = {}) {
}; };
const consumptionTag = res.consumptionTag || {}; const consumptionTag = res.consumptionTag || {};
const productTag = res.productTag || {}; // 接口字段名与 categoryName 语义对调:产品数据在 behaviorTag,行为数据在 productTag
const behaviorTag = res.behaviorTag || {}; const apiProductTag = res.behaviorTag || {};
const apiBehaviorTag = res.productTag || {};
const consumptionDimensions = (consumptionTag.dimensions || []).map((dimension) => ({ const consumptionDimensions = (consumptionTag.dimensions || []).map((dimension) => ({
dimensionName: dimension.dimensionName || "-", dimensionName: dimension.dimensionName || "-",
tags: (dimension.enumValues || []).map((item) => item.enumName).filter(Boolean), tags: (dimension.enumValues || []).map((item) => item.enumName).filter(Boolean),
})); }));
const purchasedTags = (productTag.dealEnumValues || []) const productDimensions = (apiProductTag.dimensions || []).map((dimension) => ({
.map((item) => item.enumName) dimensionName: dimension.dimensionName || "-",
.filter(Boolean); tags: (dimension.enumValues || []).map((item) => item.enumName).filter(Boolean),
const unpurchasedTags = (productTag.noDealEnumValues || []) }));
.map((item) => item.enumName)
.filter(Boolean);
const behaviorTagList = []; const behaviorTagList = [];
(behaviorTag.dimensions || []).forEach((dimension) => { const behaviorCategory = apiBehaviorTag.categoryName || "行为标签";
(dimension.enumValues || []).forEach((enumValue) => { (apiBehaviorTag.dealEnumValues || []).forEach((item) => {
behaviorTagList.push({ behaviorTagList.push({
dimensionName: dimension.dimensionName || "-", dimensionName: behaviorCategory,
enumName: enumValue.enumName || "", enumName: item.enumName || "",
basis: enumValue.scoreBasis || "", basis: item.scoreBasis || "",
}); });
});
(apiBehaviorTag.noDealEnumValues || []).forEach((item) => {
behaviorTagList.push({
dimensionName: behaviorCategory,
enumName: item.enumName || "",
basis: item.scoreBasis || "",
}); });
}); });
...@@ -234,10 +239,9 @@ export function mapProfileResponse(res = {}, snapshotRow = {}) { ...@@ -234,10 +239,9 @@ export function mapProfileResponse(res = {}, snapshotRow = {}) {
basicInfo, basicInfo,
consumptionScore: consumptionTag.totalScore || 0, consumptionScore: consumptionTag.totalScore || 0,
consumptionDimensions, consumptionDimensions,
productScore: productTag.totalScore || 0, productScore: apiProductTag.totalScore || 0,
purchasedTags, productDimensions,
unpurchasedTags, behaviorScore: apiBehaviorTag.totalScore || 0,
behaviorScore: behaviorTag.totalScore || 0,
behaviorTagList, behaviorTagList,
}; };
} }
......
<template> <template>
<glsk-form-dialog <glsk-form-dialog v-if="visible"
v-if="visible" default-width="320px"
:selectVisible="visible" dialog-width="520px"
:dialogConfig="dialogConfig" label-width="100px"
label-width="100px" :base-data="baseData"
dialog-width="520px" :dialog-config="dialogConfig"
defaultWidth="320px" :edit-data="editData"
:formRules="formRules" :edit-form-data="editFormData"
:editData="editData" :form-rules="formRules"
:editFormData="editFormData" :select-visible="visible"
:baseData="baseData" @handleClose="$emit('update:visible', false)"
@handleClose="$emit('update:visible', false)" @handleConfirm="handleConfirm" />
@handleConfirm="handleConfirm"
/>
</template> </template>
<script> <script>
...@@ -54,11 +52,11 @@ export default { ...@@ -54,11 +52,11 @@ export default {
}, },
formRules: { formRules: {
categoryName: [ categoryName: [
{ required: true, message: "请输入类别名称", trigger: "blur" }, { required: true, message: "请输入类别名称" },
{ max: 20, message: "类别名称不能超过20个字符", trigger: "blur" }, { max: 20, message: "类别名称不能超过20个字符" },
], ],
parentId: [ parentId: [
{ required: true, message: "请选择父级分类", trigger: "change" }, { required: true, message: "请选择上级类别" },
], ],
}, },
}; };
...@@ -69,7 +67,7 @@ export default { ...@@ -69,7 +67,7 @@ export default {
}, },
dialogConfig() { dialogConfig() {
return { return {
title: this.isEdit ? "编辑标签分类" : "新增子分类", title: this.isEdit ? "编辑标签分类" : "新增标签类别",
okText: "保存", okText: "保存",
}; };
}, },
...@@ -86,10 +84,10 @@ export default { ...@@ -86,10 +84,10 @@ export default {
]; ];
if (!this.isEdit) { if (!this.isEdit) {
fields.unshift({ fields.unshift({
label: "父级分类", label: "上级类别",
name: "parentId", name: "parentId",
type: "select", type: "select",
placeholder: "请选择父级分类", placeholder: "请选择上级类别",
filterable: true, filterable: true,
optionsName: "parentOptions", optionsName: "parentOptions",
optionId: "id", optionId: "id",
...@@ -108,7 +106,7 @@ export default { ...@@ -108,7 +106,7 @@ export default {
}, },
parentOptions: { parentOptions: {
handler(val) { handler(val) {
this.baseData.parentOptions = (val || []).map((item) => ({ this.baseData.parentOptions = (val || []).map(item => ({
...item, ...item,
fullPath: item.fullPath || item.categoryName, fullPath: item.fullPath || item.categoryName,
})); }));
...@@ -151,7 +149,7 @@ export default { ...@@ -151,7 +149,7 @@ export default {
this.$emit("update:visible", false); this.$emit("update:visible", false);
this.$emit("success"); this.$emit("success");
} catch (err) { } catch (err) {
this.$message.error(err.message || "操作失败"); // this.$message.error(err.message || "操作失败");
} }
}, },
}, },
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<span class="nav-label">{{ item.categoryName }}</span> <span class="nav-label">{{ item.categoryName }}</span>
<i v-if="Number(item.canAddChild) === 1" <i v-if="Number(item.canAddChild) === 1"
class="el-icon-plus action-icon" class="el-icon-plus action-icon"
title="新增子分类" title="新增标签类别"
@click.stop="$emit('add-child', item)" /> @click.stop="$emit('add-child', item)" />
</div> </div>
<template v-if="hasChildren(item) && expandedMap[item.id]"> <template v-if="hasChildren(item) && expandedMap[item.id]">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!