From e62bbded9ae11eb3fc42df8170f87d17a2d32c44 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期三, 25 三月 2026 17:24:50 +0800
Subject: [PATCH] 编辑成品检验时,需加上不良数量,合格数量字段。页面列表也需要加上不良数量、合格数量字段。不良数量可以手填,合格数量、数量都置灰。根据不良数量+合格数量=数量这一逻辑计算。若不填默认不良数量为0。数量是订单本次生产数量-报废数量

---
 src/views/qualityManagement/processInspection/components/formDia.vue |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/src/views/qualityManagement/processInspection/components/formDia.vue b/src/views/qualityManagement/processInspection/components/formDia.vue
index 5626d35..58cca54 100644
--- a/src/views/qualityManagement/processInspection/components/formDia.vue
+++ b/src/views/qualityManagement/processInspection/components/formDia.vue
@@ -262,9 +262,26 @@
 // 鐩戝惉涓嶈壇鏁伴噺鍙樺寲锛岃嚜鍔ㄦ洿鏂版暟閲�
 // 褰� defectiveQuantity 澧炲姞鏃讹紝quantity 鍑忓皯锛涘綋 defectiveQuantity 鍑忓皯鏃讹紝quantity 澧炲姞
 watch(() => form.value.defectiveQuantity, (newVal, oldVal) => {
+  if (newVal > form.value.quantity) {
+    form.value.defectiveQuantity = form.value.quantity;
+  }
   form.value.qualifiedQuantity = Number((form.value.quantity - newVal).toFixed(2));
 });
 
+// 鐩戝惉鎬绘暟閲忓彉鍖栵紝鑷姩鏇存柊鍚堟牸鏁伴噺
+watch(() => form.value.quantity, (newVal, oldVal) => {
+  const totalQty = Number(newVal) || 0;
+  const defectiveQty = Number(form.value.defectiveQuantity) || 0;
+
+  // 纭繚涓嶈壇鏁伴噺涓嶈秴杩囨�绘暟閲�
+  if (defectiveQty > totalQty) {
+    form.value.defectiveQuantity = totalQty;
+  }
+
+  // 璁$畻鍚堟牸鏁伴噺
+  form.value.qualifiedQuantity = Number((totalQty - defectiveQty).toFixed(2));
+});
+
 // 鎵撳紑寮规
 const openDialog = async (type, row) => {
 	operationType.value = type;

--
Gitblit v1.9.3