From 131f45388633a6670800926fefe17918e30b70ed Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 27 三月 2026 15:26:03 +0800
Subject: [PATCH] 军泰伟业 1.生产订单添加领料功能 2.将报工台账单的查看投入迁移到生产订单

---
 src/views/productionManagement/productionOrder/New.vue |   33 ++++++++++++++++++++++++++++-----
 1 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/src/views/productionManagement/productionOrder/New.vue b/src/views/productionManagement/productionOrder/New.vue
index 51e5404..500145d 100644
--- a/src/views/productionManagement/productionOrder/New.vue
+++ b/src/views/productionManagement/productionOrder/New.vue
@@ -225,7 +225,14 @@
             <el-table-column label="浜у搧鍚嶇О" prop="productName" min-width="120" />
             <el-table-column label="鍗曚綅浜у嚭闇�瑕佹暟閲�" min-width="140">
               <template #default="{ row }">
-                <el-input-number v-model="row.unitQuantity" :min="0" :precision="2" size="small" style="width: 100%" />
+                <el-input-number 
+                  v-model="row.unitQuantity" 
+                  :min="0" 
+                  :precision="2" 
+                  size="small" 
+                  style="width: 100%" 
+                  @change="(val) => handleUnitQuantityChange(val, row)"
+                />
               </template>
             </el-table-column>
             <el-table-column label="闇�姹傛暟閲�" min-width="120">
@@ -477,16 +484,32 @@
   });
 };
 
+// 鐩戝惉鐗╂枡娓呭崟鍙樺寲锛屽綋鍗曚綅浜у嚭闇�瑕佹暟閲忓彉鍖栨椂閲嶆柊璁$畻闇�姹傛暟閲�
+watch(() => productStructureRecords.value, (newRecords, oldRecords) => {
+  if (oldRecords && oldRecords.length > 0) {
+    oldRecords.forEach((oldItem, index) => {
+      const newItem = newRecords[index];
+      if (oldItem && newItem && newItem.unitQuantity !== oldItem.unitQuantity) {
+        newItem.demandedQuantity = (newItem.unitQuantity || 1) * (formState.value.quantity || 1);
+      }
+    });
+  }
+}, { deep: true });
+
 // 鐩戝惉闇�姹傛暟閲忓彉鍖栵紝閲嶆柊璁$畻鐗╂枡闇�姹傛暟閲�
 watch(() => formState.value.quantity, (newQty) => {
   if (productStructureRecords.value.length > 0 && newQty) {
-    productStructureRecords.value = productStructureRecords.value.map(item => ({
-      ...item,
-      demandedQuantity: (item.unitQuantity || 1) * newQty
-    }));
+    productStructureRecords.value.forEach(item => {
+      item.demandedQuantity = (item.unitQuantity || 1) * newQty;
+    });
   }
 });
 
+// 鍗曚綅浜у嚭闇�瑕佹暟閲忓彉鍖栧鐞�
+const handleUnitQuantityChange = (val, row) => {
+  row.demandedQuantity = (val || 1) * (formState.value.quantity || 1);
+};
+
 // 宸ュ簭閫夋嫨鍙樺寲澶勭悊
 const handleProcessChange = (processId, row) => {
   const selectedProcess = processRouteItemsOptions.value.find(item => item.processId === processId);

--
Gitblit v1.9.3