From f0e3b394502281cee53b4095fc637452204bf726 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期五, 23 一月 2026 13:39:22 +0800
Subject: [PATCH] 修改BOM消耗工序不回显name问题,取消不恢复数据问题

---
 src/views/productionManagement/productStructure/Detail/index.vue |  114 ++++++---------------------------------------------------
 1 files changed, 12 insertions(+), 102 deletions(-)

diff --git a/src/views/productionManagement/productStructure/Detail/index.vue b/src/views/productionManagement/productStructure/Detail/index.vue
index 7e9e176..09044b2 100644
--- a/src/views/productionManagement/productStructure/Detail/index.vue
+++ b/src/views/productionManagement/productStructure/Detail/index.vue
@@ -57,7 +57,7 @@
                   </el-form-item>
                 </template>
               </el-table-column>
-              <el-table-column prop="processId"
+              <el-table-column prop="processName"
                                label="娑堣�楀伐搴�">
                 <template #default="{ row, $index }">
                   <el-form-item v-if="dataValue.isEdit"
@@ -242,6 +242,9 @@
       const setNameRecursively = items => {
         items.forEach(item => {
           item.tempId = item.id;
+          item.processName =
+            dataValue.processOptions.find(option => option.id === item.processId)
+              ?.name || "";
           if (item.children && item.children.length > 0) {
             setNameRecursively(item.children);
           }
@@ -249,103 +252,6 @@
       };
       setNameRecursively(dataValue.dataList);
       console.log(dataValue.dataList, "dataValue.dataList");
-
-      // dataValue.dataList = [
-      //   {
-      //     id: 30,
-      //     productModelId: 220,
-      //     processId: 42,
-      //     unitQuantity: 0.0,
-      //     demandedQuantity: 0.0,
-      //     unit: "30",
-      //     tenantId: 100,
-      //     bomId: 5,
-      //     processName: "娴嬭瘯1",
-      //     productName: "1111",
-      //     productId: 264,
-      //     model: "1112233",
-      //     productStructureList: null,
-      //     children: [
-      //       {
-      //         id: 300,
-      //         productModelId: 220,
-      //         processId: 42,
-      //         unitQuantity: 0.0,
-      //         demandedQuantity: 0.0,
-      //         unit: "300",
-      //         tenantId: 100,
-      //         bomId: 5,
-      //         processName: "娴嬭瘯1",
-      //         productName: "1111",
-      //         productId: 264,
-      //         model: "1112233",
-      //         productStructureList: null,
-      //         children: [
-      //           {
-      //             id: 3000,
-      //             productModelId: 220,
-      //             processId: 42,
-      //             unitQuantity: 0.0,
-      //             demandedQuantity: 0.0,
-      //             unit: "3000",
-      //             tenantId: 100,
-      //             bomId: 5,
-      //             processName: "娴嬭瘯1",
-      //             productName: "1111",
-      //             productId: 264,
-      //             model: "1112233",
-      //             productStructureList: null,
-      //           },
-      //           {
-      //             id: 3200,
-      //             productModelId: 221,
-      //             processId: 43,
-      //             unitQuantity: 0.0,
-      //             demandedQuantity: 0.0,
-      //             unit: "3200",
-      //             tenantId: 100,
-      //             bomId: 5,
-      //             processName: "娴嬭瘯2",
-      //             productName: "xxx",
-      //             productId: 266,
-      //             model: "xxx",
-      //             productStructureList: null,
-      //           },
-      //         ],
-      //       },
-      //       {
-      //         id: 320,
-      //         productModelId: 221,
-      //         processId: 43,
-      //         unitQuantity: 0.0,
-      //         demandedQuantity: 0.0,
-      //         unit: "320",
-      //         tenantId: 100,
-      //         bomId: 5,
-      //         processName: "娴嬭瘯2",
-      //         productName: "xxx",
-      //         productId: 266,
-      //         model: "xxx",
-      //         productStructureList: null,
-      //       },
-      //     ],
-      //   },
-      //   {
-      //     id: 32,
-      //     productModelId: 221,
-      //     processId: 43,
-      //     unitQuantity: 0.0,
-      //     demandedQuantity: 0.0,
-      //     unit: "32",
-      //     tenantId: 100,
-      //     bomId: 5,
-      //     processName: "娴嬭瘯2",
-      //     productName: "xxx",
-      //     productId: 266,
-      //     model: "xxx",
-      //     productStructureList: null,
-      //   },
-      // ];
     }
   };
 
@@ -476,6 +382,7 @@
       model: undefined,
       productModelId: undefined,
       processId: "",
+      processName: "",
       unitQuantity: 0,
       demandedQuantity: 0,
       unit: "",
@@ -524,6 +431,7 @@
           model: undefined,
           productModelId: undefined,
           processId: "",
+          processName: "",
           unitQuantity: 0,
           demandedQuantity: 0,
           unit: "",
@@ -580,10 +488,11 @@
 
   const cancelEdit = () => {
     dataValue.isEdit = false;
-    dataValue.dataList = dataValue.dataList.filter(item => item.id !== undefined);
+    // dataValue.dataList = dataValue.dataList.filter(item => item.id !== undefined);
+    fetchData();
   };
 
-  onMounted(() => {
+  onMounted(async () => {
     // 浠庤矾鐢卞弬鏁板洖鏄炬暟鎹�
     tableData[0].productName = routeProductName.value;
     tableData[0].model = routeProductModelName.value;
@@ -594,7 +503,8 @@
       dataValue.isEdit = false;
     }
 
-    fetchData();
-    fetchProcessOptions();
+    // 鍏堝姞杞藉伐搴忛�夐」锛屽啀鍔犺浇鏁版嵁锛岀‘淇漞l-select鑳藉姝g‘鍥炴樉
+    await fetchProcessOptions();
+    await fetchData();
   });
 </script>
\ No newline at end of file

--
Gitblit v1.9.3