From 4ccf803bfff08d76653376c99d8cb862a7030157 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 27 三月 2026 16:56:03 +0800
Subject: [PATCH] 军泰伟业 1.已发货数量等于总数量时,状态为已发货。已发货数量小于总数量时,状态建议新增发货中 2.产品清除工艺路线点击确定后,仍然回显绑定的工艺路线 3.新增退货单时,退一部分货后,继续对此退货单进行退货操作,展示数据有误

---
 src/views/productionManagement/productionOrder/New.vue |   47 +++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 39 insertions(+), 8 deletions(-)

diff --git a/src/views/productionManagement/productionOrder/New.vue b/src/views/productionManagement/productionOrder/New.vue
index 51e5404..2109385 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">
@@ -419,7 +426,8 @@
     const items = res.data || [];
     processRouteItemsOptions.value = items;
     
-    // 鑷姩娣诲姞宸ュ簭
+    // 鑷姩娣诲姞宸ュ簭锛岃鍒掓暟浣跨敤鍩烘湰淇℃伅鐨勯渶姹傛暟閲�
+    const demandQty = formState.value.quantity || 1;
     processRouteItems.value = items.map(item => ({
       processId: item.processId,
       processName: item.processName,
@@ -427,7 +435,7 @@
       userPower: item.userPower ? item.userPower.split(',') : [],
       planStartTime: "",
       planEndTime: "",
-      planNum: 1,
+      planNum: demandQty,
       isQuality: item.isQuality || false,
     }));
   });
@@ -477,16 +485,39 @@
   });
 };
 
-// 鐩戝惉闇�姹傛暟閲忓彉鍖栵紝閲嶆柊璁$畻鐗╂枡闇�姹傛暟閲�
+// 鐩戝惉鐗╂枡娓呭崟鍙樺寲锛屽綋鍗曚綅浜у嚭闇�瑕佹暟閲忓彉鍖栨椂閲嶆柊璁$畻闇�姹傛暟閲�
+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;
+    });
+  }
+  // 鏇存柊宸ュ簭鐨勮鍒掓暟
+  if (processRouteItems.value.length > 0 && newQty) {
+    processRouteItems.value.forEach(item => {
+      item.planNum = 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