|
@@ -370,7 +370,13 @@
|
|
|
<div class="panel-body">
|
|
<div class="panel-body">
|
|
|
<!-- 左侧分类列表 -->
|
|
<!-- 左侧分类列表 -->
|
|
|
<div class="panel-main">
|
|
<div class="panel-main">
|
|
|
- <div v-for="group in item.panelData.groups" :key="group.title" class="category-group">
|
|
|
|
|
|
|
+ <div
|
|
|
|
|
+ v-for="group in getSubCategoryGroups(item.syncCategoryId).length
|
|
|
|
|
+ ? getSubCategoryGroups(item.syncCategoryId)
|
|
|
|
|
+ : item.panelData.groups"
|
|
|
|
|
+ :key="group.title"
|
|
|
|
|
+ class="category-group"
|
|
|
|
|
+ >
|
|
|
<div class="group-title">{{ group.title }}</div>
|
|
<div class="group-title">{{ group.title }}</div>
|
|
|
<div class="group-items">
|
|
<div class="group-items">
|
|
|
<span v-for="sub in group.items" :key="sub" class="group-item">{{ sub }}</span>
|
|
<span v-for="sub in group.items" :key="sub" class="group-item">{{ sub }}</span>
|
|
@@ -2846,6 +2852,17 @@ const findNodeById = (nodes: any[], id: string | number): any => {
|
|
|
return null;
|
|
return null;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+// 根据 syncCategoryId 从分类树获取二级+三级分组展示数据
|
|
|
|
|
+const getSubCategoryGroups = (syncCategoryId: string | number | null) => {
|
|
|
|
|
+ if (!syncCategoryId) return [];
|
|
|
|
|
+ const node = findNodeById(categoryOptions.value, syncCategoryId);
|
|
|
|
|
+ if (!node || !node.children) return [];
|
|
|
|
|
+ return node.children.map((child: any) => ({
|
|
|
|
|
+ title: child.label,
|
|
|
|
|
+ items: (child.children || []).map((sub: any) => sub.label)
|
|
|
|
|
+ }));
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
const handleAddRecommend = () => {
|
|
const handleAddRecommend = () => {
|
|
|
recommendEditIndex.value = -1;
|
|
recommendEditIndex.value = -1;
|
|
|
Object.assign(recommendForm, {
|
|
Object.assign(recommendForm, {
|