From 63b196231b45186ee968e8e75d0c039e4c8f7193 Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期五, 24 十月 2025 17:27:12 +0800
Subject: [PATCH] 按上刀时间降序排序(越晚的越上面)

---
 components/mold.vue |   35 +++++++++++++++++++++++++++++++----
 1 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/components/mold.vue b/components/mold.vue
index 7667d29..03b19ca 100644
--- a/components/mold.vue
+++ b/components/mold.vue
@@ -108,9 +108,7 @@
 
         <!-- 璇存槑 -->
         <view class="tool-desc">
-            <p style="color:red;">褰撳墠宸ュ崟涓紝鎹簡鍑犳鍒�锛屽氨浼氫骇鐢熷嚑鏉℃暟鎹�備笂鍒�鏃堕棿銆佷笅鍒�鏃堕棿鍦ㄨ〃涓兘鐪嬪埌銆�</p>
-            <p style="color:red;">涓婂垁鏃堕棿鍜屽搴旀椂闂寸敤鐢熶骇璁℃暟鍣ㄥ尮閰嶏紝鏌ュ嚭褰撴椂鐨勭敓浜ф暟锛堢疮璁¤鏁帮級銆�</p>
-            <p style="color:red;">瀵垮懡姣旈璀﹀�煎湪鍒�鍏蜂笂锛岄粯璁ょ粺涓�銆�</p>
+            <p style="color:red;">'浣跨敤涓婇檺'浠ヤ笅鍒�鏃剁殑'浣跨敤涓婇檺'涓鸿绠楁爣鍑�</p>
         </view>
     </view>
 </template>
@@ -189,10 +187,12 @@
                             return null;
                         };
 
+                        // 杩欓噷闇�瑕佹妸 lifeWarn 瀛楁涔熷甫鍑烘潵
                         const mapped = (payload || []).map(t => ({
                             no: getField(t, 'cutterId', 'CUTTER_ID', 'cutteR_ID', 'daA001', 'no'),
                             name: getField(t, 'cutterName', 'CUTTER_NAME', 'cutteR_NAME', 'name'),
-                            model: getField(t, 'cutterModel', 'CUTTER_MODEL', 'cutteR_MODEL', 'model')
+                            model: getField(t, 'cutterModel', 'CUTTER_MODEL', 'cutteR_MODEL', 'model'),
+                            lifeWarn: getField(t, 'modlLifeWorning', 'lifeWarn', 'LIFE_WARN', 'lifE_WARN')
                         }));
 
                         this.filteredTools = mapped;
@@ -242,6 +242,14 @@
                 this.toolName = tool.name;
                 this.toolModel = tool.model;
                 this.activeToolNo = tool.no;
+                // 鏂板锛氬甫鍑哄鍛芥瘮棰勮鍊�
+                if (tool.lifeWarn !== undefined && tool.lifeWarn !== null) {
+                    // 鏍煎紡鍖栦负鐧惧垎姣斿瓧绗︿覆
+                    const warn = Number(tool.lifeWarn);
+                    this.lifeWarnInput = warn <= 1 ? `${(warn * 100).toFixed(0)}%` : `${warn.toFixed(0)}%`;
+                } else {
+                    this.lifeWarnInput = '';
+                }
             },
             confirmTool() {
                 this.showToolDialog = false;
@@ -458,6 +466,18 @@
                         };
                     });
 
+                    // 鏂板锛氭寜涓婂垁鏃堕棿闄嶅簭鎺掑簭锛堣秺鏅氱殑瓒婁笂闈級
+                    mapped.sort((a, b) => {
+                        // 鏃堕棿鏍煎紡濡� "10-24 16:03"锛岃浆涓� Date 瀵硅薄姣旇緝
+                        const parse = s => {
+                            if (!s) return 0;
+                            // 琛ュ勾浠斤紝鍋囪閮芥槸浠婂勾
+                            const year = new Date().getFullYear();
+                            return new Date(`${year}-${s.replace(/-/g, '-')}:00`).getTime();
+                        };
+                        return parse(b.upTime) - parse(a.upTime); // 娉ㄦ剰杩欓噷椤哄簭鍙嶈繃鏉�
+                    });
+
                     this.toolRecords = mapped;
                     const totalFromRes = Number(
                         res.data?.total ?? res.data?.totalCount ?? res.total ?? res.totalCount ?? mapped.length
@@ -487,6 +507,13 @@
                         this.toolModel = order.cutterModel || order.cutteR_MODEL || '';
                         // 鍏抽敭锛氳幏鍙栧伐鍗曟渶鏂伴噰闆嗘暟
                         this.workOrderCurrentCjNum = order.CurrentCjNum ?? order.currentCjNum ?? null;
+                        // 鏂板锛氳嚜鍔ㄥ~鍏呭鍛芥瘮棰勮鍊�
+                        if (order.modlLifeWorning !== undefined && order.modlLifeWorning !== null) {
+                            const warn = Number(order.modlLifeWorning);
+                            this.lifeWarnInput = warn <= 1 ? `${(warn * 100).toFixed(0)}%` : `${warn.toFixed(0)}%`;
+                        } else {
+                            this.lifeWarnInput = '';
+                        }
                     } else {
                         this.workOrderCurrentCjNum = null;
                     }

--
Gitblit v1.9.3