Commit c12ab149 by 张立顺

feat 版本功能开发

1 parent 1dcdcf2e
import request from "./request";
import RequestMethods from "./request.methods";
/** 查询客户画像 */
export function queryCustomerPortrait(data = {}) {
data.method = "dj.api.customer.profile";
data.id = data.id ?? data.customerId;
return request(data, RequestMethods.POST);
}
/** 查询客户群关联 */
export function queryCustomerGroups(data = {}) {
data.method = "dj.api.customer.groupAssoc";
data.id = data.id ?? data.customerId;
return request(data, RequestMethods.POST);
}
import request from "./request";
import RequestMethods from "./request.methods";
const METHOD_PREFIX = "dj.api.strategy.tag.";
/** 查询标签类别树 */
export function queryTagCategoryTree(data = {}) {
data.method = `${METHOD_PREFIX}category.tree`;
return request(data, RequestMethods.POST);
}
/** 查询可新增子级的分类列表 */
export function queryTagCategoryLeafList(data = {}) {
data.method = `${METHOD_PREFIX}category.leaf.list`;
return request(data, RequestMethods.POST);
}
/** 创建标签类别 */
export function createTagCategory(data = {}) {
data.method = `${METHOD_PREFIX}category.create`;
return request(data, RequestMethods.POST);
}
/** 编辑标签类别 */
export function updateTagCategory(data = {}) {
data.method = `${METHOD_PREFIX}category.update`;
return request(data, RequestMethods.POST);
}
/** 分页查询标签维度列表 */
export function queryTagDimension(data = {}) {
data.method = `${METHOD_PREFIX}dimension.query`;
return request(data, RequestMethods.POST);
}
/** 获取新增维度时可选的分类列表 */
export function queryTagDimensionCategoryOptions(data = {}) {
data.method = `${METHOD_PREFIX}dimension.category.options`;
return request(data, RequestMethods.POST);
}
/**
* 查询标签维度详情
* @param {Object} data categoryId — 参数名沿用后端,实际传维度 ID
*/
export function queryTagDimensionDetail(data = {}) {
data.method = `${METHOD_PREFIX}dimension.detail`;
return request(data, RequestMethods.POST);
}
/** 创建标签维度 */
export function createTagDimension(data = {}) {
data.method = `${METHOD_PREFIX}dimension.create`;
return request(data, RequestMethods.POST);
}
/** 编辑标签维度 */
export function updateTagDimension(data = {}) {
data.method = `${METHOD_PREFIX}dimension.update`;
return request(data, RequestMethods.POST);
}
/** 分页查询枚举值列表 */
export function pageTagEnum(data = {}) {
data.method = `${METHOD_PREFIX}enum.page`;
return request(data, RequestMethods.POST);
}
/** 创建标签枚举值 */
export function createTagEnum(data = {}) {
data.method = `${METHOD_PREFIX}enum.create`;
return request(data, RequestMethods.POST);
}
/** 编辑标签枚举值 */
export function updateTagEnum(data = {}) {
data.method = `${METHOD_PREFIX}enum.update`;
return request(data, RequestMethods.POST);
}
const _import = require("@/libs/util.import." + process.env.NODE_ENV) const _import = require("@/libs/util.import." + process.env.NODE_ENV);
export const routerName = { export const routerName = {
902: { 902: {
path: "/flowManage", path: "/flowManage",
...@@ -7,8 +7,8 @@ export const routerName = { ...@@ -7,8 +7,8 @@ export const routerName = {
title: "流量管理", title: "流量管理",
authId: "902", authId: "902",
parentId: "1", parentId: "1",
cache: false cache: false,
} },
}, },
90201: { 90201: {
path: "/customerList", path: "/customerList",
...@@ -17,7 +17,7 @@ export const routerName = { ...@@ -17,7 +17,7 @@ export const routerName = {
title: "客户列表", title: "客户列表",
authId: "90201", authId: "90201",
parentId: "902", parentId: "902",
cache: false cache: false,
}, },
auth: [ auth: [
{ {
...@@ -26,10 +26,49 @@ export const routerName = { ...@@ -26,10 +26,49 @@ export const routerName = {
label: "导出", label: "导出",
category: "Button", category: "Button",
type: "primary", type: "primary",
handle: "handleExport" handle: "handleExport",
} },
{
authId: "9020102",
parentId: "90201",
label: "客户画像",
handle: "handleViewPortrait",
addRoutePath: [
{
authId: "90205",
name: "客户画像",
parentId: "90201",
},
],
},
{
authId: "9020103",
parentId: "90201",
label: "群关联",
handle: "handleViewGroups",
addRoutePath: [
{
authId: "90206",
name: "群关联",
parentId: "90201",
},
],
},
{
authId: "9020104",
parentId: "90201",
label: "订单信息",
handle: "handleViewOrders",
// addRoutePath: [
// {
// authId: "90401",
// name: "订单列表",
// parentId: "904",
// },
// ],
},
], ],
component: _import("customer/customerList") component: _import("customer/customerList"),
}, },
90202: { 90202: {
path: "/recordList", path: "/recordList",
...@@ -38,7 +77,7 @@ export const routerName = { ...@@ -38,7 +77,7 @@ export const routerName = {
title: "预录信息", title: "预录信息",
authId: "90202", authId: "90202",
parentId: "902", parentId: "902",
cache: false cache: false,
}, },
auth: [ auth: [
{ {
...@@ -53,9 +92,9 @@ export const routerName = { ...@@ -53,9 +92,9 @@ export const routerName = {
{ {
authId: "901", authId: "901",
name: "预录客户", name: "预录客户",
parentId: "90202" parentId: "90202",
} },
] ],
}, },
{ {
authId: "9020202", authId: "9020202",
...@@ -63,7 +102,7 @@ export const routerName = { ...@@ -63,7 +102,7 @@ export const routerName = {
label: "一键导入", label: "一键导入",
category: "Button", category: "Button",
type: "primary", type: "primary",
handle: "handleImport" handle: "handleImport",
}, },
{ {
authId: "9020203", authId: "9020203",
...@@ -74,12 +113,12 @@ export const routerName = { ...@@ -74,12 +113,12 @@ export const routerName = {
{ {
authId: "901", authId: "901",
name: "预录客户", name: "预录客户",
parentId: "90202" parentId: "90202",
} },
] ],
} },
], ],
component: _import("customer/recordList") component: _import("customer/recordList"),
}, },
90203: { 90203: {
...@@ -89,14 +128,14 @@ export const routerName = { ...@@ -89,14 +128,14 @@ export const routerName = {
title: "邀约管理", title: "邀约管理",
authId: "90203", authId: "90203",
parentId: "902", parentId: "902",
cache: false cache: false,
}, },
auth: [ auth: [
{ {
authId: "9020301", authId: "9020301",
parentId: "90203", parentId: "90203",
label: "再次电联", label: "再次电联",
handle: "handleMoreCall" handle: "handleMoreCall",
// ruleObj: { // ruleObj: {
// attr: 'status', // attr: 'status',
// rule: { // rule: {
...@@ -109,40 +148,66 @@ export const routerName = { ...@@ -109,40 +148,66 @@ export const routerName = {
authId: "9020302", authId: "9020302",
parentId: "90203", parentId: "90203",
label: "取消预约", label: "取消预约",
handle: "handleCancel" handle: "handleCancel",
}, },
{ {
authId: "9020303", authId: "9020303",
parentId: "90203", parentId: "90203",
label: "更新备注", label: "更新备注",
handle: "handleUpdateRemark" handle: "handleUpdateRemark",
}, },
{ {
authId: "9020304", authId: "9020304",
parentId: "90203", parentId: "90203",
label: "修改时间", label: "修改时间",
handle: "handleChangeTime" handle: "handleChangeTime",
}, },
{ {
authId: "9020305", authId: "9020305",
parentId: "90203", parentId: "90203",
label: "电联一下", label: "电联一下",
handle: "handleCall" handle: "handleCall",
}, },
{ {
authId: "9020306", authId: "9020306",
parentId: "90203", parentId: "90203",
label: "预约时间", label: "预约时间",
handle: "handleAppoint" handle: "handleAppoint",
}, },
{ {
authId: "9020307", authId: "9020307",
parentId: "90203", parentId: "90203",
label: "更新备注", label: "更新备注",
handle: "handleUpdateRemark" handle: "handleUpdateRemark",
} },
], ],
component: _import("customer/invitation") component: _import("customer/invitation"),
},
90205: {
path: "/customerPortrait",
name: "customerPortrait",
meta: {
title: "客户画像",
authId: "90205",
parentId: "90201",
cache: false,
sideHidden: true,
activePath: "/customerList",
},
component: _import("customer/portrait/index"),
},
90206: {
path: "/customerGroupRel",
name: "customerGroupRel",
meta: {
title: "群关联",
authId: "90206",
parentId: "90201",
cache: false,
sideHidden: true,
activePath: "/customerList",
},
component: _import("customer/groupRel/index"),
}, },
901: { 901: {
path: "/editCustomer", path: "/editCustomer",
...@@ -153,10 +218,10 @@ export const routerName = { ...@@ -153,10 +218,10 @@ export const routerName = {
parentId: "90202", parentId: "90202",
cache: false, cache: false,
sideHidden: false, sideHidden: false,
activePath: "/recordList" activePath: "/recordList",
},
component: _import("customer/editCustomer"),
}, },
component: _import("customer/editCustomer") };
}
}
// { routerName } // { routerName }
const _import = require("@/libs/util.import." + process.env.NODE_ENV) const _import = require("@/libs/util.import." + process.env.NODE_ENV);
export const routerName = { export const routerName = {
922: { 922: {
path: "/marketingManagement", path: "/marketingManagement",
...@@ -8,7 +8,7 @@ export const routerName = { ...@@ -8,7 +8,7 @@ export const routerName = {
authId: "922", authId: "922",
parentId: "1", parentId: "1",
cache: false, cache: false,
} },
}, },
92201: { 92201: {
path: "/marketingActivity", path: "/marketingActivity",
...@@ -32,9 +32,9 @@ export const routerName = { ...@@ -32,9 +32,9 @@ export const routerName = {
{ {
authId: "92202", authId: "92202",
name: "新增活动", name: "新增活动",
parentId: "92201" parentId: "92201",
} },
] ],
}, },
{ {
authId: "9220102", authId: "9220102",
...@@ -45,11 +45,11 @@ export const routerName = { ...@@ -45,11 +45,11 @@ export const routerName = {
{ {
authId: "92203", authId: "92203",
name: "订单详情", name: "订单详情",
parentId: "92201" parentId: "92201",
}
]
}, },
] ],
},
],
}, },
92202: { 92202: {
path: "/addMarketingActivity", path: "/addMarketingActivity",
...@@ -62,7 +62,7 @@ export const routerName = { ...@@ -62,7 +62,7 @@ export const routerName = {
sideHidden: true, sideHidden: true,
activePath: "/marketingActivity", activePath: "/marketingActivity",
}, },
component: _import("marketingManagement/marketingActivity/addMarketingActivity") component: _import("marketingManagement/marketingActivity/addMarketingActivity"),
}, },
92203: { 92203: {
path: "/viewMarketingActivity", path: "/viewMarketingActivity",
...@@ -101,7 +101,7 @@ export const routerName = { ...@@ -101,7 +101,7 @@ export const routerName = {
authId: "9220106", authId: "9220106",
parentId: "92203", parentId: "92203",
label: "恢复", label: "恢复",
handle: "handleToggleStatus" handle: "handleToggleStatus",
}, },
{ {
authId: "9220107", authId: "9220107",
...@@ -119,8 +119,8 @@ export const routerName = { ...@@ -119,8 +119,8 @@ export const routerName = {
authId: "9220109", authId: "9220109",
parentId: "92203", parentId: "92203",
label: "再次创建", label: "再次创建",
handle: "handleRecreate" handle: "handleRecreate",
} },
] ],
} },
} };
const _import = require("@/libs/util.import." + process.env.NODE_ENV);
export const routerName = {
923: {
path: "/tagManagement",
name: "tagManagementGroup",
meta: {
title: "标签管理",
authId: "923",
parentId: "1",
cache: false,
},
},
92301: {
path: "/tagManagementList",
name: "tagManagement",
meta: {
title: "标签管理",
authId: "92301",
parentId: "923",
cache: false,
},
addRoutePath: [
{
authId: "92302",
name: "维护枚举值",
parentId: "92301",
},
],
auth: [
{
authId: "9230101",
parentId: "92301",
label: "新增子分类",
category: "Button",
type: "primary",
handle: "handleAddCategory",
},
{
authId: "9230102",
parentId: "92301",
label: "新增行为标签维度",
category: "Button",
type: "primary",
handle: "handleAddDimension",
},
{
authId: "9230103",
parentId: "92301",
label: "编辑",
handle: "handleEditCategory",
},
{
authId: "9230104",
parentId: "92301",
label: "新增枚举",
handle: "handleAddEnum",
},
{
authId: "9230105",
parentId: "92301",
label: "编辑",
handle: "handleEditDimension",
},
{
authId: "9230106",
parentId: "92301",
label: "编辑枚举",
handle: "handleEditEnum",
},
{
authId: "9230108",
parentId: "92301",
label: "维护枚举值",
handle: "handleMaintainEnum",
addRoutePath: [
{
authId: "92302",
name: "维护枚举值",
parentId: "92301",
},
],
},
],
component: _import("tagCustomerManagement/tagManagement/index"),
},
92302: {
path: "/tagEnumMaintain",
name: "tagEnumMaintain",
meta: {
title: "维护枚举值",
authId: "92302",
parentId: "92301",
cache: false,
sideHidden: true,
activePath: "/tagManagementList",
},
auth: [
{
authId: "9230104",
parentId: "92302",
label: "新增枚举值",
category: "Button",
type: "primary",
handle: "handleAddEnum",
},
{
authId: "9230106",
parentId: "92302",
label: "编辑枚举",
handle: "handleEditEnum",
},
],
component: _import("tagCustomerManagement/tagManagement/enumMaintain/index"),
},
};
<template>
<section class="detail-card">
<h3 class="detail-card__title">
基础信息
</h3>
<el-row :gutter="16">
<el-col
v-for="item in fieldList"
:key="item.prop"
class="detail-row"
:span="item.span || 8"
>
<span class="detail-label">{{ item.label }}:</span>
<span class="detail-value">{{ displayInfo[item.prop] || "-" }}</span>
</el-col>
</el-row>
</section>
</template>
<script>
import { mapBasicInfoFromRow } from "../utils/customerSnapshot";
const DEFAULT_STATUS_LIST = [
{ confId: 1, confLabel: "未完成" },
{ confId: 2, confLabel: "已完成" },
{ confId: 3, confLabel: "已评价" },
];
export default {
name: "CustomerBasicInfoCard",
props: {
customerRow: {
type: Object,
default: () => ({}),
},
basicInfo: {
type: Object,
default: () => ({}),
},
statusList: {
type: Array,
default: () => DEFAULT_STATUS_LIST,
},
},
computed: {
displayInfo() {
const fromRow = mapBasicInfoFromRow(this.customerRow, this.statusList);
if (this.basicInfo && Object.keys(this.basicInfo).length) {
return {
...fromRow,
...this.basicInfo,
// 客户分类、客户状态仅来自列表行数据,详情接口不返回
customerCategory: fromRow.customerCategory,
customerStatus: fromRow.customerStatus,
};
}
return fromRow;
},
fieldList() {
return [
{ label: "客户姓名", prop: "customerName" },
{ label: "手机号", prop: "mobile" },
{ label: "客户分类", prop: "customerCategory" },
{ label: "品牌车型", prop: "carModel" },
{ label: "客户状态", prop: "customerStatus" },
{ label: "服务时间", prop: "serviceTime" },
{ label: "备注", prop: "remark", span: 24 },
{ label: "流量来源", prop: "trafficSource" },
{ label: "推荐人", prop: "referrer" },
{ label: "园区店", prop: "parkStore" },
{ label: "转化专员", prop: "conversionStaff" },
{ label: "群关联信息", prop: "groupRelInfo" },
{ label: "创建方式", prop: "createMethod" },
{ label: "创建时间", prop: "createTime" },
{ label: "交车时间", prop: "deliveryTime" },
];
},
},
};
</script>
<style lang="scss" scoped>
.detail-card {
background: #fff;
border-radius: 4px;
padding: 16px 20px 8px;
margin-bottom: 12px;
&__title {
margin: 0 0 16px;
padding-left: 10px;
border-left: 3px solid #409eff;
font-size: 14px;
font-weight: 600;
color: #303133;
line-height: 20px;
}
}
.detail-row {
margin-bottom: 14px;
font-size: 14px;
line-height: 22px;
}
.detail-label {
color: #606266;
}
.detail-value {
color: #303133;
word-break: break-all;
}
</style>
...@@ -17,68 +17,67 @@ ...@@ -17,68 +17,67 @@
<span slot="left">客户列表记录{{ count.orderCount }}条。</span> <span slot="left">客户列表记录{{ count.orderCount }}条。</span>
<auth-button category="Button" /> <auth-button category="Button" />
</d2-table-header> </d2-table-header>
<el-table :data="tableData"> <el-table :data="tableData" border>
<el-table-column label="序号" width="60px" type="index" align="center" /> <el-table-column label="序号" width="60" type="index" align="center" />
<el-table-column label="客户信息"> <el-table-column label="客户姓名" prop="customerName" align="center" width="100" />
<el-table-column label="客户姓名" prop="customerName" align="center" /> <el-table-column label="手机号" align="center" width="120">
<el-table-column label="性别" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.customerSex === 1 ? '男' : '女' }}</span> <span>{{ formatListPhone(scope.row) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="品牌车型" align="center" width="150px"> <el-table-column label="客户分类" align="center" width="90">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.carBrand || '' }}{{ scope.row.carSeriesName ? ('-' + scope.row.carSeriesName) : '' }}{{ <span>{{ formatCustomerClass(scope.row) }}</span>
scope.row.carTypeName ? ('-' + scope.row.carTypeName) : '' }}</span>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column label="车架号" <el-table-column label="客户状态" align="center" width="90">
align="center"
prop="standNo" /> -->
<el-table-column label="客户状态" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<!-- <span <span :class="{ 'red': scope.row.status === 1 }">{{ formatCustomerStatusLabel(scope.row) }}</span>
class="red"
v-if="customerStatusObj[1].includes(scope.row.status)"
>未完成</span>
<span v-else>已完成</span> -->
<span :class="{ 'red': scope.row.status === 1 }">{{ baseData.customerStatusList.find(item => item.confId ==
scope.row.status).confLabel }}</span>
<!-- <span>{{scope.row.status}}</span> -->
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="服务时间" align="center"> <el-table-column label="车型" align="center" min-width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.order ? (!scope.row.order.installUpgradeTime ? '' : new <span>{{ formatCarModelForList(scope.row) }}</span>
Date(scope.row.order.installUpgradeTime).toLocaleDateString()) : '' }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注信息" align="center" prop="order.remark"> <el-table-column label="交付时间" align="center" width="110">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.order ? (scope.row.order.upgradeFlag === 'N' ? (scope.row.order.customer ? <span>{{ formatDeliveryTime(scope.row) }}</span>
(scope.row.order.customer.refusalReason || '无') : '无') : (scope.row.order.remark || '无')) : '无' }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="群关联信息" align="center" width="90">
<template slot-scope="scope">
<span>{{ formatGroupStatus(scope.row) }}</span>
</template>
</el-table-column> </el-table-column>
<el-table-column label="关联信息"> <el-table-column label="所属门店" align="center" prop="merchantName" min-width="150" />
<el-table-column label="流量来源" align="center" prop="merchantName" width="170" /> <el-table-column label="推荐人" align="center" width="100">
<el-table-column label="推荐人" align="center" prop="employeeName">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.order ? scope.row.order.employeeName : '' }}</span> <span>{{ formatReferrer(scope.row) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="园区店" align="center" prop="yqMerchantName" width="170px" /> <el-table-column label="所属园区店" align="center" prop="yqMerchantName" min-width="150" />
<el-table-column label="转化专员" align="center" prop="order.sellerName" /> <el-table-column label="录入人" align="center" width="100">
<template slot-scope="scope">
<span>{{ formatRecorder(scope.row) }}</span>
</template>
</el-table-column> </el-table-column>
<el-table-column label="创建时间" align="center"> <el-table-column label="录入时间" align="center" width="110">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ new Date(scope.row.createdDate).toLocaleDateString() }}</span> <span>{{ formatCreateTime(scope.row) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="创建方式" align="center" prop="source"> <el-table-column label="操作" align="center" width="220" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.order ? (scope.row.order.source === 3 ? '现场升级' : (scope.row.order.source === 5 ? '核销抵扣' : <span class="op-btn">
'系统录入')) : (scope.row.source === 3 ? '现场升级' : (scope.row.source === 5 ? '核销抵扣' : '系统录入')) }}</span> <auth-button :data="scope.row" :show-btn-ids="['9020102']" />
</span>
<span class="op-btn">
<auth-button :data="scope.row" :show-btn-ids="['9020103']" />
</span>
<span class="op-btn">
<auth-button :data="scope.row" :show-btn-ids="['9020104']" />
</span>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -93,6 +92,18 @@ ...@@ -93,6 +92,18 @@
// exportFile // exportFile
import { getList, orderCount } from '@api/customerList' import { getList, orderCount } from '@api/customerList'
import { getServiceStore, getParkStore } from '@api/editCustomer' import { getServiceStore, getParkStore } from '@api/editCustomer'
import {
saveCustomerSnapshot,
formatListPhone,
formatCustomerClass,
formatCarModelForList,
formatDeliveryTime,
formatGroupStatus,
formatReferrer,
formatRecorder,
formatCreateTime,
formatCustomerStatus
} from './utils/customerSnapshot'
// import { asyncExportExcel } from '@api/sys.base' // import { asyncExportExcel } from '@api/sys.base'
import { mapActions, mapState } from 'vuex' import { mapActions, mapState } from 'vuex'
export default { export default {
...@@ -263,6 +274,17 @@ export default { ...@@ -263,6 +274,17 @@ export default {
methods: { methods: {
...mapActions('d2admin/user', ['actionSetDownloadList']), ...mapActions('d2admin/user', ['actionSetDownloadList']),
formatListPhone,
formatCustomerClass,
formatCarModelForList,
formatDeliveryTime,
formatGroupStatus,
formatReferrer,
formatRecorder,
formatCreateTime,
formatCustomerStatusLabel(row) {
return formatCustomerStatus(row, this.baseData.customerStatusList)
},
getParams() { getParams() {
var params = { var params = {
merchantId: this.searchForm.merchantId, merchantId: this.searchForm.merchantId,
...@@ -380,6 +402,53 @@ export default { ...@@ -380,6 +402,53 @@ export default {
] ]
this.actionSetDownloadList({ list, type: 'dowloadList' }) this.actionSetDownloadList({ list, type: 'dowloadList' })
// }) // })
},
handleViewPortrait(row) {
if (!row || row.id == null) {
this.$message.warning('缺少客户信息')
return
}
saveCustomerSnapshot(row)
this.$router.push({
name: 'customerPortrait',
query: {
customerId: row.id,
customerClass: row.customerClass || '',
status: row.status != null ? String(row.status) : '',
},
})
},
handleViewGroups(row) {
if (!row || row.id == null) {
this.$message.warning('缺少客户信息')
return
}
saveCustomerSnapshot(row)
this.$router.push({
name: 'customerGroupRel',
query: {
customerId: row.id,
customerClass: row.customerClass || '',
status: row.status != null ? String(row.status) : '',
},
})
},
handleViewOrders(row) {
if (!row || row.id == null) {
this.$message.warning('缺少客户信息')
return
}
this.$router.push({
name: 'orderList',
params: {
tabPane: '1',
tabLabel: 'order',
},
query: {
customerName: row.customerName || '',
customerPhone: formatListPhone(row) || '',
},
})
} }
} }
} }
...@@ -414,4 +483,8 @@ export default { ...@@ -414,4 +483,8 @@ export default {
.customer-list p { .customer-list p {
margin: 0 0; margin: 0 0;
} }
.customer-list .op-btn {
margin-right: 8px;
}
</style> </style>
<template>
<d2-container v-loading="pageLoading" class="customer-group-rel-page">
<div class="page-content">
<CustomerBasicInfoCard
:customer-row="customerRow"
:basic-info="groupData.basicInfo"
/>
<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>
</template>
<script>
import { queryCustomerGroups } from "@api/customerDetail";
import CustomerBasicInfoCard from "../components/CustomerBasicInfoCard.vue";
import { loadCustomerSnapshot, mapGroupAssocResponse, resolveCustomerRowFromRoute } from "../utils/customerSnapshot";
export default {
name: "CustomerGroupRel",
components: { CustomerBasicInfoCard },
data() {
return {
pageLoading: false,
customerId: "",
customerRow: {},
groupData: {
basicInfo: {},
groupRelStatus: "",
groupName: "",
groupMemberCustomer: "",
},
};
},
computed: {
groupFieldList() {
return [
{ label: "群关联状态", prop: "groupRelStatus" },
{ label: "群名称", prop: "groupName" },
{ label: "群成员-客户", prop: "groupMemberCustomer" },
];
},
displayGroupInfo() {
return {
groupRelStatus: this.groupData.groupRelStatus || "未关联",
groupName: this.groupData.groupName || "",
groupMemberCustomer: this.groupData.groupMemberCustomer || "",
};
},
},
created() {
this.customerId = this.$route.query.customerId;
if (!this.customerId) {
this.$message.warning("缺少客户参数");
this.$router.back();
return;
}
this.customerRow = resolveCustomerRowFromRoute(
this.$route,
loadCustomerSnapshot()
);
this.loadGroupInfo();
},
methods: {
async loadGroupInfo() {
this.pageLoading = true;
try {
const res = await queryCustomerGroups({
id: this.customerId,
});
this.applyGroupData(mapGroupAssocResponse(res || {}, this.customerRow));
} catch (err) {
this.$message.error(err.message || "加载群关联失败");
this.applyGroupData(mapGroupAssocResponse({}, this.customerRow));
} finally {
this.pageLoading = false;
}
},
applyGroupData(res) {
this.groupData = {
basicInfo: res.basicInfo || {},
groupRelStatus: res.groupRelStatus || "未关联",
groupName: res.groupName || "",
groupMemberCustomer: res.groupMemberCustomer || "",
};
},
handleBack() {
this.$router.push({ name: "customerList" });
},
},
};
</script>
<style lang="scss" scoped>
.customer-group-rel-page {
::v-deep .d2-container-full__body {
padding: 0 !important;
background: #f0f2f5;
}
.page-content {
width: 100%;
box-sizing: border-box;
padding: 12px 20px 32px;
}
.detail-card {
background: #fff;
border: 1px solid #ebeef5;
border-radius: 4px;
padding: 16px 20px;
margin-bottom: 12px;
&__title {
margin: 0 0 16px;
padding-left: 10px;
border-left: 3px solid #409eff;
font-size: 14px;
font-weight: 600;
color: #303133;
line-height: 20px;
}
}
.field-row {
display: flex;
align-items: flex-start;
margin-bottom: 14px;
font-size: 14px;
line-height: 22px;
&:last-child {
margin-bottom: 0;
}
}
.field-label {
flex-shrink: 0;
min-width: 110px;
color: #606266;
}
.field-value {
flex: 1;
color: #303133;
word-break: break-all;
}
.footer-actions {
margin-top: 8px;
padding: 16px 0 8px;
text-align: center;
}
}
</style>
<template>
<d2-container v-loading="pageLoading" class="customer-portrait-page">
<div class="page-content">
<CustomerBasicInfoCard
:customer-row="customerRow"
:basic-info="portraitData.basicInfo"
/>
<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">
产品标签({{ productScore }}分)
</h3>
<div class="field-row">
<span class="field-label">已成交品类:</span>
<div class="tag-list">
<template v-if="purchasedTags.length">
<el-tag
v-for="(tag, index) in purchasedTags"
:key="`purchased-${index}`"
size="small"
class="tag-item"
>
{{ tag }}
</el-tag>
</template>
<span v-else class="empty-text">-</span>
</div>
</div>
<div class="field-row">
<span class="field-label">未成交品类:</span>
<div class="tag-list">
<template v-if="unpurchasedTags.length">
<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>
</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>
<div class="footer-actions">
<el-button type="primary" size="medium" @click="handleBack">
返回
</el-button>
</div>
</div>
</d2-container>
</template>
<script>
import { queryCustomerPortrait } from "@api/customerDetail";
import CustomerBasicInfoCard from "../components/CustomerBasicInfoCard.vue";
import {
loadCustomerSnapshot,
mapProfileResponse,
resolveCustomerRowFromRoute,
} from "../utils/customerSnapshot";
export default {
name: "CustomerPortrait",
components: { CustomerBasicInfoCard },
data() {
return {
pageLoading: false,
customerId: "",
customerRow: {},
portraitData: {
basicInfo: {},
consumptionScore: 0,
consumptionDimensions: [],
productScore: 0,
behaviorScore: 0,
purchasedTags: [],
unpurchasedTags: [],
behaviorTagList: [],
},
};
},
computed: {
consumptionScore() {
return this.portraitData.consumptionScore || 0;
},
productScore() {
return this.portraitData.productScore || 0;
},
behaviorScore() {
return this.portraitData.behaviorScore || 0;
},
consumptionDimensions() {
return this.portraitData.consumptionDimensions || [];
},
purchasedTags() {
return this.portraitData.purchasedTags || [];
},
unpurchasedTags() {
return this.portraitData.unpurchasedTags || [];
},
behaviorTagList() {
return this.portraitData.behaviorTagList || [];
},
},
created() {
this.customerId = this.$route.query.customerId;
if (!this.customerId) {
this.$message.warning("缺少客户参数");
this.$router.back();
return;
}
this.customerRow = resolveCustomerRowFromRoute(
this.$route,
loadCustomerSnapshot()
);
this.loadPortrait();
},
methods: {
async loadPortrait() {
this.pageLoading = true;
try {
const res = await queryCustomerPortrait({
id: this.customerId,
});
this.applyPortraitData(
mapProfileResponse(res || {}, this.customerRow)
);
} catch (err) {
this.$message.error(err.message || "加载客户画像失败");
this.applyPortraitData(
mapProfileResponse({}, this.customerRow)
);
} finally {
this.pageLoading = false;
}
},
applyPortraitData(res) {
this.portraitData = {
basicInfo: res.basicInfo || {},
consumptionScore: res.consumptionScore || 0,
consumptionDimensions: res.consumptionDimensions || [],
productScore: res.productScore || 0,
behaviorScore: res.behaviorScore || 0,
purchasedTags: res.purchasedTags || [],
unpurchasedTags: res.unpurchasedTags || [],
behaviorTagList: res.behaviorTagList || [],
};
},
handleBack() {
this.$router.push({ name: "customerList" });
},
},
};
</script>
<style lang="scss" scoped>
.customer-portrait-page {
::v-deep .d2-container-full__body {
padding: 0 !important;
background: #f0f2f5;
}
.page-content {
width: 100%;
box-sizing: border-box;
padding: 12px 20px 32px;
}
.detail-card {
background: #fff;
border: 1px solid #ebeef5;
border-radius: 4px;
padding: 16px 20px;
margin-bottom: 12px;
&__title {
margin: 0 0 16px;
padding-left: 10px;
border-left: 3px solid #409eff;
font-size: 14px;
font-weight: 600;
color: #303133;
line-height: 20px;
}
}
.field-row {
display: flex;
align-items: flex-start;
margin-bottom: 12px;
font-size: 14px;
line-height: 22px;
&:last-child {
margin-bottom: 0;
}
}
.field-label {
flex-shrink: 0;
min-width: 90px;
color: #606266;
}
.tag-list {
display: flex;
flex-wrap: wrap;
gap: 8px;
flex: 1;
}
.tag-item {
background: #ecf5ff;
border-color: #d9ecff;
color: #409eff;
&--plain {
background: #f4f4f5;
border-color: #e9e9eb;
color: #909399;
}
}
.empty-text {
color: #909399;
}
.behavior-table {
width: 100%;
}
.basis-text {
display: inline-block;
word-break: break-all;
white-space: pre-wrap;
line-height: 20px;
color: #606266;
}
.footer-actions {
margin-top: 8px;
padding: 16px 0 8px;
text-align: center;
}
}
</style>
const SNAPSHOT_KEY = "customerDetailSnapshot";
export function saveCustomerSnapshot(row) {
if (!row) {
return;
}
try {
sessionStorage.setItem(SNAPSHOT_KEY, JSON.stringify(row));
} catch (err) {
// ignore quota errors
}
}
export function loadCustomerSnapshot() {
try {
const raw = sessionStorage.getItem(SNAPSHOT_KEY);
return raw ? JSON.parse(raw) : {};
} catch (err) {
return {};
}
}
/** 合并列表行快照与路由参数,客户分类仅来自列表数据 */
export function resolveCustomerRowFromRoute(route = {}, snapshotRow = {}) {
const row = { ...snapshotRow };
if (route.query && route.query.customerClass) {
row.customerClass = route.query.customerClass;
}
if (route.query && route.query.status !== undefined && route.query.status !== "") {
row.status = route.query.status;
}
return row;
}
function formatDateValue(value) {
if (!value) {
return "";
}
return new Date(value).toLocaleDateString();
}
export function formatCarModel(row = {}) {
const carModel = (row.carModel || "").trim();
if (carModel) {
return carModel;
}
const parts = [row.carBrand, row.carSeriesName, row.carTypeName]
.map((item) => (item || "").trim())
.filter(Boolean);
return parts.length ? parts.join("-") : "";
}
export function formatCarModelForList(row = {}) {
const value = formatCarModel(row);
return value || "";
}
export function formatListPhone(row = {}) {
return row.customerPhone || row.mobile || row.phone || row.phoneNumber || "";
}
export function formatCustomerClass(row = {}) {
const customerClass = row.customerClass || row.customerCategory;
if (!customerClass) {
return "";
}
const normalized = String(customerClass).trim().toUpperCase();
if (normalized === "A" || normalized === "A类") {
return "A类";
}
if (normalized === "B" || normalized === "B类") {
return "B类";
}
if (normalized === "C" || normalized === "C类") {
return "C类";
}
return String(customerClass);
}
export function formatGroupStatus(row = {}) {
if (row.groupStatus === true || row.groupStatus === "已关联") {
return "已关联";
}
return "未关联";
}
export function formatDeliveryTime(row = {}) {
const time = row.deliveryDate
|| row.deliveryTime
|| row.buyTimeStr
|| (row.order && row.order.installUpgradeTime);
return formatDateValue(time);
}
export function formatRecorder(row = {}) {
return row.userName || row.advanceUserName || row.createdBy || "";
}
export function formatReferrer(row = {}) {
return row.referrerName
|| row.employeeName
|| (row.order && row.order.employeeName)
|| "";
}
export function formatCustomerStatus(row = {}, statusList = []) {
const status = row.status;
if (status == null || status === "") {
return "-";
}
const matched = statusList.find((item) => Number(item.confId) === Number(status));
return matched ? matched.confLabel : "-";
}
export function formatServiceTime(row = {}) {
const time = row.order && row.order.installUpgradeTime;
if (!time) {
return "-";
}
return new Date(time).toLocaleDateString();
}
export function formatRemark(row = {}) {
if (!row.order) {
return "无";
}
if (row.order.upgradeFlag === "N") {
return row.order.customer
? (row.order.customer.refusalReason || "无")
: "无";
}
return row.order.remark || "无";
}
export function formatSource(row = {}) {
const source = row.order ? row.order.source : row.source;
if (source === 3) {
return "现场升级";
}
if (source === 5) {
return "核销抵扣";
}
return "系统录入";
}
export function formatCreateTime(row = {}) {
if (!row.createdDate) {
return "";
}
return formatDateValue(row.createdDate);
}
export function mapBasicInfoFromRow(row = {}, statusList = []) {
const deliveryTime = formatDeliveryTime(row);
const referrer = formatReferrer(row);
const recorder = formatRecorder(row);
return {
customerName: row.customerName || "-",
mobile: formatListPhone(row) || "-",
customerCategory: formatCustomerClass(row) || "-",
carModel: formatCarModel(row) || "-",
customerStatus: formatCustomerStatus(row, statusList),
serviceTime: formatServiceTime(row),
remark: formatRemark(row),
trafficSource: row.merchantName || "-",
referrer: referrer || "-",
parkStore: row.yqMerchantName || "-",
conversionStaff: (row.order && row.order.sellerName) || "-",
groupRelInfo: formatGroupStatus(row),
createMethod: formatSource(row),
createTime: formatCreateTime(row) || "-",
deliveryTime: deliveryTime || "-",
recorder: recorder || "-",
};
}
function buildProfileCarModel(res = {}) {
const carModel = (res.carModel || "").trim();
if (carModel) {
return carModel;
}
const parts = [res.carBrand, res.carSeriesName]
.map((item) => (item || "").trim())
.filter(Boolean);
return parts.length ? parts.join("-") : "";
}
export function mapProfileResponse(res = {}, snapshotRow = {}) {
const snapshotBasic = mapBasicInfoFromRow(snapshotRow);
const deliveryTime = res.deliveryDate
? formatDateValue(res.deliveryDate)
: snapshotBasic.deliveryTime;
const basicInfo = {
...snapshotBasic,
customerName: res.customerName || snapshotBasic.customerName,
mobile: res.customerPhone || snapshotBasic.mobile,
carModel: buildProfileCarModel(res) || snapshotBasic.carModel,
trafficSource: res.merchantName || snapshotBasic.trafficSource,
deliveryTime: deliveryTime || "-",
// 客户分类、客户状态仅来自列表接口,详情接口不返回
customerCategory: snapshotBasic.customerCategory,
customerStatus: snapshotBasic.customerStatus,
};
const consumptionTag = res.consumptionTag || {};
const productTag = res.productTag || {};
const behaviorTag = res.behaviorTag || {};
const consumptionDimensions = (consumptionTag.dimensions || []).map((dimension) => ({
dimensionName: dimension.dimensionName || "-",
tags: (dimension.enumValues || []).map((item) => item.enumName).filter(Boolean),
}));
const purchasedTags = (productTag.dealEnumValues || [])
.map((item) => item.enumName)
.filter(Boolean);
const unpurchasedTags = (productTag.noDealEnumValues || [])
.map((item) => item.enumName)
.filter(Boolean);
const behaviorTagList = [];
(behaviorTag.dimensions || []).forEach((dimension) => {
(dimension.enumValues || []).forEach((enumValue) => {
behaviorTagList.push({
dimensionName: dimension.dimensionName || "-",
enumName: enumValue.enumName || "",
basis: enumValue.scoreBasis || "",
});
});
});
return {
basicInfo,
consumptionScore: consumptionTag.totalScore || 0,
consumptionDimensions,
productScore: productTag.totalScore || 0,
purchasedTags,
unpurchasedTags,
behaviorScore: behaviorTag.totalScore || 0,
behaviorTagList,
};
}
export function mapGroupAssocResponse(res = {}, snapshotRow = {}) {
const snapshotBasic = mapBasicInfoFromRow(snapshotRow);
const groupRelStatus = res.groupStatus || "未关联";
const basicInfo = {
...snapshotBasic,
customerName: res.customerName || snapshotBasic.customerName,
mobile: res.customerPhone || snapshotBasic.mobile,
// 客户分类、客户状态仅来自列表接口,详情接口不返回
customerCategory: snapshotBasic.customerCategory,
customerStatus: snapshotBasic.customerStatus,
// 接口返回后同步基础信息中的群关联状态
groupRelInfo: groupRelStatus,
};
return {
basicInfo,
groupRelStatus,
groupName: res.qwGroupName || "",
groupMemberCustomer: res.wxName || "",
};
}
...@@ -462,6 +462,11 @@ export default { ...@@ -462,6 +462,11 @@ export default {
type: [Number, String], type: [Number, String],
default: undefined, default: undefined,
}, },
/** 客户列表跳转带入的姓名/手机号筛选 */
customerFilter: {
type: Object,
default: null,
},
}, },
components: { components: {
ChooseRuleDialog: chooseRuleDialog, ChooseRuleDialog: chooseRuleDialog,
...@@ -529,6 +534,14 @@ export default { ...@@ -529,6 +534,14 @@ export default {
keyFn: this.keyDowmGetList, keyFn: this.keyDowmGetList,
}, },
{ {
label: "手机号",
name: "customerPhone",
type: "input",
isClear: true,
maxlength: 11,
keyFn: this.keyDowmGetList,
},
{
label: "订单编号", label: "订单编号",
name: "orderCode", name: "orderCode",
type: "input", type: "input",
...@@ -764,6 +777,7 @@ export default { ...@@ -764,6 +777,7 @@ export default {
status: "", status: "",
upgradeFinishFlag: "", upgradeFinishFlag: "",
customerName: "", customerName: "",
customerPhone: "",
yqMerchantIds: "", yqMerchantIds: "",
merchantId: "", merchantId: "",
orderTime: "", orderTime: "",
...@@ -979,6 +993,18 @@ export default { ...@@ -979,6 +993,18 @@ export default {
}, },
}, },
watch: { watch: {
customerFilter: {
handler(val) {
if (!val || (!val.customerName && !val.customerPhone)) {
return;
}
this.searchForm.customerName = val.customerName || "";
this.searchForm.customerPhone = val.customerPhone || "";
this.page.pageNum = 1;
this.handleSearch();
},
immediate: true,
},
updateRefesh(val) { updateRefesh(val) {
// console.log('val', val) // console.log('val', val)
if (val == true) { if (val == true) {
...@@ -1060,8 +1086,12 @@ export default { ...@@ -1060,8 +1086,12 @@ export default {
this.signRefundFlag = true; // 是否有标记退款权限 this.signRefundFlag = true; // 是否有标记退款权限
} }
this.getBaseData(); this.getBaseData();
const hasCustomerFilter = this.customerFilter
&& (this.customerFilter.customerName || this.customerFilter.customerPhone);
if (!hasCustomerFilter) {
this.getList(); this.getList();
this.getOrderCount(); this.getOrderCount();
}
this.getProvinceList(); this.getProvinceList();
// 获取全部类目 // 获取全部类目
getAllCategory({ pageSize: 9999, currentPage: 1 }).then((res) => { getAllCategory({ pageSize: 9999, currentPage: 1 }).then((res) => {
...@@ -1145,6 +1175,7 @@ export default { ...@@ -1145,6 +1175,7 @@ export default {
status: "", status: "",
upgradeFinishFlag: "", upgradeFinishFlag: "",
customerName: "", customerName: "",
customerPhone: "",
yqMerchantIds: "", yqMerchantIds: "",
merchantId: "", merchantId: "",
orderTime: "", orderTime: "",
......
...@@ -220,6 +220,13 @@ export default { ...@@ -220,6 +220,13 @@ export default {
if (this.tabName === "carDamage" && this.carDamageRightsNavPreset) { if (this.tabName === "carDamage" && this.carDamageRightsNavPreset) {
base.rightsNavPreset = this.carDamageRightsNavPreset base.rightsNavPreset = this.carDamageRightsNavPreset
} }
const { customerName, customerPhone } = this.$route.query
if (customerName || customerPhone) {
base.customerFilter = {
customerName: customerName || "",
customerPhone: customerPhone || "",
}
}
return base return base
} }
}, },
......
<template>
<glsk-form-dialog
v-if="visible"
:selectVisible="visible"
:dialogConfig="dialogConfig"
label-width="100px"
dialog-width="520px"
defaultWidth="320px"
:formRules="formRules"
:editData="editData"
:editFormData="editFormData"
:baseData="baseData"
@handleClose="$emit('update:visible', false)"
@handleConfirm="handleConfirm"
/>
</template>
<script>
import { createTagCategory, updateTagCategory } from "@api/tagManagement";
export default {
name: "CategoryFormDialog",
props: {
visible: {
type: Boolean,
default: false,
},
mode: {
type: String,
default: "add",
},
categoryData: {
type: Object,
default: () => ({}),
},
parentOptions: {
type: Array,
default: () => [],
},
defaultParentId: {
type: [Number, String],
default: "",
},
},
data() {
return {
editData: {
id: "",
categoryName: "",
parentId: "",
},
baseData: {
parentOptions: [],
},
formRules: {
categoryName: [
{ required: true, message: "请输入类别名称", trigger: "blur" },
{ max: 20, message: "类别名称不能超过20个字符", trigger: "blur" },
],
parentId: [
{ required: true, message: "请选择父级分类", trigger: "change" },
],
},
};
},
computed: {
isEdit() {
return this.mode === "edit";
},
dialogConfig() {
return {
title: this.isEdit ? "编辑标签分类" : "新增子分类",
okText: "保存",
};
},
editFormData() {
const fields = [
{
label: "类别名称",
name: "categoryName",
type: "input",
placeholder: "请输入类别名称",
maxlength: 20,
isClear: true,
},
];
if (!this.isEdit) {
fields.unshift({
label: "父级分类",
name: "parentId",
type: "select",
placeholder: "请选择父级分类",
filterable: true,
optionsName: "parentOptions",
optionId: "id",
optionLabel: "fullPath",
optionList: [],
});
}
return fields;
},
},
watch: {
visible(val) {
if (val) {
this.initForm();
}
},
parentOptions: {
handler(val) {
this.baseData.parentOptions = (val || []).map((item) => ({
...item,
fullPath: item.fullPath || item.categoryName,
}));
},
immediate: true,
deep: true,
},
},
methods: {
initForm() {
if (this.isEdit) {
const row = this.categoryData || {};
this.editData = {
id: row.id,
categoryName: row.categoryName || "",
parentId: row.parentId,
};
} else {
this.editData = {
id: "",
categoryName: "",
parentId: this.defaultParentId || "",
};
}
},
async handleConfirm() {
try {
const payload = {
categoryName: (this.editData.categoryName || "").trim(),
};
if (this.isEdit) {
payload.id = this.editData.id;
await updateTagCategory(payload);
this.$message.success("编辑成功");
} else {
payload.parentId = this.editData.parentId || 0;
await createTagCategory(payload);
this.$message.success("新增成功");
}
this.$emit("update:visible", false);
this.$emit("success");
} catch (err) {
this.$message.error(err.message || "操作失败");
}
},
},
};
</script>
<template>
<div class="category-nav">
<div class="nav-search">
<el-input v-model="keyword"
placeholder="请输入标签名称"
size="small"
clearable
@keyup.enter.native="handleSearch" />
<el-button size="small"
type="primary"
@click="handleSearch">
搜索
</el-button>
</div>
<div class="nav-list">
<div class="nav-item"
:class="{ active: isAllActive }"
@click="selectAll">
全部
</div>
<template v-for="item in displayList">
<div :key="`l1-${item.id}`" class="nav-group">
<div class="nav-item level-1"
:class="{ active: isActive(item) }"
@click="selectCategory(item)">
<span v-if="hasChildren(item)"
class="expand-icon"
@click.stop="toggleExpand(item.id)">
<i :class="expandedMap[item.id] ? 'el-icon-arrow-down' : 'el-icon-arrow-right'" />
</span>
<span class="nav-label">{{ item.categoryName }}</span>
<i v-if="Number(item.canAddChild) === 1"
class="el-icon-plus action-icon"
title="新增子分类"
@click.stop="$emit('add-child', item)" />
</div>
<template v-if="hasChildren(item) && expandedMap[item.id]">
<div v-for="child in item.children"
:key="child.id"
class="nav-item level-2"
:class="{ active: isActive(child) }"
@click="selectCategory(child)">
<span class="nav-label">{{ child.categoryName }}</span>
<i v-if="Number(child.canEdit) === 1"
class="el-icon-edit action-icon"
title="编辑"
@click.stop="$emit('edit', child)" />
</div>
</template>
</div>
</template>
</div>
</div>
</template>
<script>
export default {
name: "CategoryNav",
props: {
list: {
type: Array,
default: () => [],
},
currentId: {
type: [Number, String],
default: "",
},
},
data() {
return {
keyword: "",
filterKeyword: "",
expandedMap: {},
};
},
computed: {
isAllActive() {
return this.currentId === "" || this.currentId == null;
},
displayList() {
const kw = (this.filterKeyword || "").trim().toLowerCase();
if (!kw) {
return this.list || [];
}
return (this.list || [])
.map((item) => {
const matchParent = (item.categoryName || "").toLowerCase().includes(kw);
const children = (item.children || []).filter(child =>
(child.categoryName || "").toLowerCase().includes(kw),
);
if (matchParent || children.length) {
return {
...item,
children: matchParent ? item.children || [] : children,
};
}
return null;
})
.filter(Boolean);
},
},
watch: {
list: {
handler(val) {
(val || []).forEach((item) => {
if (this.hasChildren(item) && this.expandedMap[item.id] === undefined) {
this.$set(this.expandedMap, item.id, true);
}
});
},
immediate: true,
deep: true,
},
},
methods: {
hasChildren(item) {
return Array.isArray(item.children) && item.children.length > 0;
},
isActive(item) {
return String(this.currentId) === String(item.id);
},
handleSearch() {
this.filterKeyword = this.keyword;
},
selectAll() {
this.$emit("select", { id: "", categoryName: "全部" });
},
selectCategory(item) {
this.$emit("select", item);
},
toggleExpand(id) {
this.$set(this.expandedMap, id, !this.expandedMap[id]);
},
},
};
</script>
<style lang="scss" scoped>
.category-nav {
width: 228px;
height: 100%;
background: #fff;
display: flex;
flex-direction: column;
box-sizing: border-box;
.nav-search {
display: flex;
align-items: center;
padding: 12px 10px;
gap: 8px;
.el-input {
flex: 1;
}
}
.nav-list {
flex: 1;
overflow: auto;
padding: 0 0 12px;
}
.nav-item {
position: relative;
display: flex;
align-items: center;
min-height: 40px;
padding: 0 12px 0 16px;
font-size: 14px;
color: #303133;
cursor: pointer;
transition: background 0.2s;
&:hover {
background: #f5f7fa;
}
&.active {
background: #e6f4ff;
color: #409eff;
border-left: 3px solid #409eff;
padding-left: 13px;
}
&.level-2 {
padding-left: 36px;
&.active {
padding-left: 33px;
}
}
.expand-icon {
width: 16px;
margin-right: 4px;
color: #909399;
flex-shrink: 0;
}
.nav-label {
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.action-icon {
flex-shrink: 0;
margin-left: 8px;
font-size: 14px;
color: #909399;
&:hover {
color: #409eff;
}
}
}
}
</style>
<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"
/>
</template>
<script>
import {
createTagDimension,
updateTagDimension,
queryTagDimensionDetail,
} from "@api/tagManagement";
export default {
name: "DimensionFormDialog",
props: {
visible: {
type: Boolean,
default: false,
},
mode: {
type: String,
default: "add",
},
dimensionData: {
type: Object,
default: () => ({}),
},
categoryOptions: {
type: Array,
default: () => [],
},
defaultCategoryId: {
type: [Number, String],
default: "",
},
},
data() {
return {
editData: {
id: "",
dimensionName: "",
categoryId: "",
},
baseData: {
categoryOptions: [],
},
formRules: {
dimensionName: [
{ required: true, message: "请输入标签维度", trigger: "blur" },
{ max: 20, message: "标签维度不能超过20个字符", trigger: "blur" },
],
categoryId: [
{ required: true, message: "请选择所属标签类别", trigger: "change" },
],
},
};
},
computed: {
isEdit() {
return this.mode === "edit";
},
nameReadonly() {
return this.isEdit && Number(this.dimensionData.canEdit) === 0;
},
categoryReadonly() {
return this.isEdit;
},
dialogConfig() {
return {
title: this.isEdit ? "编辑标签维度" : "新增标签维度",
okText: "保存",
};
},
editFormData() {
return [
{
label: "所属标签类别",
name: "categoryId",
type: "select",
placeholder: "请选择所属标签类别",
filterable: true,
optionsName: "categoryOptions",
optionId: "value",
optionLabel: "fullPath",
optionList: [],
disabled: this.categoryReadonly,
isDisabled: this.categoryReadonly,
},
{
label: "标签维度",
name: "dimensionName",
type: "input",
placeholder: "请输入标签维度",
maxlength: 20,
isClear: true,
disabled: this.nameReadonly,
isDisabled: this.nameReadonly,
},
];
},
},
watch: {
visible(val) {
if (val) {
this.initForm();
}
},
categoryOptions: {
handler(val) {
this.baseData.categoryOptions = val || [];
},
immediate: true,
deep: true,
},
},
methods: {
async initForm() {
if (this.isEdit) {
try {
const detail = await queryTagDimensionDetail({
categoryId: this.dimensionData.id,
});
this.editData = {
id: detail.id,
dimensionName: detail.dimensionName || "",
categoryId: detail.categoryId,
};
} catch (err) {
this.$message.error(err.message || "获取维度详情失败");
const row = this.dimensionData || {};
this.editData = {
id: row.id,
dimensionName: row.dimensionName || "",
categoryId: row.categoryId,
};
}
} else {
this.editData = {
id: "",
dimensionName: "",
categoryId: this.defaultCategoryId || "",
};
}
},
async handleConfirm() {
if (this.isEdit && Number(this.dimensionData.canEdit) === 0) {
this.$message.warning("该维度不可编辑");
return;
}
try {
if (this.isEdit) {
const payload = { id: this.editData.id };
if (!this.nameReadonly) {
payload.dimensionName = (this.editData.dimensionName || "").trim();
}
await updateTagDimension(payload);
this.$message.success("编辑成功");
} else {
await createTagDimension({
categoryId: this.editData.categoryId,
dimensionName: (this.editData.dimensionName || "").trim(),
});
this.$message.success("新增成功");
}
this.$emit("update:visible", false);
this.$emit("success");
} catch (err) {
this.$message.error(err.message || "操作失败");
}
},
},
};
</script>
<template>
<div class="enum-form-dialog">
<glsk-form-dialog
v-if="visible"
:selectVisible="visible"
:dialogConfig="dialogConfig"
label-width="130px"
dialog-width="520px"
defaultWidth="320px"
:formRules="formRules"
:editData="editData"
:editFormData="editFormData"
@handleClose="$emit('update:visible', false)"
@handleConfirm="handleConfirm"
/>
</div>
</template>
<script>
import {
createTagEnum,
pageTagEnum,
updateTagEnum,
} from "@api/tagManagement";
export default {
name: "EnumFormDialog",
props: {
visible: {
type: Boolean,
default: false,
},
mode: {
type: String,
default: "add",
},
enumData: {
type: Object,
default: () => ({}),
},
dimensionData: {
type: Object,
default: () => ({}),
},
},
data() {
return {
editData: {
id: "",
dimensionId: "",
enumName: "",
score: "",
remark: "",
},
existingEnumList: [],
};
},
computed: {
isEdit() {
return this.mode === "edit";
},
enumNameReadonly() {
return this.isEdit && Number(this.enumData.enumNameCanEdit) === 0;
},
scoreReadonly() {
return this.isEdit && Number(this.enumData.scoreCanEdit) === 0;
},
dialogConfig() {
return {
title: this.isEdit ? "编辑枚举值" : "新增枚举值",
okText: "确定",
};
},
formRules() {
return {
enumName: [
{ validator: this.validateEnumNameRule, trigger: ["blur", "change"] },
],
score: [
{ validator: this.validateScoreRule, trigger: ["blur", "change"] },
],
};
},
editFormData() {
return [
{
label: "标签枚举值名称",
name: "enumName",
type: "input",
placeholder: "请输入",
maxlength: 20,
showLimit: true,
isClear: true,
disabled: this.enumNameReadonly,
isDisabled: this.enumNameReadonly,
},
{
label: "命中客户分",
name: "score",
type: "input",
placeholder: "请输入0~100的整数",
maxlength: 3,
isClear: true,
disabled: this.scoreReadonly,
isDisabled: this.scoreReadonly,
inputFn: this.handleScoreInput,
},
{
label: "枚举值描述",
name: "remark",
type: "textarea",
placeholder: "请输入",
maxlength: 500,
showLimit: true,
rows: 4,
isClear: true,
},
];
},
},
watch: {
visible(val) {
if (val) {
this.initForm();
}
},
},
methods: {
async initForm() {
if (this.isEdit) {
const row = this.enumData || {};
this.editData = {
id: row.id,
dimensionId: row.dimensionId,
enumName: row.enumName || "",
score: row.score != null && row.score !== "" ? String(row.score) : "",
remark: row.remark || "",
};
} else {
const dim = this.dimensionData || {};
this.editData = {
id: "",
dimensionId: dim.id,
enumName: "",
score: "",
remark: "",
};
}
await this.loadExistingEnumList();
},
async loadExistingEnumList() {
const dimensionId = this.editData.dimensionId;
if (!dimensionId) {
this.existingEnumList = [];
return;
}
try {
const res = await pageTagEnum({
dimensionId,
pageNum: 1,
pageSize: 9999,
});
this.existingEnumList = res?.list || [];
} catch (err) {
this.existingEnumList = [];
}
},
handleScoreInput(val) {
if (this.scoreReadonly) {
return;
}
const digits = String(val || "").replace(/\D/g, "");
if (!digits) {
this.editData.score = "";
return;
}
let num = Number.parseInt(digits, 10);
if (num > 100) {
num = 100;
}
this.editData.score = String(num);
},
validateEnumNameRule(rule, value, callback) {
if (this.enumNameReadonly) {
callback();
return;
}
const name = (value || "").trim();
if (!name) {
callback(new Error("请输入标签枚举值名称"));
return;
}
if (name.length > 20) {
callback(new Error("标签枚举值名称不能超过20个字符"));
return;
}
const isDuplicate = this.existingEnumList.some((item) => {
const itemName = (item.enumName || "").trim();
if (itemName !== name) {
return false;
}
if (this.isEdit && item.id === this.editData.id) {
return false;
}
return true;
});
if (isDuplicate) {
callback(new Error("同一维度下枚举值名称不可重复"));
return;
}
callback();
},
validateScoreRule(rule, value, callback) {
if (this.scoreReadonly) {
callback();
return;
}
if (value === "" || value == null) {
callback(new Error("请输入命中客户分"));
return;
}
const num = Number(value);
if (!Number.isInteger(num) || num < 0 || num > 100) {
callback(new Error("命中客户分须为0~100的整数"));
return;
}
callback();
},
async handleConfirm() {
try {
const payload = {
remark: this.editData.remark || undefined,
};
if (this.isEdit) {
payload.id = this.editData.id;
if (!this.enumNameReadonly) {
payload.enumName = (this.editData.enumName || "").trim();
}
if (!this.scoreReadonly && this.editData.score !== "") {
payload.score = Number(this.editData.score);
}
await updateTagEnum(payload);
this.$message.success("编辑成功");
} else {
payload.dimensionId = this.editData.dimensionId;
payload.enumName = (this.editData.enumName || "").trim();
payload.score = Number(this.editData.score);
await createTagEnum(payload);
this.$message.success("新增成功");
}
this.$emit("update:visible", false);
this.$emit("success");
} catch (err) {
this.$message.error(err.message || "操作失败");
}
},
},
};
</script>
<style lang="scss" scoped>
.enum-form-dialog {
::v-deep .el-textarea .el-input__count {
right: 10px !important;
bottom: 5px !important;
}
}
</style>
<template>
<d2-container v-loading="pageLoading" class="tag-enum-maintain-page">
<div class="page-breadcrumb">
<template v-for="(seg, index) in breadcrumbSegments">
<span v-if="index > 0"
:key="`sep-${index}`"
class="sep">
/
</span>
<span :key="`seg-${index}`" class="crumb-text">{{ seg }}</span>
</template>
</div>
<div class="d2-container-content">
<d2-table-header :left-span="0">
<el-button size="small"
type="primary"
@click="handleAddEnum">
新增枚举值
</el-button>
</d2-table-header>
<d2-table ref="enumTable"
:before-search-fn="beforeSearchFn"
:get-list-api="getListApi"
:search-form="searchForm"
:table-params="tableParams">
<template #auth-button="scope">
<el-button v-if="canShowEnumEdit(scope.scope)"
size="mini"
type="text"
@click="handleEditEnum(scope.scope)">
编辑
</el-button>
</template>
</d2-table>
</div>
<EnumFormDialog :dimension-data="dimensionDetail"
:enum-data="currentEnum"
:mode="enumFormMode"
:visible.sync="enumFormVisible"
@success="handleEnumFormSuccess" />
</d2-container>
</template>
<script>
import {
pageTagEnum,
queryTagDimensionDetail,
} from "@api/tagManagement";
import EnumFormDialog from "../components/EnumFormDialog.vue";
export default {
name: "TagEnumMaintain",
components: { EnumFormDialog },
data() {
return {
pageLoading: false,
dimensionId: "",
dimensionDetail: {},
searchForm: {},
tableParams: {
btnId: new Date().getTime() + Number.parseInt(Math.random() * 1000),
listName: "list",
tableOption: true,
tableColumns: [
{ label: "枚举值", prop: "enumName", minWidth: 200 },
{ label: "命中客户分", prop: "score", width: 120 },
],
},
enumFormVisible: false,
enumFormMode: "add",
currentEnum: {},
};
},
computed: {
breadcrumbSegments() {
const segments = ["标签管理"];
const path = (this.dimensionDetail.categoryFullPath || "").trim();
if (path) {
path.split("/").forEach((part) => {
const text = (part || "").trim();
if (text)
segments.push(text);
});
}
const dimName = (this.dimensionDetail.dimensionName || "").trim();
if (dimName) {
segments.push(dimName);
}
return segments;
},
},
created() {
this.dimensionId = this.$route.query.dimensionId;
if (!this.dimensionId) {
this.$message.warning("缺少维度参数");
this.$router.back();
return;
}
this.loadDimensionDetail();
},
methods: {
beforeSearchFn() {
return Promise.resolve();
},
getListApi(params) {
return pageTagEnum({
dimensionId: this.dimensionId,
pageNum: params.currentPage || 1,
pageSize: params.pageSize || 10,
});
},
async loadDimensionDetail() {
this.pageLoading = true;
try {
const detail = await queryTagDimensionDetail({
categoryId: this.dimensionId,
});
this.dimensionDetail = detail || {};
} catch (err) {
this.$message.error(err.message || "加载维度信息失败");
this.$router.back();
} finally {
this.pageLoading = false;
}
},
refreshTable() {
if (this.$refs.enumTable) {
this.$refs.enumTable.refreshTable();
}
},
canShowEnumEdit(row) {
if (!row) {
return false;
}
if (Number(row.canEdit) === 0) {
return false;
}
const hasFlags = (row.canEdit != null && row.canEdit !== "")
|| (row.enumNameCanEdit != null && row.enumNameCanEdit !== "")
|| (row.scoreCanEdit != null && row.scoreCanEdit !== "");
if (!hasFlags) {
return true;
}
if (row.canEdit != null && row.canEdit !== "") {
return Number(row.canEdit) === 1;
}
return (
Number(row.enumNameCanEdit) === 1
|| Number(row.scoreCanEdit) === 1
);
},
handleAddEnum() {
this.enumFormMode = "add";
this.currentEnum = {};
this.enumFormVisible = true;
},
handleEditEnum(row) {
if (!this.canShowEnumEdit(row)) {
this.$message.warning("该枚举值不可编辑");
return;
}
this.enumFormMode = "edit";
this.currentEnum = { ...row };
this.enumFormVisible = true;
},
handleEnumFormSuccess() {
this.refreshTable();
},
},
};
</script>
<style lang="scss" scoped>
.tag-enum-maintain-page {
.page-breadcrumb {
padding: 16px 20px 0;
font-size: 14px;
color: #606266;
line-height: 22px;
.sep {
margin: 0 8px;
color: #c0c4cc;
}
.crumb-text:last-child {
color: #303133;
}
}
.d2-container-content {
padding: 16px 20px;
}
}
</style>
<template>
<d2-container class="tag-management-page">
<div class="tag-management-layout">
<div v-loading="treeLoading" class="left-pane">
<CategoryNav :current-id="selectedCategoryId"
:list="categoryTree"
@add-child="handleTreeAddChild"
@edit="handleEditCategory"
@select="handleCategorySelect" />
</div>
<div class="main-pane">
<div class="search-card">
<d2-search ref="showSearch"
class="show-search"
label-width="90px"
:form-data="showFormData"
:search-form="searchForm" />
<div class="up-btns">
<el-button :id="tableParams.btnId"
size="small"
type="primary">
查询
</el-button>
<el-button size="small" @click="handleReset">
重置
</el-button>
</div>
</div>
<div class="table-card">
<d2-table-header :left-span="0">
<auth-button category="Button" :show-btn-ids="['9230102']" />
</d2-table-header>
<d2-table ref="dimensionTable"
:before-search-fn="beforeSearchFn"
:get-list-api="getListApi"
:search-form="searchForm"
:table-params="tableParams">
<template #enumTags="scope">
<div class="enum-tags-cell">
<template v-if="scope.scope.enums && scope.scope.enums.length">
<el-tag v-for="item in scope.scope.enums"
:key="item.id || item.enumName"
class="enum-tag"
size="small">
{{ item.enumName }}
</el-tag>
</template>
<span v-else>-</span>
</div>
</template>
<template #auth-button="scope">
<span v-if="Number(scope.scope.canEdit) === 1" class="op-btn">
<auth-button :data="scope.scope" :show-btn-ids="['9230105']" />
</span>
<span class="op-btn">
<auth-button :data="scope.scope"
:show-btn-ids="['9230108']" />
</span>
</template>
</d2-table>
</div>
</div>
</div>
<CategoryFormDialog :category-data="currentCategory"
:default-parent-id="defaultParentId"
:mode="categoryDialogMode"
:parent-options="categoryLeafOptions"
:visible.sync="categoryDialogVisible"
@success="handleCategorySuccess" />
<DimensionFormDialog :category-options="dimensionCategoryOptions"
:default-category-id="selectedCategoryId"
:dimension-data="currentDimension"
:mode="dimensionDialogMode"
:visible.sync="dimensionDialogVisible"
@success="handleDimensionSuccess" />
</d2-container>
</template>
<script>
import {
queryTagCategoryLeafList,
queryTagCategoryTree,
queryTagDimension,
queryTagDimensionCategoryOptions,
} from "@api/tagManagement";
import CategoryFormDialog from "./components/CategoryFormDialog.vue";
import CategoryNav from "./components/CategoryNav.vue";
import DimensionFormDialog from "./components/DimensionFormDialog.vue";
export default {
name: "TagManagement",
components: {
CategoryNav,
CategoryFormDialog,
DimensionFormDialog,
},
data() {
return {
treeLoading: false,
categoryTree: [],
categoryLeafOptions: [],
dimensionCategoryOptions: [],
selectedCategoryId: "",
selectedCategory: null,
searchForm: {
dimensionName: "",
enumName: "",
},
showFormData: [
{
label: "标签维度",
name: "dimensionName",
type: "input",
placeholder: "请输入标签维度",
maxlength: 20,
isClear: true,
},
{
label: "枚举值",
name: "enumName",
type: "input",
placeholder: "请输入枚举值",
maxlength: 20,
isClear: true,
},
],
tableParams: {
btnId: new Date().getTime() + Number.parseInt(Math.random() * 1000),
listName: "list",
tableOption: true,
tableColumns: [
{ label: "所属类别", prop: "categoryFullPath", minWidth: 140 },
{ label: "标签维度", prop: "dimensionName", minWidth: 120 },
{ label: "枚举值", addHtml: "enumTags", minWidth: 280 },
],
},
categoryDialogVisible: false,
categoryDialogMode: "add",
currentCategory: {},
defaultParentId: "",
dimensionDialogVisible: false,
dimensionDialogMode: "add",
currentDimension: {},
};
},
created() {
this.loadCategoryTree();
this.loadCategoryLeafOptions();
this.loadDimensionCategoryOptions();
},
methods: {
beforeSearchFn() {
return Promise.resolve();
},
getListApi(params) {
const payload = {
dimensionName: (params.dimensionName || "").trim() || undefined,
enumName: (params.enumName || "").trim() || undefined,
pageNum: params.currentPage || 1,
pageSize: params.pageSize || 10,
};
if (this.selectedCategoryId !== "" && this.selectedCategoryId != null) {
payload.categoryId = this.selectedCategoryId;
}
return queryTagDimension(payload);
},
async loadCategoryTree() {
this.treeLoading = true;
try {
const res = await queryTagCategoryTree();
this.categoryTree = res || [];
} catch (err) {
this.$message.error(err.message || "加载分类树失败");
} finally {
this.treeLoading = false;
}
},
async loadCategoryLeafOptions() {
try {
const res = await queryTagCategoryLeafList();
this.categoryLeafOptions = res || [];
} catch (err) {
this.$message.error(err.message || "加载可新增子级分类失败");
}
},
async loadDimensionCategoryOptions() {
try {
const res = await queryTagDimensionCategoryOptions();
this.dimensionCategoryOptions = res || [];
} catch (err) {
this.$message.error(err.message || "加载维度分类选项失败");
}
},
handleCategorySelect(data) {
this.selectedCategory = data;
this.selectedCategoryId = data.id === "" || data.id == null ? "" : data.id;
if (this.$refs.dimensionTable) {
this.$refs.dimensionTable.refreshTable(false, true);
}
},
handleReset() {
this.searchForm = {
dimensionName: "",
enumName: "",
};
if (this.$refs.dimensionTable) {
this.$refs.dimensionTable.refreshTable(false, true);
}
},
refreshTable() {
if (this.$refs.dimensionTable) {
this.$refs.dimensionTable.refreshTable();
}
},
handleAddCategory() {
this.categoryDialogMode = "add";
this.currentCategory = {};
this.defaultParentId
= this.selectedCategory && Number(this.selectedCategory.canAddChild) === 1
? this.selectedCategory.id
: "";
this.categoryDialogVisible = true;
},
handleTreeAddChild(data) {
this.categoryDialogMode = "add";
this.currentCategory = {};
this.defaultParentId = data.id;
this.categoryDialogVisible = true;
},
handleEditCategory(data) {
if (Number(data.canEdit) !== 1) {
this.$message.warning("该分类不可编辑");
return;
}
this.categoryDialogMode = "edit";
this.currentCategory = { ...data };
this.categoryDialogVisible = true;
},
handleAddDimension() {
this.dimensionDialogMode = "add";
this.currentDimension = {};
this.dimensionDialogVisible = true;
},
handleEditDimension(row) {
if (Number(row.canEdit) !== 1) {
this.$message.warning("该维度不可编辑");
return;
}
this.dimensionDialogMode = "edit";
this.currentDimension = { ...row };
this.dimensionDialogVisible = true;
},
handleMaintainEnum(row) {
this.$router.push({
name: "tagEnumMaintain",
query: { dimensionId: row.id },
});
},
handleCategorySuccess() {
this.loadCategoryTree();
this.loadCategoryLeafOptions();
this.loadDimensionCategoryOptions();
},
handleDimensionSuccess() {
this.refreshTable();
this.loadCategoryTree();
this.loadDimensionCategoryOptions();
},
},
};
</script>
<style lang="scss" scoped>
.tag-management-page {
::v-deep .d2-container-full__body {
padding: 0 !important;
}
}
.tag-management-layout {
display: flex;
height: calc(100vh - 160px);
min-height: 500px;
background: #f5f7fa;
.left-pane {
flex-shrink: 0;
height: 100%;
}
.main-pane {
flex: 1;
overflow: auto;
padding: 12px;
background: transparent;
.search-card {
background: #fff;
padding: 16px 20px 12px;
margin-bottom: 12px;
border-radius: 4px;
.up-btns {
margin-top: 8px;
}
}
.table-card {
background: #fff;
padding: 16px 20px;
border-radius: 4px;
::v-deep .table-header {
margin-bottom: 12px;
}
}
}
}
.enum-tags-cell {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
align-items: flex-start;
gap: 4px;
max-width: 100%;
padding: 4px 20px;
.enum-tag {
height: auto;
white-space: normal;
word-break: break-all;
background: #e6f4ff;
border-color: #b3d8ff;
color: #409eff;
vertical-align: middle;
}
}
.op-btn {
margin-right: 8px;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!