From 6f3cb944e863185740119cc520db094747368430 Mon Sep 17 00:00:00 2001 From: yinq Date: Tue, 11 Mar 2025 08:51:24 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E7=BB=93=E6=9E=84BOM=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=8A=A0=E6=9C=80=E9=A1=B6=E7=BA=A7=E8=8A=82=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/mes/baseStructureBom/types.ts | 5 +++++ src/views/mes/baseStructureBom/index.vue | 25 ++++++++++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/api/mes/baseStructureBom/types.ts b/src/api/mes/baseStructureBom/types.ts index 3b663b7..fa95f44 100644 --- a/src/api/mes/baseStructureBom/types.ts +++ b/src/api/mes/baseStructureBom/types.ts @@ -233,4 +233,9 @@ export interface BaseStructureBomTreeVO { */ label: string; + /** + * 子集 + */ + children: []; + } diff --git a/src/views/mes/baseStructureBom/index.vue b/src/views/mes/baseStructureBom/index.vue index c86dd58..cfaf9b6 100644 --- a/src/views/mes/baseStructureBom/index.vue +++ b/src/views/mes/baseStructureBom/index.vue @@ -270,13 +270,22 @@ const getTreeSelect = async () => { treeLoading.value = true; loading.value = true; const res = await structureBomTreeSelect(); - // alert(JSON.stringify(res)) - structureBomOptions.value = res.data; + // structureBomOptions.value = res.data; + const initialTree: BaseStructureBomTreeVO = { + id: 1, + parentId: -1, + materialTypeId: 0, + label: "制造BOM结构", + children: res.data + }; + structureBomOptions.value.push(initialTree); if (queryParams.value.parentId === null || queryParams.value.parentId === undefined) { - const topStructureBom = structureBomOptions.value.find(item => item.id === -1); - queryParams.value.parentId = -1; - parentMaterialTypeName.value = topStructureBom.label; + const topStructureBom = structureBomOptions.value.find(item => item.parentId === -1); + if (topStructureBom != null){ + parentMaterialTypeName.value = topStructureBom.label; + } + queryParams.value.parentId = 1; parentParentMaterialTypeName.value = "顶级"; } @@ -305,10 +314,10 @@ const getList = async () => { const handleNodeClick = (data: BaseStructureBomTreeVO) => { queryParams.value.parentId = data.id; parentMaterialTypeName.value = data.label; - if (data.parentId === 0) { + if (data.parentId === -1) { parentParentMaterialTypeName.value = "顶级"; - } else if (data.parentId === -1) { - parentParentMaterialTypeName.value = "BOM结构"; + } else if (data.parentId === 1) { + parentParentMaterialTypeName.value = "制造BOM结构"; } else { const findMaterialType = materialTypeOptions.value.find(item => item.matrialTypeId === data.parentId); parentParentMaterialTypeName.value = findMaterialType.matrialTypeName;