From 88c13135d045d43657fd62d4cc66ca6b390f276c Mon Sep 17 00:00:00 2001
From: baoshiwei <baoshiwei@shlanbao.cn>
Date: 星期一, 16 六月 2025 09:51:17 +0800
Subject: [PATCH] style(eims-ui-mobile): 优化多个页面的样式布局

---
 eims-ui-mobile/src/pages/inspect/insp-record.vue |   77 ++++++++++++++++++++++++++++++--------
 1 files changed, 60 insertions(+), 17 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..6f5d32a 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>
@@ -120,7 +124,7 @@
             </view>
           </template>
 
-          <view v-if="item.showDesc" class="mt-2">
+          <view v-if="item.inspResult === '2'" class="mt-2">
             <wd-input
               v-model="item.inspDesc"
               placeholder="璇疯緭鍏ュ紓甯告弿杩�"
@@ -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">
+        <wd-button type="primary" style="margin: 20px" block  v-if="inspSt.status === '0' || inspSt.status === '1'" @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>
@@ -181,7 +186,7 @@
 
 <script setup lang="ts">
 import { useUserStore, useAccessStore, useSystemConfigStore } from '@/store'
-import { isLeader, isOperatorOrRepair } from '@/utils/RoleUtils'
+import { isLeader, isLineOrRepair } from '@/utils/RoleUtils'
 import {
   getInspStRecordList,
   getInspSt,
@@ -217,6 +222,8 @@
   specialNote: string
   runTimes: number
   faultTimes: number
+  verifyUser?: number | string
+  verifyTime?: string
 }
 
 const dataChange = ref(false)
@@ -237,8 +244,8 @@
   status: '',
   inspUser: '',
   specialNote: '',
-  runTimes: 0,
-  faultTimes: 0,
+  runTimes: undefined,
+  faultTimes: undefined,
 })
 
 const paging = ref(null)
@@ -273,13 +280,6 @@
   // 淇敼鏃堕棿鏍煎紡涓� YYYY-MM-DD HH:mm:ss
   const now = new Date()
   item.inspTime = `${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')}`
-
-  if (item.inspResult === '2') {
-    item.showDesc = true
-  } else {
-    item.showDesc = false
-    item.inspDesc = ''
-  }
 }
 
 const goBack = () => {
@@ -287,8 +287,11 @@
 }
 
 function handleClickRight() {
-  if (isOperatorOrRepair()) {
+
+  if (inspSt.status === '0') {
     handleConfirm()
+  } else if (inspSt.status === '1') {
+    handleComplete()
   }
 }
 
@@ -356,7 +359,12 @@
 }
 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 +379,41 @@
 }
 
 /**
+ * 纭瀹屾垚鎸夐挳鐐瑰嚮浜嬩欢
+ */
+function handleComplete() {
+  console.log('handleComplete', inspSt)
+  if (!inspSt.runTimes || !inspSt.faultTimes) {
+    message.alert('璇峰~鍐欒繍琛屾鏁板拰鏁呴殰娆℃暟!')
+    return false
+  }
+  const now = new Date();
+  const data: any = Object.assign(
+    {},
+    {
+      id: inspSt.id,
+      runTimes: inspSt.runTimes,
+      faultTimes: inspSt.faultTimes,
+      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