From aa096d5f3823934b71c3dd65cb376f486eb3e469 Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期六, 18 十月 2025 09:04:53 +0800
Subject: [PATCH] “不良数”和“良品数”会实时联动显示

---
 components/WorkOrderPrint.vue |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/components/WorkOrderPrint.vue b/components/WorkOrderPrint.vue
index bbbe1dc..2944ed1 100644
--- a/components/WorkOrderPrint.vue
+++ b/components/WorkOrderPrint.vue
@@ -33,7 +33,7 @@
 								<td>{{ order.currentCjNum }}</td><!--鎶ュ伐鏃堕噰闆嗘暟-->
 								<td>{{ order.currentCjNum - order.initCjNum }}</td><!--鎶ュ伐鏁帮紙璁$畻锛�-->
 								<td>{{ calculatedDefectiveCount }}</td><!--涓嶈壇鏁�-->
-								<td>{{ order.currentCjNum - order.initCjNum - calculatedDefectiveCount }}</td><!--鑹搧鏁帮紙璁$畻锛�-->
+								<td>{{ realTimeOkCount }}</td><!--鑹搧鏁帮紙璁$畻锛�-->
 							</tr>
 							<!-- 鍘嗗彶鎶ュ伐璁板綍琛� -->
 							<tr v-for="(r, idx) in reportingHistory" :key="idx">
@@ -215,7 +215,19 @@
 				reportingHistory: []
 			}
 		},
-        computed: {
+		computed: {
+	        //鑹搧鏁板疄鏃惰绠�
+            realTimeDefectiveCount() {
+                // 浼樺厛鐢ㄨ緭鍏ユ鐨勫�硷紝鍚﹀垯鐢ㄦ帴鍙f暟鎹�
+                const val = Number(this.customAmount);
+                if (!isNaN(val) && this.customAmount !== '') return val;
+                return this.calculatedDefectiveCount;
+            },
+            realTimeOkCount() {
+                // 鑹搧鏁� = 鎶ュ伐鏁帮紙璁$畻锛� - 涓嶈壇鏁�
+                const total = (this.order.currentCjNum || 0) - (this.order.initCjNum || 0);
+                return total - this.realTimeDefectiveCount;
+            },
             calculatedCurrentCount() { return (this.productionCount || 0) - (this.initialValue || 0); },
             calculatedTotalProduction() { return (this.kgQty || 0); }, // 鑻ラ渶鎭㈠鏃ч�昏緫鍙敤 (this.kgQty||0)+this.calculatedCurrentCount
             calculatedDefectiveCount() { return this.calculatedTotalProduction - (this.sQuantity || 0); },

--
Gitblit v1.9.3