From d63eb8ed24ad962093e1beb2831e1a930a7108c5 Mon Sep 17 00:00:00 2001 From: hwj Date: Tue, 7 Jul 2026 14:11:35 +0800 Subject: [PATCH] =?UTF-8?q?style=EF=BC=9A=E4=BA=A7=E5=93=81=E5=88=86?= =?UTF-8?q?=E7=B1=BB/=E7=89=A9=E6=96=99=E6=A1=A3=E6=A1=88-=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E7=B1=BB=E5=9E=8B=E6=89=8D=E5=B1=95=E7=A4=BA=E5=B7=A5?= =?UTF-8?q?=E8=89=BA=E8=B7=AF=E7=BA=BF=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/category/ProductCategoryForm.vue | 11 ++++++++++- src/views/erp/product/product/index.vue | 19 ++++++++++++++----- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/views/erp/product/category/ProductCategoryForm.vue b/src/views/erp/product/category/ProductCategoryForm.vue index 6b39e62f..af83af42 100644 --- a/src/views/erp/product/category/ProductCategoryForm.vue +++ b/src/views/erp/product/category/ProductCategoryForm.vue @@ -38,7 +38,11 @@ - + { return formData.value.processRouteName || String(formData.value.processRouteId) }) +const isProductType = computed(() => Number(formData.value.type) === 1) + /** 打开弹窗 */ const open = async (type: string, id?: number, defaultData?: any) => { dialogVisible.value = true @@ -333,6 +339,9 @@ const getProductCategoryTree = async () => { const handleTypeChange = async () => { formData.value.parentId = undefined + if (!isProductType.value) { + clearProcessRoute() + } await getProductCategoryTree() } diff --git a/src/views/erp/product/product/index.vue b/src/views/erp/product/product/index.vue index c9213789..401db34f 100644 --- a/src/views/erp/product/product/index.vue +++ b/src/views/erp/product/product/index.vue @@ -363,6 +363,19 @@ const groupTreeData = ref([]) const treeRef = ref() const typeDict = computed(() => getIntDictOptions(DICT_TYPE.MATERIAL_CLASSIFICATION_TYPE)) +const normalizeCategoryTree = (children: any[] = [], fallbackType?: number) => { + return children.map((child: any) => { + const type = child.type ?? fallbackType + return { + ...child, + type, + nodeKey: `cat_${child.id}`, + isType: false, + children: normalizeCategoryTree(child.children || [], type) + } + }) +} + const treeData = computed(() => { return (groupTreeData.value || []).map((group: any) => { const dictItem = typeDict.value.find((d: any) => d.value === group.type) @@ -372,11 +385,7 @@ const treeData = computed(() => { name, type: group.type, isType: true, - children: (group.children || []).map((child: any) => ({ - ...child, - nodeKey: `cat_${child.id}`, - isType: false - })) + children: normalizeCategoryTree(group.children || [], group.type) } }) })