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/maint/maint-order.vue |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 51 insertions(+), 9 deletions(-)

diff --git a/eims-ui-mobile/src/pages/maint/maint-order.vue b/eims-ui-mobile/src/pages/maint/maint-order.vue
index 88398ec..fe14b49 100644
--- a/eims-ui-mobile/src/pages/maint/maint-order.vue
+++ b/eims-ui-mobile/src/pages/maint/maint-order.vue
@@ -25,7 +25,7 @@
         safeAreaInsetTop
       >
         <template #right>
-          <text v-if="isOperatorOrRepair()" class="text-white">鎻愪氦</text>
+          <text v-if="maintSt.status === '0'" class="text-white">鎻愪氦</text>
         </template>
       </wd-navbar>
       <wd-cell>
@@ -48,7 +48,7 @@
             </view>
           </view>
         </template>
-        <view class="flex h-[140rpx]" items-center>
+        <view class="flex" items-center>
           <image class="slot-img text-center" src="/static/images/camera.png" />
           <view class="flex-1">
             <view class="text-color-gray text-sm mt-1 flex">
@@ -60,14 +60,18 @@
               <text class="mr-3">寰呬繚鍏�: {{ maintSt.dbyCount }}</text>
               |
               <text class="mx-3">淇濆吇涓�: {{ maintSt.byCount }}</text>
-              |
-              <text class="ml-3">寰呴獙璇�: {{ maintSt.dyzCount }}</text>
+<!--              |-->
+<!--              <text class="ml-3">寰呴獙璇�: {{ maintSt.dyzCount }}</text>-->
             </view>
             <view class="text-color-gray text-sm mt-2 flex">
               <text>鐘舵�侊細</text>
               <template v-if="maintSt.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="maintSt.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>
@@ -205,11 +209,16 @@
         placeholder="璇疯緭鍏ョ壒璁颁簨椤�"
         clearable
       />
+      <!-- 鏂板纭瀹屾垚鎸夐挳 -->
+      <view class="flex justify-around mt-4">
+        <wd-button type="primary" block size="large" v-if="maintSt.status === '0'" @click="handleClickRight">鎻愪氦</wd-button>
+        <wd-button type="success" block size="large" v-if="isLeader() && maintSt.status === '1'" @click="handleComplete">纭瀹屾垚</wd-button>
+      </view>
     </view>
     <!-- 鏂板鎻愪氦鎸夐挳 -->
-    <view class="flex justify-center mt-4">
-      <wd-button type="primary" block size="large" @click="handleClickRight">鎻愪氦</wd-button>
-    </view>
+<!--    <view class="flex justify-center mt-4">-->
+<!--      <wd-button type="primary" block size="large" @click="handleClickRight">鎻愪氦</wd-button>-->
+<!--    </view>-->
   </z-paging>
 
   <!-- 澶囦欢閫夋嫨寮瑰嚭灞� -->
@@ -340,7 +349,7 @@
 }
 
 function loadSpareParts(value?: string) {
-  getSpareList({ name: value }).then((res: any) => {
+  getSpareList({ name: value, pageNum: 1, pageSize: 10 }).then((res: any) => {
     sparePartsList.value = res.rows
 
   })
@@ -498,7 +507,8 @@
           .then((res: any) => {
             resolve(true)
             if (res?.code === 200) {
-              reloadData()
+              uni.$emit('maint-st-refresh')
+              goBack()
               toastSucces()
             }
           })
@@ -604,6 +614,38 @@
     });
 }
 
+/**
+ * 纭瀹屾垚鎸夐挳鐐瑰嚮浜嬩欢
+ */
+function handleComplete() {
+  if (!isLeader()) {
+    toast.info('鏃犳潈闄愭搷浣�');
+    return;
+  }
+  const now = new Date();
+  const data: any = Object.assign(
+    {},
+    {
+      id: maintSt.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')}`
+    },
+  )
+  updateMaintSt(data)
+    .then((res: any) => {
+      if (res?.code === 200) {
+        uni.$emit('maint-st-refresh')
+        goBack()
+        toastSucces()
+      }
+    })
+    .catch((res) => {
+      console.error(res)
+    })
+
+}
+
 // 鏂板鏂规硶锛氳幏鍙栫姸鎬佹枃鏈�
 function getStatusText(maintFun: string): string {
   switch (maintFun) {

--
Gitblit v1.9.3