From 2ab727eb8a56077d9ad52112a9c8e97010b84b6d Mon Sep 17 00:00:00 2001
From: baoshiwei <baoshiwei@shlanbao.cn>
Date: 星期一, 09 六月 2025 19:50:49 +0800
Subject: [PATCH] feat(eims): 优化保养计划和点检记录功能

---
 eims-ui-mobile/src/pages/inspect/insp-record.vue |   53 ++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 48 insertions(+), 5 deletions(-)

diff --git a/eims-ui-mobile/src/pages/inspect/insp-record.vue b/eims-ui-mobile/src/pages/inspect/insp-record.vue
index 42d7841..c039bad 100644
--- a/eims-ui-mobile/src/pages/inspect/insp-record.vue
+++ b/eims-ui-mobile/src/pages/inspect/insp-record.vue
@@ -24,7 +24,7 @@
         safeAreaInsetTop
       >
         <template #right>
-          <text v-if="isOperatorOrRepair()" class="text-white">鎻愪氦</text>
+          <text v-if="inspSt.status === '0'" class="text-white">鎻愪氦</text>
         </template>
       </wd-navbar>
       <wd-card type="rectangle">
@@ -61,9 +61,13 @@
             </view>
             <view class="text-color-gray text-sm mt-2 flex">
               <text>鐘舵�侊細</text>
-              <template v-if="dataCount > 0 && dataCount === checkCount">
+              <template v-if="inspSt.status === '1'">
                 <wd-icon class="icon-color-success" name="check-outline" size="34rpx"></wd-icon>
                 <text class="ml-1">宸插畬鎴�</text>
+              </template>
+              <template v-else-if="inspSt.status === '2'">
+                <wd-icon class="icon-color-warning" name="check-outline" size="34rpx"></wd-icon>
+                <text class="ml-1">宸茬‘璁�</text>
               </template>
               <template v-else>
                 <wd-icon class="icon-color-base" name="detection" size="40rpx"></wd-icon>
@@ -172,8 +176,9 @@
         size="large"
       />
       <!-- 鏂板鎻愪氦鎸夐挳 -->
-      <view class="flex justify-center mt-4">
-        <wd-button type="primary" block size="large" @click="handleClickRight">鎻愪氦</wd-button>
+      <view class="flex justify-around mt-4">
+        <wd-button type="primary" block size="large" v-if="inspSt.status === '0'" @click="handleClickRight">鎻愪氦</wd-button>
+        <wd-button type="success" block size="large" v-if="isLeader() && inspSt.status === '1'" @click="handleComplete">纭瀹屾垚</wd-button>
       </view>
     </view>
   </z-paging>
@@ -217,6 +222,8 @@
   specialNote: string
   runTimes: number
   faultTimes: number
+  verifyUser?: number | string
+  verifyTime?: string
 }
 
 const dataChange = ref(false)
@@ -356,7 +363,11 @@
 }
 function updateInspSt(resolve: any) {
   // 鏇存柊鐐规姹囨��
-  inspSt.status = '1'
+  if (dataCount.value === selectedItems.value.length) {
+    inspSt.status = '1'
+  } else {
+    inspSt.status = '0'
+  }
   updateInspectSt(inspSt)
     .then((res: any) => {
       toast.success('鎿嶄綔鎴愬姛')
@@ -371,6 +382,38 @@
 }
 
 /**
+ * 纭瀹屾垚鎸夐挳鐐瑰嚮浜嬩欢
+ */
+function handleComplete() {
+  if (!isLeader()) {
+    toast.info('鏃犳潈闄愭搷浣�');
+    return;
+  }
+  const now = new Date();
+  const data: any = Object.assign(
+    {},
+    {
+      id: inspSt.id,
+      status: '2',
+      verifyUser: userStore?.userInfo?.userId,
+      verifyTime: `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')} ${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}:${String(now.getSeconds()).padStart(2, '0')}`
+    },
+  )
+  updateInspectSt(data)
+    .then((res: any) => {
+      if (res?.code === 200) {
+        uni.$emit('insp-st-refresh')
+        goBack()
+        toast.success('鎿嶄綔鎴愬姛')
+      }
+    })
+    .catch((res) => {
+      console.error(res)
+      toast.error('鎿嶄綔澶辫触')
+    })
+}
+
+/**
  * 鐐规璁板綍鏉$洰鐐瑰嚮浜嬩欢
  * @param item
  */

--
Gitblit v1.9.3