From bab490d2da009c1a23b352b3b964e0c2dd06a0b3 Mon Sep 17 00:00:00 2001
From: baoshiwei <baoshiwei@shlanbao.cn>
Date: 星期四, 12 六月 2025 17:32:42 +0800
Subject: [PATCH] 移动端功能优化

---
 eims-ui-mobile/src/pages/scan/index.vue |  116 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 113 insertions(+), 3 deletions(-)

diff --git a/eims-ui-mobile/src/pages/scan/index.vue b/eims-ui-mobile/src/pages/scan/index.vue
index b9ccad5..eecf651 100644
--- a/eims-ui-mobile/src/pages/scan/index.vue
+++ b/eims-ui-mobile/src/pages/scan/index.vue
@@ -57,10 +57,44 @@
         <view class="h-[1px] bg-base"></view>
         <view class="bg-white flex justify-around py-4">
           <wd-button icon="edit-outline" @click.stop="handleInsp">鐐规</wd-button>
-          <wd-button icon="laptop" @click.stop="handMaint">淇濆吇</wd-button>
-          <wd-button icon="tools" @click.stop="showActions">缁翠慨</wd-button>
+          <wd-button icon="laptop" v-if="isRepair() || isLeader()" @click.stop="handMaint">
+            淇濆吇
+          </wd-button>
+          <wd-button icon="laptop" @click.stop="handleRequest">鎶ヤ慨</wd-button>
+          <!--          <wd-button icon="tools" @click.stop="showActions">缁翠慨</wd-button>-->
         </view>
       </view>
+      <view class="h-[10px] bg-base"></view>
+      <wd-tabs v-model="tab">
+
+        <wd-tab title="缁翠慨璇锋眰">
+          <view class="h-[10px] bg-base"></view>
+          <!-- 缁翠慨璇锋眰鍖哄煙 -->
+          <view class="mt-2" v-if="reqList.length > 0">
+
+
+            <view class="bg-base">
+              <req-card
+                v-for="item in reqList"
+                :key="item.id"
+                :item="item"
+                @click="handleReqClick"
+              />
+            </view>
+          </view>
+        </wd-tab>
+        <wd-tab title="缁翠慨鍗�">
+          <view class="h-[10px] bg-base"></view>
+          <!-- 缁翠慨鍗曞尯鍩� -->
+          <view class="mt-2" v-if="resList.length > 0">
+
+
+            <view class="bg-base">
+              <res-card v-for="item in resList" :key="item.id" :item="item" />
+            </view>
+          </view>
+        </wd-tab>
+      </wd-tabs>
 
       <wd-action-sheet
         v-model="show"
@@ -79,16 +113,25 @@
 <script setup lang="ts">
 import dayjs from 'dayjs'
 import type { EquVO } from '@/service/equ.d'
+import type { RepairReqVO, RepairResVO } from '@/service/repair.d'
 import { useToast, useMessage } from 'wot-design-uni'
 import { getEquByAssetNo } from '@/service/equ'
 import { getInspStByStId } from '@/service/inspect'
+import { isLeader, isRepair } from '@/utils/RoleUtils'
+import { getRepairReqList, getRepairResList } from '@/service/repair'
+import ReqCard from '@/components/repair/req-card.vue'
+import ResCard from '@/components/repair/res-card.vue'
+import { useUserStore } from '@/store'
+const tab = ref<number>(0)
 const message = useMessage()
 const toast = useToast()
 const model = reactive<EquVO>({})
-
+const userStore = useUserStore()
 const scanResult = ref<string>('')
 const show = ref<boolean>(false)
 const exist = ref<boolean>(false)
+const reqList = ref<RepairReqVO[]>([])
+const resList = ref<RepairResVO[]>([])
 const actions = ref([
   {
     name: '鏂板鎶ヤ慨',
@@ -105,6 +148,8 @@
       if (res?.equId) {
         exist.value = true
         Object.assign(model, res)
+        // 鍔犺浇缁翠慨璇锋眰鍜岀淮淇崟鏁版嵁
+        loadRepairData(res.equId)
       } else {
         toast.error('鏈煡璇㈠埌璇ヨ祫浜х紪鍙风浉鍏虫暟鎹紒')
       }
@@ -114,6 +159,38 @@
       toast.error(res?.data?.msg || '璇锋眰澶辫触')
     })
 }
+
+// 鍔犺浇缁翠慨璇锋眰鍜岀淮淇崟鏁版嵁
+function loadRepairData(equId: string | number) {
+  // 鍔犺浇鏈帴鍗曠殑缁翠慨璇锋眰
+  getRepairReqList({
+    equId,
+    status: '0',
+  }).then((res: any) => {
+    if (res?.rows) {
+      reqList.value = res.rows
+    }
+  })
+
+  // 鍔犺浇鏈畬鎴愮殑缁翠慨鍗�
+  const params = {
+    equId,
+    params: {
+      status: '0,1,2',
+    },
+  }
+  // 濡傛灉鏄淮淇伐鍒欏姞杞芥湰瑕佹帴鍗曠殑缁翠慨鍗�
+  if (isRepair()) {
+    params.resUser = userStore?.userInfo?.userId
+    params.params.status = '0,1,2'
+  }
+  getRepairResList(params).then((res: any) => {
+    if (res?.rows) {
+      resList.value = res.rows
+    }
+  })
+}
+
 function handleInfo() {
   uni.showToast({
     title: '鍔熻兘寮�鍙戜腑',
@@ -152,6 +229,19 @@
   })
 }
 
+function handleRequest() {
+  if (!model?.assetNo) {
+    uni.showToast({
+      title: '鏈煡璇㈠埌璁惧锛岃鑱旂郴绠$悊鍛橈紒',
+      icon: 'none',
+    })
+    return false
+  }
+  uni.navigateTo({
+    url: `/pages/repair/repair-add?equId=${model?.equId}&equName=${model?.equName}&from=scan`,
+  })
+}
+
 function showActions() {
   show.value = true
 }
@@ -159,6 +249,7 @@
 function close() {
   show.value = false
 }
+
 function select({ item, index }) {
   console.error(model?.equId)
   console.error(!model?.equId)
@@ -182,10 +273,29 @@
       break
   }
 }
+;`/pages/repair/req-list`,
+  // 澶勭悊缁翠慨璇锋眰鐐瑰嚮浜嬩欢
+  function handleReqClick(item) {
+    uni.navigateTo({
+      url: `/pages/repair/req-detail?id=${item.id}`,
+    })
+  }
+
+// // 澶勭悊缁翠慨鍗曠偣鍑讳簨浠�
+// function handleResClick(item) {
+//   uni.navigateTo({
+//     url: `/pages/repair/res-detail?id=${item.id}`,
+//   })
+// }
+
 onLoad((options) => {
+  uni.$on('list-refresh', loadRepairData)
   scanResult.value = options?.result
   initData(options?.result)
 })
+onUnload(() => {
+  uni.$off('list-refresh', loadRepairData)
+})
 </script>
 
 <style scoped lang="scss">

--
Gitblit v1.9.3