From 4f3d4cdf483850cc4a0557b3617dffd15591ece2 Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期三, 03 十二月 2025 17:02:31 +0800
Subject: [PATCH] 滑条

---
 components/mold.vue |  116 +++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 94 insertions(+), 22 deletions(-)

diff --git a/components/mold.vue b/components/mold.vue
index bce9416..9acf1a1 100644
--- a/components/mold.vue
+++ b/components/mold.vue
@@ -86,17 +86,18 @@
             <table class="styled-table">
                 <thead>
                     <tr>
-                        <th style="width:8%">鍒�鍏风紪鍙�</th>
-                        <th style="width:14%">鍒�鍏峰悕绉�</th>
-                        <th style="width:12%">涓婂垁鏃堕棿</th>
-                        <th class="num" style="width:8%">涓婂垁璁℃暟</th>
-                        <th style="width:12%">涓嬪垁鏃堕棿</th>
-                        <th class="num" style="width:8%">涓嬪垁璁℃暟</th>
-                        <th class="num" style="width:8%">浣跨敤娆℃暟</th>
-                        <th class="num" style="width:8%">浣跨敤涓婇檺</th>
-                        <th class="num" style="width:8%">瀵垮懡姣�%</th>
-                        <th class="num" style="width:8%">瀵垮懡姣旈璀﹀��</th>
-                        <th style="width:8%">棰勮鐘舵��</th>
+                        <th style="width:7%">鍒�鍏风紪鍙�</th>
+                        <th style="width:12%">鍒�鍏峰悕绉�</th>
+                        <th style="width:10%">涓婂垁鏃堕棿</th>
+                        <th class="num" style="width:7%">涓婂垁璁℃暟</th>
+                        <th style="width:10%">涓嬪垁鏃堕棿</th>
+                        <th class="num" style="width:7%">涓嬪垁璁℃暟</th>
+                        <th class="num" style="width:7%">浣跨敤娆℃暟</th>
+                        <th class="num" style="width:7%">浣跨敤涓婇檺</th>
+                        <th class="num" style="width:7%">瀵垮懡姣�%</th>
+                        <th class="num" style="width:7%">瀵垮懡姣旈璀﹀��</th>
+                        <th style="width:7%">棰勮鐘舵��</th>
+                        <th style="width:7%">鍒�鍏峰湪鏈虹姸鎬�</th>
                     </tr>
                 </thead>
                 <tbody>
@@ -106,18 +107,63 @@
                         <td>{{ item.upTime }}</td>
                         <td class="num">{{ item.upCount != null ? item.upCount : '' }}</td>
                         <td>{{ item.downTime }}</td>
