From a240efebce056b05387cfff820f209b9f4737df7 Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期三, 03 十二月 2025 16:05:25 +0800
Subject: [PATCH] 实时计算使用次数

---
 components/mold.vue |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/components/mold.vue b/components/mold.vue
index f63983c..e1eafc8 100644
--- a/components/mold.vue
+++ b/components/mold.vue
@@ -115,7 +115,16 @@
                                 {{ item.downCount != null ? item.downCount : '' }}
                             </template>
                         </td>
-                        <td class="num">{{ item.useCount != null ? item.useCount : '' }}</td>
+                        <!--<td class="num">{{ item.useCount != null ? item.useCount : '' }}</td>--><!--浣跨敤娆℃暟-->
+                        <td class="num">
+                            <template v-if="idx === 0">
+                                <!-- 绗竴琛屽疄鏃惰绠椾娇鐢ㄦ鏁� -->
+                                {{item.currentCjNum != null && item.upCount != null ? (Number(item.currentCjNum) - Number(item.upCount)) : (item.useCount != null ? item.useCount : '') }}
+                            </template>
+                            <template v-else>
+                                {{ item.useCount != null ? item.useCount : '' }}
+                            </template>
+                        </td>
                         <td class="num">{{ item.useLimit != null ? item.useLimit : '' }}</td>
                         <td class="num">{{ item.lifePercent }}</td>
                         <td class="num">{{ item.lifeWarn }}</td>
@@ -214,10 +223,9 @@
                 if (this.machineNo && this.workOrderNo) {
                     await this.fetchFormData();
                     await this.fetchDefaultToolFromWorkOrder();
-                    // 鍙洿鏂扮涓�琛� currentCjNum
+                    // 鍒锋柊鍚庤祴鍊肩涓�琛� currentCjNum
                     if (this.toolRecords.length > 0) {
-                        const cjNum = await this.fetchCurrentCjNum(this.toolRecords[0].no);
-                        this.$set(this.toolRecords[0], 'currentCjNum', cjNum);
+                        this.$set(this.toolRecords[0], 'currentCjNum', this.workOrderCurrentCjNum);
                     }
                 }
                 this.$showMessage('鍒锋柊瀹屾垚');
@@ -671,17 +679,13 @@
             this.fetchTools('');
             this.machineNo = uni.getStorageSync('machineNo') || '';
             this.workOrderNo = uni.getStorageSync('daa001') || '';
-            // 鍘婚櫎榛樿棰勮鍊� (90% -> 0.9)
-            //this.lifeWarnInput = '90';
 
             if (this.machineNo && this.workOrderNo) {
                 this.fetchFormData().then(async () => {
-                    // 鍔犺浇宸ュ崟鍒�鍏蜂俊鎭�
                     await this.fetchDefaultToolFromWorkOrder();
-                    // 杩涘叆椤甸潰鏃跺姞杞界涓�琛� currentCjNum
+                    // 杩涘叆椤甸潰鏃惰祴鍊肩涓�琛� currentCjNum
                     if (this.toolRecords.length > 0) {
-                        const cjNum = await this.fetchCurrentCjNum(this.toolRecords[0].no);
-                        this.$set(this.toolRecords[0], 'currentCjNum', cjNum);
+                        this.$set(this.toolRecords[0], 'currentCjNum', this.workOrderCurrentCjNum);
                     }
                 });
             } else {

--
Gitblit v1.9.3