From 1b6a698d779bb7c6c32df9faec538c4682597a83 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 15 一月 2026 11:38:17 +0800
Subject: [PATCH] fix: 完成BOM详情变更

---
 src/views/productionManagement/productStructure/Detail/index.vue |   38 +++++++++++---------------------------
 src/api/productionManagement/productStructure.js                 |    4 ++--
 src/views/productionManagement/productStructure/index.vue        |   14 +++++++++-----
 3 files changed, 22 insertions(+), 34 deletions(-)

diff --git a/src/api/productionManagement/productStructure.js b/src/api/productionManagement/productStructure.js
index 074e27a..e69e14a 100644
--- a/src/api/productionManagement/productStructure.js
+++ b/src/api/productionManagement/productStructure.js
@@ -4,7 +4,7 @@
 // 鍒嗛〉鏌ヨ
 export function queryList(id) {
   return request({
-    url: "/productStructure/listByproductModelId/" + id,
+    url: "/productStructure/listBybomId/" + id,
     method: "get",
   });
 }
@@ -15,4 +15,4 @@
     method: "post",
     data: data,
   });
-}
\ No newline at end of file
+}
diff --git a/src/views/productionManagement/productStructure/Detail/index.vue b/src/views/productionManagement/productStructure/Detail/index.vue
index e95f906..dda0834 100644
--- a/src/views/productionManagement/productStructure/Detail/index.vue
+++ b/src/views/productionManagement/productStructure/Detail/index.vue
@@ -25,6 +25,7 @@
         :data="tableData"
         border
         :preserve-expanded-content="false"
+        :default-expand-all="true"
         style="width: 100%"
     >
       <el-table-column type="expand">
@@ -120,22 +121,6 @@
                   </el-form-item>
                 </template>
               </el-table-column>
-              <el-table-column prop="diskQuantity"
-                               label="鐩樻暟锛堢洏锛�">
-                <template #default="{ row, $index }">
-                  <el-form-item :prop="`dataList.${$index}.diskQuantity`"
-                                :rules="[{ required: true, message: '璇疯緭鍏ョ洏鏁�', trigger: ['blur','change'] }]"
-                                style="margin: 0">
-                    <el-input-number v-model="row.diskQuantity"
-                                     :min="0"
-                                     :precision="0"
-                                     :step="1"
-                                     controls-position="right"
-                                     style="width: 100%"
-                                     :disabled="!dataValue.isEdit" />
-                  </el-form-item>
-                </template>
-              </el-table-column>
               <el-table-column label="鎿嶄綔" fixed="right" width="100">
                 <template #default="{ row, $index }">
                   <el-button type="danger"
@@ -148,10 +133,9 @@
           </el-form>
         </template>
       </el-table-column>
-      <el-table-column label="浜у搧缂栫爜" prop="productCode" />
+      <el-table-column label="BOM缂栧彿" prop="bomNo" />
       <el-table-column label="浜у搧鍚嶇О" prop="productName" />
       <el-table-column label="瑙勬牸鍨嬪彿" prop="model" />
-      <el-table-column label="鍗曚綅" prop="unit" />
     </el-table>
 
     <product-select-dialog v-if="dataValue.showProductDialog"
@@ -195,6 +179,10 @@
   }
 });
 
+// 浠庤矾鐢卞弬鏁拌幏鍙栦骇鍝佷俊鎭�
+const routeBomNo = computed(() => route.query.bomNo || '');
+const routeProductName = computed(() => route.query.productName || '');
+const routeProductModelName = computed(() => route.query.productModelName || '');
 
 const dataValue = reactive({
   dataList: [],
@@ -210,8 +198,7 @@
   {
     productName: "",
     model: "",
-    unit: "",
-    productCode: "",
+    bomNo: "",
   }
 ])
 
@@ -222,11 +209,8 @@
 
 const fetchData = async () => {
   const { data } = await queryList(routeId.value);
-  tableData[0].productName = data.productName;
-  tableData[0].model = data.model;
-  tableData[0].unit = data.unit;
-  tableData[0].productCode = data.productCode;
-  dataValue.dataList = data.productStructureList;
+  // 浜у搧淇℃伅浠庤矾鐢卞弬鏁拌幏鍙栵紝浼樺厛浣跨敤璺敱鍙傛暟
+  dataValue.dataList = data || [];
 };
 
 const fetchProcessOptions = async () => {
@@ -242,6 +226,7 @@
       row[0].productName;
   dataValue.dataList[dataValue.currentRowIndex].model = row[0].model;
   dataValue.dataList[dataValue.currentRowIndex].productModelId = row[0].id;
+  dataValue.dataList[dataValue.currentRowIndex].unit = row[0].unit || "";
   dataValue.showProductDialog = false;
 };
 
@@ -251,7 +236,7 @@
         dataValue.loading = true;
         if (valid) {
           add({
-            parentId: routeId.value,
+            bomId: routeId.value,
             productStructureList: dataValue.dataList || [],
           }).then(res => {
             router.push({
@@ -277,7 +262,6 @@
     unitQuantity: 0,
     demandedQuantity: 0,
     unit: "",
-    diskQuantity: 0,
   });
 };
 
diff --git a/src/views/productionManagement/productStructure/index.vue b/src/views/productionManagement/productStructure/index.vue
index 08faf7c..d8ce689 100644
--- a/src/views/productionManagement/productStructure/index.vue
+++ b/src/views/productionManagement/productStructure/index.vue
@@ -18,7 +18,7 @@
         <el-button
             type="primary"
             text
-            @click="showDetail(row.id)">{{ row.productName }}
+            @click="showDetail(row)">{{ row.bomNo }}
         </el-button>
       </template>
     </PIMTable>
@@ -85,13 +85,14 @@
   {
     label: "BOM缂栧彿",
     prop: "bomNo",
+    dataType: 'slot',
+    slot: "detail",
     minWidth: 140
   },
   {
     label: "浜у搧鍚嶇О",
     prop: "productName",
-    dataType: 'slot',
-    slot: "detail",
+    
     minWidth: 160
   },
   {
@@ -321,11 +322,14 @@
 };
 
 // 鏌ョ湅璇︽儏
-const showDetail = (id) => {
+const showDetail = (row) => {
   router.push({
     path: '/productionManagement/productStructureDetail',
     query: {
-      id: id
+      id: row.id,
+      bomNo: row.bomNo || '',
+      productName: row.productName || '',
+      productModelName: row.productModelName || ''
     }
   });
 };

--
Gitblit v1.9.3