-                        <td class="num">{{ item.downCount != null ? item.downCount : '' }}</td>
-                        <td class="num">{{ item.useCount != null ? item.useCount : '' }}</td>
+                        <!-- 鍙湁绗竴琛屾樉绀� currentCjNum锛屽叾瀹冭鏄剧ず downCount -->
+                        <td class="num">
+                            <template v-if="idx === 0">
+                                <!-- 绗竴琛岋細涓嬫満鏃朵笉瀹炴椂鏄剧ず currentCjNum锛屾樉绀� downCount -->
+                                <template v-if="!item.downTime">
+                                    {{ item.currentCjNum != null ? item.currentCjNum : '' }}
+                                </template>
+                                <template v-else>
+                                    {{ item.downCount != null ? item.downCount : '' }}
+                                </template>
+                            </template>
+                            <template v-else>
+                                {{ item.downCount != null ? item.downCount : '' }}
+                            </template>
+                        </td>
+                        <!--浣跨敤娆℃暟-->
+                        <td class="num">
+                            <template v-if="idx === 0">
+                                <!-- 绗竴琛屽疄鏃惰绠椾娇鐢ㄦ鏁帮紝鑻ヤ负涓嬫満鍒欎笉瀹炴椂鏄剧ず -->
+                                <template v-if="!item.downTime">
+                                    {{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>
+                            </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">
+                            <template v-if="idx === 0">
+                                <!-- 绗竴琛屽疄鏃惰绠楀鍛芥瘮%锛岃嫢涓轰笅鏈哄垯涓嶅疄鏃舵樉绀� -->
+                                <template v-if="!item.downTime">
+                                    {{item.currentCjNum != null && item.upCount != null && item.useLimit != null && Number(item.useLimit) > 0 ? Math.round((Number(item.currentCjNum) - Number(item.upCount)) / Number(item.useLimit) * 100) + '%' : (item.lifePercent != null ? item.lifePercent : '') }}
+                                </template>
+                                <template v-else>
+                                    {{ item.lifePercent != null ? item.lifePercent : '' }}
+                                </template>
+                            </template>
+                            <template v-else>
+                                {{ item.lifePercent }}
+                            </template>
+                        </td>
                         <td class="num">{{ item.lifeWarn }}</td>
                         <td :class="item.warnStatus === '棰勮' ? 'warn-cell' : (item.warnStatus === '姝e父' ? 'ok-cell' : '')">
                             <span v-if="item.warnStatus === '棰勮'" class="warn-badge">璀﹀憡</span>
                             <span v-else>{{ item.warnStatus }}</span>
                         </td>
+                        <td>
+                            {{ item.downTime ? '涓嬫満' : '鍦ㄦ満' }}<!--鍦ㄦ満鐘舵��-->
+                        </td>
                     </tr>
                     <tr v-if="!toolRecords.length">
-                        <td colspan="11">鏆傛棤鏁版嵁</td>
+                        <td colspan="12">鏆傛棤鏁版嵁</td>
                     </tr>
                 </tbody>
             </table>
@@ -179,13 +225,37 @@
             toolModel() { this.isDirty = true; }
         },
         methods: {
+            //鏌ヨ褰撳墠鏁伴噰鏁帮紝浣滀负涓嬪垁璁℃暟瀹炴椂鏄剧ず
+            async fetchCurrentCjNum(toolNo) {
+                if (!this.machineNo) return null;
+                try {
+                    const res = await this.$post({
+                        url: '/Womdaa/GetWomdaasByShow',
+                        data: JSON.stringify({ machineNo: this.machineNo }),
+                        headers: { 'Content-Type': 'application/json' }
+                    });
+                    if (res.status === 0 && Array.isArray(res.data?.tbBillList)) {
+                        const found = res.data.tbBillList.find(x =>
+                            x.cutterId === toolNo || x.cutteR_ID === toolNo
+                        );
+                        return found ? (found.CurrentCjNum ?? found.currentCjNum ?? null) : null;
+                    }
+                } catch (e) {
+                    console.warn('鑾峰彇currentCjNum澶辫触', e);
+                }
+                return null;
+            },
+
             // 鏂板锛氬埛鏂版寜閽鐞嗘柟娉�
             async handleRefresh() {
-                // 鍒锋柊鍒�鍏峰垪琛ㄥ拰琛ㄥ崟鏁版嵁
                 this.fetchTools('');
                 if (this.machineNo && this.workOrderNo) {
                     await this.fetchFormData();
                     await this.fetchDefaultToolFromWorkOrder();
+                    // 鍒锋柊鍚庤祴鍊肩涓�琛� currentCjNum
+                    if (this.toolRecords.length > 0) {
+                        this.$set(this.toolRecords[0], 'currentCjNum', this.workOrderCurrentCjNum);
+                    }
                 }
                 this.$showMessage('鍒锋柊瀹屾垚');
             },
@@ -638,18 +708,21 @@
             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();
-                this.fetchDefaultToolFromWorkOrder();
+                this.fetchFormData().then(async () => {
+                    await this.fetchDefaultToolFromWorkOrder();
+                    // 杩涘叆椤甸潰鏃惰祴鍊肩涓�琛� currentCjNum
+                    if (this.toolRecords.length > 0) {
+                        this.$set(this.toolRecords[0], 'currentCjNum', this.workOrderCurrentCjNum);
+                    }
+                });
             } else {
                 console.warn('鏈哄彴鍙锋垨宸ュ崟鍙蜂负绌猴紝鏃犳硶鑾峰彇琛ㄥ崟鏁版嵁');
             }
 
             // 鍚姩鑷姩淇濆瓨瀹氭椂鍣�
-            this.startAutoSave();
+            //this.startAutoSave();
         },
         beforeDestroy() {
             // 娓呯悊瀹氭椂鍣紝闃叉鍐呭瓨娉勬紡
@@ -1136,5 +1209,4 @@
         margin-right: 16px;
         flex: none !important; /* 鍏抽敭锛氬交搴曠姝lex鎷変几 */
     }
-
 </style>
\ No newline at end of file

--
Gitblit v1.9.3