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-st.vue | 89 +++++++++++++++++++++++++++++++++++++------- 1 files changed, 74 insertions(+), 15 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..4db3bdf 100644 --- a/eims-ui-mobile/src/pages/maint/maint-st.vue +++ b/eims-ui-mobile/src/pages/maint/maint-st.vue @@ -11,18 +11,19 @@ <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-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,7 +41,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"> @@ -52,14 +53,18 @@ <text class="mr-3">寰呬繚鍏�: {{ item.dbyCount }}</text> | <text class="mx-3">淇濆吇涓�: {{ item.byCount }}</text> - | - <text class="ml-3">寰呴獙璇�: {{ item.dyzCount }}</text> +<!-- |--> +<!-- <text class="ml-3">寰呴獙璇�: {{ item.dyzCount }}</text>--> </view> <view class="text-color-gray text-sm mt-2 flex"> <text>鐘舵�侊細</text> <template v-if="item.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="item.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> @@ -76,7 +81,7 @@ </template> <script setup lang="ts"> -import { ref } from 'vue' +import { ref, computed } from 'vue' import { getMaintStList } from '@/service/maint' import dayjs from 'dayjs' @@ -99,12 +104,37 @@ params?: NonNullable<unknown> } +// 璁$畻宸ュ崟鍗$墖鐨勮儗鏅鑹茬被 +function getCardColorClass(planTime) { + if (!planTime) return '' + + const now = dayjs() + const planDate = dayjs(planTime) + const diffDays = planDate.diff(now, 'day') + + if (diffDays < 0) { + // 瓒呰繃璁″垝鏃堕棿锛岀孩鑹茶儗鏅� + return 'card-overdue' + } else if (diffDays <= 3) { + // 璺濈璁″垝鏃堕棿涓夊ぉ浠ュ唴锛岄粍鑹茶儗鏅� + 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') @@ -121,6 +151,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) @@ -185,6 +234,8 @@ function reloadData() { paging.value.reload() } + + onLoad((options) => { Object.assign(option, options) uni.$on('maint-st-refresh', reloadData) @@ -223,4 +274,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