From f29e2aae98bbb52672b67bff99556f3cf64d1bce Mon Sep 17 00:00:00 2001
From: baoshiwei <baoshiwei@shlanbao.cn>
Date: 星期四, 26 六月 2025 15:45:40 +0800
Subject: [PATCH] feat(eims): 优化设备管理功能和界面

---
 eims-ui-mobile/src/pages/maint/maint-st.vue |  133 +++++++++++++++++++++++++++++++++++--------
 1 files changed, 107 insertions(+), 26 deletions(-)

diff --git a/eims-ui-mobile/src/pages/maint/maint-st.vue b/eims-ui-mobile/src/pages/maint/maint-st.vue
index 6704e0b..26848fd 100644
--- a/eims-ui-mobile/src/pages/maint/maint-st.vue
+++ b/eims-ui-mobile/src/pages/maint/maint-st.vue
@@ -11,18 +11,25 @@
 <template>
   <z-paging ref="paging" v-model="dataList" @query="queryList" show-refresher-update-time>
     <template #top>
-      <wd-drop-menu>
-        <wd-drop-menu-item v-model="equName" :options="equList" @change="handleEquName" />
-        <wd-drop-menu-item
-          v-model="filterDate"
-          :options="filterDateList"
-          @change="handleFilterDate"
-        />
-        <wd-drop-menu-item v-model="status" :options="statusList" @change="handleStatus" />
-      </wd-drop-menu>
+      <!-- 澧炲姞涓�涓悳绱㈡爮 -->
+      <wd-search v-model="searchValue" @search="handleSearch">
+        <template #right-icon>
+          <wd-icon name="scan" size="34rpx"></wd-icon>
+        </template>
+      </wd-search>
+      <wd-tabs v-model="activeTab" @change="handleTabChange">
+        <wd-tab title="寰呬繚鍏�"></wd-tab>
+        <wd-tab title="寰呯‘璁�"></wd-tab>
+        <wd-tab title="宸插畬鎴�"></wd-tab>
+      </wd-tabs>
     </template>
     <view class="bg-base">
-      <wd-card type="rectangle" v-for="(item, index) in dataList" :key="item.id">
+      <wd-card
+        type="rectangle"
+        v-for="(item, index) in dataList"
+        :key="item.id"
+        :class="[getCardColorClass(item.planTime)]"
+      >
         <template #title>
           <view class="flex justify-between">
             <view class="flex items-center menu-title-box">
@@ -40,24 +47,30 @@
             </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">
-              <text class="mr-3">宸ュ崟鎬绘暟: {{ item.orderCount }}</text>
+              <text class="mr-3">鎬绘暟: {{ item.orderCount }}</text>
               |
-              <text class="mx-3">宸插畬鎴�: {{ item.wcCount }}</text>
+              <text class="mx-3">宸插畬鎴�: {{ item.dyzCount }}</text>
+              |
+              <text class="mx-3">寰呬繚鍏�: {{ item.dbyCount }}</text>
             </view>
-            <view class="text-color-gray text-sm mt-2 flex">
-              <text class="mr-3">寰呬繚鍏�: {{ item.dbyCount }}</text>
-              |
-              <text class="mx-3">淇濆吇涓�: {{ item.byCount }}</text>
-              |
-              <text class="ml-3">寰呴獙璇�: {{ item.dyzCount }}</text>
-            </view>
+<!--            <view class="text-color-gray text-sm mt-2 flex">-->
+<!--              <text class="mr-3">寰呬繚鍏�: {{ item.dbyCount }}</text>-->
+<!--              |-->
+<!--&lt;!&ndash;              <text class="mx-3">淇濆吇涓�: {{ item.byCount }}</text>&ndash;&gt;-->
+<!--&lt;!&ndash;              |&ndash;&gt;-->
+<!--&lt;!&ndash;              <text class="ml-3">寰呴獙璇�: {{ item.dyzCount }}</text>&ndash;&gt;-->
+<!--            </view>-->
             <view class="text-color-gray text-sm mt-2 flex">
               <text>鐘舵�侊細</text>
               <template v-if="item.status === '1'">
+                <wd-icon class="icon-color-warning" name="check-outline" size="34rpx"></wd-icon>
+                <text class="ml-1">寰呯‘璁�</text>
+              </template>
+              <template v-else-if="item.status === '2'">
                 <wd-icon class="icon-color-success" name="check-outline" size="34rpx"></wd-icon>
                 <text class="ml-1">宸插畬鎴�</text>
               </template>
@@ -76,10 +89,10 @@
 </template>
 
 <script setup lang="ts">
-import { ref } from 'vue'
+import { ref, computed } from 'vue'
 import { getMaintStList } from '@/service/maint'
 import dayjs from 'dayjs'
