From df64c34d92cbe8501bbbfe837bc491a47452c0b6 Mon Sep 17 00:00:00 2001 From: baoshiwei <baoshiwei@shlanbao.cn> Date: 星期一, 09 六月 2025 10:58:19 +0800 Subject: [PATCH] feat(eims): 新增保养工单批量修改功能并优化相关领域对象 --- eims-ui-mobile/src/pages/inspect/insp-record.vue | 151 +++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 118 insertions(+), 33 deletions(-) diff --git a/eims-ui-mobile/src/pages/inspect/insp-record.vue b/eims-ui-mobile/src/pages/inspect/insp-record.vue index a276635..42d7841 100644 --- a/eims-ui-mobile/src/pages/inspect/insp-record.vue +++ b/eims-ui-mobile/src/pages/inspect/insp-record.vue @@ -6,7 +6,13 @@ } </route> <template> - <z-paging ref="paging" v-model="dataList" :auto="false" @query="queryList" show-refresher-update-time> + <z-paging + ref="paging" + v-model="dataList" + :auto="false" + @query="queryList" + show-refresher-update-time + > <template #top> <wd-navbar title="鐐规璁板綍" @@ -24,10 +30,13 @@ <wd-card type="rectangle"> <template #title> <view class="flex justify-between"> - <view class="flex items-center menu-title-box"> + <view + class="flex items-center menu-title-box center" + style="align-content: center; flex-wrap: wrap" + > <view class="menu-indicator"></view> - <view class="ml-1 text-sm align-center">{{ inspSt.equName }}</view> - <view class="text-color-gray ml-2 text-mini">{{ inspSt.assetNo }}</view> + <view class="ml-1 text-lg align-center">{{ inspSt.equName }}</view> + <view class="text-color-gray ml-2 text-sm">{{ inspSt.assetNo }}</view> </view> <view class="flex items-center"> @@ -38,19 +47,19 @@ <view class="flex h-[140rpx]" items-center> <image class="slot-img text-center" src="/static/images/camera.png" /> <view class="flex-1"> - <view class="text-color-gray text-xs mt-1 flex"> + <view class="text-color-gray text-sm mt-1 flex"> <text class="mr-3">鐐规鎬绘暟: {{ dataCount }}</text> | <text class="mx-3">宸茬偣妫�: {{ checkCount }}</text> | <text class="ml-3">鏈偣妫�: {{ dataCount - checkCount }}</text> </view> - <view class="text-color-gray text-xs mt-2 flex"> + <view class="text-color-gray text-sm mt-2 flex"> <text class="mr-3">姝e父: {{ normalNum }}</text> | <text class="mx-3">寮傚父: {{ abNormalNum }}</text> </view> - <view class="text-color-gray text-xs mt-2 flex"> + <view class="text-color-gray text-sm mt-2 flex"> <text>鐘舵�侊細</text> <template v-if="dataCount > 0 && dataCount === checkCount"> <wd-icon class="icon-color-success" name="check-outline" size="34rpx"></wd-icon> @@ -61,7 +70,7 @@ <text class="ml-1">杩涜涓�</text> </template> </view> - <view class="text-color-gray text-xs mt-2 flex">鍒涘缓鏃堕棿: {{ inspSt.createTime }}</view> + <view class="text-color-gray text-sm mt-2 flex">鍒涘缓鏃堕棿: {{ inspSt.createTime }}</view> </view> </view> </wd-card> @@ -71,18 +80,23 @@ <view class="w-full h-[24rpx]"></view> <wd-cell> <template #title> - <text class="text-color-gray">鐐规椤�</text> + <text class="text-color-gray text-sm">鐐规椤�</text> </template> - <wd-button size="small" type="text" @click.stop="toggleCollapse"> - {{ isAllExpanded ? '鍏ㄩ儴鎶樺彔' : '鍏ㄩ儴灞曞紑' }} - </wd-button> + <!-- <wd-button size="small" type="text" @click.stop="toggleCollapse">--> + <!-- {{ isAllExpanded ? '鍏ㄩ儴鎶樺彔' : '鍏ㄩ儴灞曞紑' }}--> + <!-- </wd-button>--> </wd-cell> - <wd-collapse v-model="collSelects" title="鐐规椤�" ref="collapseRef"> - <wd-collapse-item :name="item.id" v-for="(item, index) in dataList" disabled> + <wd-collapse v-model="collSelects" title="鐐规椤�" ref="collapseRef" accordion> + <wd-collapse-item + :name="item.id" + v-for="(item, index) in dataList" + :key="item.id" + :class="getItemClass(item)" + > <template #title="{ expanded, disabled, isFirst }"> <view class="flex justify-between"> - <view class="flex justify-center items-center" style="max-width: 60%;"> - <text class="text-sm" >{{ item.inspName }}</text> + <view class="flex justify-center items-center" style="max-width: 60%"> + <text class="text-sm">{{ item.inspName }}</text> </view> <view class="flex items-center"> @@ -105,18 +119,27 @@ </view> </view> </template> - <view class="text-color-gray text-xs flex justify-between"> + + <view v-if="item.showDesc" class="mt-2"> + <wd-input + v-model="item.inspDesc" + placeholder="璇疯緭鍏ュ紓甯告弿杩�" + clearable + :maxlength="200" + /> + </view> + <view class="text-color-gray text-sm flex justify-between"> <text class="mr-3">鐐规浜�: {{ item.inspUserName }}</text> <text class="mx-3">鐐规鏃堕棿: {{ item.inspTime }}</text> </view> </wd-collapse-item> </wd-collapse> - <view class="w-full h-[24rpx]"></view> - <wd-cell> - <template #title> - <text class="text-color-gray">鍏朵粬</text> - </template> - </wd-cell> + <!-- <view class="w-full h-[24rpx]"></view>--> + <!-- <wd-cell>--> + <!--<!– <template #title>–>--> + <!--<!– <text class="text-color-gray">鍏朵粬</text>–>--> + <!--<!– </template>–>--> + <!-- </wd-cell>--> <view class="w-full h-[1px] bg-base"></view> <wd-input label="杩愯鏃堕棿" @@ -125,6 +148,7 @@ v-model="inspSt.runTimes" placeholder="璇疯緭鍏ヨ繍琛屾椂闂�(h)" inputmode="numeric" + size="large" /> <wd-input label="鏁呴殰鏃堕棿" @@ -133,6 +157,7 @@ v-model="inspSt.faultTimes" placeholder="璇疯緭鍏ユ晠闅滄椂闂�(h)" inputmode="numeric" + size="large" /> <wd-textarea label="鐗硅浜嬮」" @@ -144,13 +169,17 @@ show-word-limit placeholder="璇疯緭鍏ョ壒璁颁簨椤�" clearable + size="large" /> + <!-- 鏂板鎻愪氦鎸夐挳 --> + <view class="flex justify-center mt-4"> + <wd-button type="primary" block size="large" @click="handleClickRight">鎻愪氦</wd-button> + </view> </view> </z-paging> </template> <script setup lang="ts"> -import { ref } from 'vue' import { useUserStore, useAccessStore, useSystemConfigStore } from '@/store' import { isLeader, isOperatorOrRepair } from '@/utils/RoleUtils' import { @@ -194,7 +223,8 @@ const userStore = useUserStore() -const collSelects = ref<string[]>([]) +const collSelects = ref('') +const selectedItems = ref([]) // 鐐规姹囨�绘暟鎹�(涓婁釜椤甸潰浼犲��) const inspSt = reactive<InspSt>({ @@ -237,7 +267,19 @@ } function inspResultClick(item: any) { - // userStore?.userInfo?.userId + console.log('inspResultClick', userStore.userInfo) + // 鑷姩濉厖鐐规浜哄拰鏃堕棿 + item.inspUserName = userStore?.userInfo?.realName || '' + // 淇敼鏃堕棿鏍煎紡涓� 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 = () => { @@ -245,10 +287,9 @@ } function handleClickRight() { - if(isOperatorOrRepair()){ + if (isOperatorOrRepair()) { handleConfirm() } - } const toggleCollapse = () => { @@ -257,10 +298,31 @@ } function handleConfirm() { + console.log('handleConfirm') if (!dataChange.value) { message.alert('璇锋搷浣滃悗鎻愪氦!') return false } + + // 妫�鏌ユ槸鍚︽湁寮傚父椤规湭濉啓鎻忚堪 + const invalidItems = dataList.value.filter( + (item) => item.inspResult === '2' && !item.inspDesc?.trim(), + ) + if (invalidItems.length > 0) { + message.alert('璇峰~鍐欐墍鏈夊紓甯搁」鐨勫紓甯告弿杩�!') + return false + } + + // 杩囨护鍑哄凡閫夋嫨鐨勯」鐩� + selectedItems.value = dataList.value.filter( + (item) => item.inspResult === '1' || item.inspResult === '2', + ) + + if (selectedItems.value.length === 0) { + message.alert('璇疯嚦灏戦�夋嫨涓�涓偣妫�椤�!') + return false + } + message .confirm({ msg: '纭畾鎻愪氦锛�', @@ -278,8 +340,9 @@ } function updateData(resolve: any) { + console.log('updateData', selectedItems.value) const params = { - inspRecordList: dataList.value, + inspRecordList: selectedItems.value, } // 鏇存柊鐐规璁板綍 updateInspRecordBatch(params) @@ -313,8 +376,17 @@ */ function itemClick(item: any) {} +function getItemClass(item: any) { + if (item.inspResult === '1') { + return 'status-normal' + } else if (item.inspResult === '2') { + return 'status-abnormal' + } + return '' +} + watch( - () => [...dataList.value], // 浣跨敤鎵╁睍杩愮畻绗﹀垱寤烘柊鏁扮粍浠ヨЕ鍙戠洃鍚� + () => [...dataList.value, inspSt], // 浣跨敤鎵╁睍杩愮畻绗﹀垱寤烘柊鏁扮粍浠ヨЕ鍙戠洃鍚� (newVal, oldVal) => { if (oldVal.length > 0) { dataChange.value = true @@ -375,7 +447,7 @@ margin-right: 24rpx; } .text-mini { - font-size: 22rpx; + font-size: 24rpx; } .menu-indicator { @@ -394,13 +466,26 @@ background: $uni-color-primary; } :deep(.wd-navbar__text) { - font-size: 26rpx; + font-size: 28rpx; color: white; } :deep(.wd-icon-arrow-left:before), :deep(.wd-navbar__title) { color: white; font-weight: 0; - font-size: 32rpx; + font-size: 34rpx; +} + +// 鏂板鏍峰紡锛氱偣妫�椤硅儗鏅壊 +.status-normal { + background-color: #e6f7ff; // 姝e父鐘舵�佽儗鏅壊锛堢豢鑹诧級 +} + +.status-abnormal { + background-color: #fffbe6; // 寮傚父鐘舵�佽儗鏅壊锛堥粍鑹诧級 +} +:deep(.wd-radio-group) { + // 鏀逛负鏃犺儗鏅壊 + background-color: transparent; } </style> -- Gitblit v1.9.3