From 26b2a4b21b3c2cd34e6781cf7876eae580a7e1ec Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期六, 23 五月 2026 15:02:35 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_NEW_pro_鹤壁' into dev_NEW_pro_鹤壁

---
 src/pages/equipmentManagement/repair/index.vue |   91 +++++++++++++++++++++++++++++++++++++++------
 1 files changed, 78 insertions(+), 13 deletions(-)

diff --git a/src/pages/equipmentManagement/repair/index.vue b/src/pages/equipmentManagement/repair/index.vue
index 8c41ab1..c37bd62 100644
--- a/src/pages/equipmentManagement/repair/index.vue
+++ b/src/pages/equipmentManagement/repair/index.vue
@@ -37,10 +37,8 @@
               <text class="item-id">璁惧鍚嶇О锛歿{ item.deviceName }}</text>
             </view>
             <view class="status-tag">
-              <u-tag v-if="item.status === 1"
-                     type="success">瀹岀粨</u-tag>
-              <u-tag v-if="item.status === 0"
-                     type="error">寰呯淮淇�</u-tag>
+              <u-tag :type="getStatusType(item.status)"
+                     size="mini">{{ getStatusLabel(item.status) }}</u-tag>
             </view>
           </view>
           <up-divider></up-divider>
@@ -62,6 +60,10 @@
               <text class="detail-value">{{ item.maintenanceName || '-' }}</text>
             </view>
             <view class="detail-row">
+              <text class="detail-label">楠屾敹浜�</text>
+              <text class="detail-value">{{ item.acceptanceName || '-' }}</text>
+            </view>
+            <view class="detail-row">
               <text class="detail-label">缁翠慨椤圭洰</text>
               <text class="detail-value">{{ item.machineryCategory || '-' }}</text>
             </view>
@@ -75,11 +77,26 @@
             </view>
             <view class="detail-row">
               <text class="detail-label">缁翠慨鏃ユ湡</text>
-              <text class="detail-value">{{ formatDate(item.maintenanceTime) || '-' }}</text>
+              <text class="detail-value">{{ formatDateTime(item.maintenanceTime) || '-' }}</text>
             </view>
           </view>
           <!-- 鎸夐挳鍖哄煙 -->
           <view class="action-buttons">
+            <u-button type="info"
+                      size="small"
+                      plain
+                      class="action-btn"
+                      @click="goDetail(item)">
+              璇︽儏
+            </u-button>
+            <u-button type="success"
+                      size="small"
+                      class="action-btn"
+                      v-if="item.status === 3"
+                      :disabled="!canAccept(item)"
+                      @click="goAcceptance(item)">
+              楠屾敹
+            </u-button>
             <u-button type="primary"
                       size="small"
                       class="action-btn"
@@ -135,6 +152,22 @@
 
   const userStore = useUserStore();
 
+  const STATUS_MAP = {
+    0: { label: "寰呯淮淇�", type: "error" },
+    1: { label: "瀹屾垚", type: "success" },
+    2: { label: "缁翠慨澶辫触", type: "warning" },
+    3: { label: "寰呴獙鏀�", type: "primary" },
+  };
+
+  const getStatusLabel = status => STATUS_MAP[status]?.label || "-";
+  const getStatusType = status => STATUS_MAP[status]?.type || "info";
+
+  const canAccept = item => {
+    if (item.status !== 3) return false;
+    const currentName = userStore.nickName || userStore.name || "";
+    return currentName && item.acceptanceName === currentName;
+  };
+
   // 鎼滅储鍏抽敭璇�
   const searchKeyword = ref("");
 
@@ -154,6 +187,18 @@
     const month = String(date.getMonth() + 1).padStart(2, "0");
     const day = String(date.getDate()).padStart(2, "0");
     return `${year}-${month}-${day}`;
+  };
+
+  const formatDateTime = dateStr => {
+    if (!dateStr) return "";
+    const date = new Date(dateStr);
+    const year = date.getFullYear();
+    const month = String(date.getMonth() + 1).padStart(2, "0");
+    const day = String(date.getDate()).padStart(2, "0");
+    const hours = String(date.getHours()).padStart(2, "0");
+    const minutes = String(date.getMinutes()).padStart(2, "0");
+    const seconds = String(date.getSeconds()).padStart(2, "0");
+    return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
   };
 
   // 鏌ヨ鍒楄〃
@@ -194,7 +239,6 @@
       showToast("鍙傛暟閿欒");
       return;
     }
-    // 浣跨敤uni.setStorageSync瀛樺偍id
     uni.setStorageSync("repairId", id);
     uni.navigateTo({
       url: "/pages/equipmentManagement/repair/maintain",
@@ -208,13 +252,31 @@
     });
   };
 
-  // 缂栬緫 - 璺宠浆鍒癮dd椤甸潰锛岄�氳繃id鍖哄垎鏂板杩樻槸缂栬緫
+  // 缂栬緫
   const edit = id => {
     if (!id) return;
-    // 浣跨敤uni.setStorageSync瀛樺偍id
-    // uni.setStorageSync("repairId", id);
     uni.navigateTo({
       url: "/pages/equipmentManagement/repair/add?id=" + id,
+    });
+  };
+
+  // 璇︽儏
+  const goDetail = item => {
+    uni.setStorageSync("repairDetail", JSON.stringify(item));
+    uni.navigateTo({
+      url: "/pages/equipmentManagement/repair/detail?id=" + item.id,
+    });
+  };
+
+  // 楠屾敹
+  const goAcceptance = item => {
+    if (!canAccept(item)) {
+      showToast("浠呮寚瀹氶獙鏀朵汉鍙繘琛岄獙鏀�");
+      return;
+    }
+    uni.setStorageSync("repairDetail", JSON.stringify(item));
+    uni.navigateTo({
+      url: "/pages/equipmentManagement/repair/acceptance?id=" + item.id,
     });
   };
 
@@ -243,6 +305,9 @@
   };
 
   onMounted(() => {
+    if (!userStore.nickName) {
+      userStore.getInfo().catch(() => {});
+    }
     getList();
   });
 
@@ -254,9 +319,8 @@
 <style scoped lang="scss">
   @import "@/styles/sales-common.scss";
 
-  // 璁惧缁翠慨鐗规湁鏍峰紡
   .sales-account {
-    padding-bottom: 80px; // 涓烘诞鍔ㄦ寜閽暀鍑虹┖闂�
+    padding-bottom: 80px;
   }
 
   .status-tag {
@@ -265,6 +329,7 @@
   }
 
   .action-buttons {
-    gap: 8px; // 涓庡叕鍏辨牱寮忎腑鐨� 12px 涓嶅悓
+    gap: 8px;
+    flex-wrap: wrap;
   }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.9.3