-
+const searchValue = ref<string>('')
 /**
  * 鍏朵粬椤甸潰浼犺繃鏉ョ殑鏁版嵁
  * assetNo: 璧勪骇缂栧彿
@@ -99,14 +112,47 @@
   params?: NonNullable<unknown>
 }
 
+// 璁$畻宸ュ崟鍗$墖鐨勮儗鏅鑹茬被
+function getCardColorClass(planTime) {
+  if (!planTime) return ''
+
+  const now = dayjs()
+  const planDate = dayjs(planTime)
+
+  // 鑾峰彇璁″垝鏃ユ湡鎵�鍦ㄦ湀浠界殑鏈�鍚庝竴澶�
+  const planMonthEnd = planDate.endOf('month')
+
+  // 璁$畻褰撳墠鏃ユ湡涓庤鍒掓湀鏈堝簳鐨勫樊鍊硷紙澶╂暟锛�
+  const diffDays = planMonthEnd.diff(now, 'day')
+
+  if (diffDays < 0) {
+    // 宸茬粡杩囦簡璁″垝鏈堢殑鏈堝簳锛岀孩鑹茶儗鏅�
+    return 'card-overdue'
+  } else if (diffDays <= 3) {
+    // 璺濈璁″垝鏈堟湀搴�3澶╀互鍐咃紝绾㈣壊鑳屾櫙
+    return 'card-overdue'
+  } else if (diffDays <= 10) {
+    // 璺濈璁″垝鏈堟湀搴�10澶╀互鍐咃紝榛勮壊鑳屾櫙
+    return 'card-urgent'
+  } else {
+    // 姝e父鐘舵�侊紝鑳屾櫙棰滆壊涓嶅彉
+    return ''
+  }
+}
+
 // 椤甸潰鍙傛暟锛屼笂涓〉闈紶閫掕繃鏉ョ殑鍙傛暟
 const option = reactive<PageParams>({
   assetNo: '',
   from: '',
 })
-const status = ref<string>('-1')
+
+// 鏍囩椤电浉鍏�
+const activeTab = ref(0) // 榛樿閫変腑绗竴涓爣绛鹃〉锛堝緟淇濆吇锛�
+
+// 鍘熸湁鐘舵��
+const status = ref<string>('0') // 榛樿涓哄緟淇濆吇鐘舵��
 const equName = ref<string>('-1')
-const filterDate = ref<string>('1')
+const filterDate = ref<string>('0')
 
 const filterDateList = ref<Record<string, any>[]>([
   { label: '鎵�鏈夋暟鎹�', value: '0' },
@@ -121,6 +167,25 @@
   { label: '宸插畬鎴�', value: '3' },
 ])
 const equList = ref<Record<string, any>[]>([{ label: '鎵�鏈夎澶�', value: '-1' }])
+
+// 鏍囩椤靛垏鎹㈠鐞嗗嚱鏁�
+function handleTabChange({ index }) {
+  // 鏍规嵁鏍囩椤电储寮曡缃搴旂殑鐘舵�佸��
+  if (index === 0) {
+    // 寰呬繚鍏�
+    status.value = '0'
+  } else if (index === 1) {
+    // 寰呯‘璁�
+    status.value = '1'
+  } else if (index === 2) {
+    // 宸插畬鎴�
+    status.value = '2'
+  }
+  // 閲嶆柊鍔犺浇鏁版嵁
+  reloadData()
+}
+
+// 鍘熸湁鍑芥暟
 function handleStatus({ value }) {}
 function handleEquName({ value }) {
   console.log(value)
@@ -140,6 +205,7 @@
     pageSize,
     equName: equName.value,
     status: status.value,
+    params: {},
   }
   if (filterDate.value === '1') {
     // 鑾峰彇褰撳墠鏃ユ湡
@@ -149,7 +215,7 @@
       endPlanTime: now.endOf('month').format('YYYY-MM-DD 23:59:59'),
     }
   } else {
-    delete queryParams.params
+    queryParams.params = {}
   }
 
   if (equName.value === '-1') {
@@ -162,7 +228,7 @@
   if (option?.from === 'scan') {
     queryParams.assetNo = option.assetNo
   }
-
+  queryParams.params.searchValue = searchValue.value
   getMaintStList(queryParams)
     .then((res: any) => {
       // 璇峰嬁鍦ㄧ綉缁滆姹傚洖璋冧腑缁檇ataList璧嬪�硷紒锛佸彧闇�瑕佽皟鐢╟omplete灏卞彲浠ヤ簡
@@ -182,9 +248,16 @@
   })
 }
 
+function handleSearch () {
+  console.log('handleSearch')
+  paging.value.reload()
+}
+
 function reloadData() {
   paging.value.reload()
 }
+
+
 onLoad((options) => {
   Object.assign(option, options)
   uni.$on('maint-st-refresh', reloadData)
@@ -223,4 +296,12 @@
 :deep(.wd-card__title-content) {
   padding: 24rpx 0 !important;
 }
+
+/* 宸ュ崟鍗$墖鑳屾櫙棰滆壊 */
+.card-urgent {
+  background-color: rgba(255, 204, 0, 0.1); /* 榛勮壊鑳屾櫙 */
+}
+.card-overdue {
+  background-color: rgba(255, 0, 0, 0.1); /* 绾㈣壊鑳屾櫙 */
+}
 </style>

--
Gitblit v1.9.3