From 46d143d1d6fe8f286399f4d027c9a86adf7cd7fc Mon Sep 17 00:00:00 2001 From: baoshiwei <baoshiwei@shlanbao.cn> Date: 星期三, 09 七月 2025 08:50:01 +0800 Subject: [PATCH] feat(inspection,maintenance): - 实现保养工单批量确认功能 - 在点检记录确认时增加时间限制,距离上次更新时间两小时内不允许确认 --- eims-ui-mobile/src/pages/inspect/insp-record.vue | 59 +++++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 37 insertions(+), 22 deletions(-) diff --git a/eims-ui-mobile/src/pages/inspect/insp-record.vue b/eims-ui-mobile/src/pages/inspect/insp-record.vue index c039bad..aa5832a 100644 --- a/eims-ui-mobile/src/pages/inspect/insp-record.vue +++ b/eims-ui-mobile/src/pages/inspect/insp-record.vue @@ -11,6 +11,7 @@ v-model="dataList" :auto="false" @query="queryList" + refresher-only show-refresher-update-time > <template #top> @@ -124,7 +125,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="璇疯緭鍏ュ紓甯告弿杩�" @@ -146,6 +147,7 @@ <!-- </wd-cell>--> <view class="w-full h-[1px] bg-base"></view> <wd-input + v-if="inspSt.status !== '0'" label="杩愯鏃堕棿" label-width="200rpx" clearable @@ -155,6 +157,7 @@ size="large" /> <wd-input + v-if="inspSt.status !== '0'" label="鏁呴殰鏃堕棿" label-width="200rpx" clearable @@ -176,9 +179,9 @@ size="large" /> <!-- 鏂板鎻愪氦鎸夐挳 --> - <view class="flex justify-around mt-4"> - <wd-button type="primary" block size="large" v-if="inspSt.status === '0'" @click="handleClickRight">鎻愪氦</wd-button> - <wd-button type="success" block size="large" v-if="isLeader() && inspSt.status === '1'" @click="handleComplete">纭瀹屾垚</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> @@ -186,7 +189,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, @@ -244,26 +247,24 @@ status: '', inspUser: '', specialNote: '', - runTimes: 0, - faultTimes: 0, + runTimes: undefined, + faultTimes: undefined, }) const paging = ref(null) const dataList = ref([]) -const queryList = (pageNum?: number, pageSize?: number) => { +const queryList = () => { // 杩欓噷鐨刾ageNo鍜宲ageSize浼氳嚜鍔ㄨ绠楀ソ锛岀洿鎺ヤ紶缁欐湇鍔″櫒鍗冲彲 // 杩欓噷鐨勮姹傚彧鏄紨绀猴紝璇锋浛鎹㈡垚鑷繁鐨勯」鐩殑缃戠粶璇锋眰锛屽苟鍦ㄧ綉缁滆姹傚洖璋冧腑閫氳繃paging.value.complete(璇锋眰鍥炴潵鐨勬暟缁�)灏嗚姹傜粨鏋滀紶缁檢-paging const params: QueryParams = { - pageNum, - pageSize, inspCode: inspSt.inspCode, } getInspStRecordList(params) .then((res: any) => { // 璇峰嬁鍦ㄧ綉缁滆姹傚洖璋冧腑缁檇ataList璧嬪�硷紒锛佸彧闇�瑕佽皟鐢╟omplete灏卞彲浠ヤ簡 - paging.value.completeByTotal(res.rows, res.total) + paging.value.complete(res.rows, res.total) }) .catch((res) => { // 濡傛灉璇锋眰澶辫触鍐檖aging.value.complete(false)锛屼細鑷姩灞曠ず閿欒椤甸潰 @@ -280,13 +281,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 = () => { @@ -294,8 +288,11 @@ } function handleClickRight() { - if (isOperatorOrRepair()) { + + if (inspSt.status === '0') { handleConfirm() + } else if (inspSt.status === '1') { + handleComplete() } } @@ -368,6 +365,7 @@ } else { inspSt.status = '0' } + updateInspectSt(inspSt) .then((res: any) => { toast.success('鎿嶄綔鎴愬姛') @@ -385,15 +383,32 @@ * 纭瀹屾垚鎸夐挳鐐瑰嚮浜嬩欢 */ function handleComplete() { - if (!isLeader()) { - toast.info('鏃犳潈闄愭搷浣�'); - return; + console.log('handleComplete', inspSt) + if (!inspSt.runTimes || !inspSt.faultTimes) { + message.alert('璇峰~鍐欒繍琛屾鏁板拰鏁呴殰娆℃暟!') + return false + } + // 濡傛灉褰撳墠鏃堕棿璺濅笂娆℃柊鏃堕棿涓ゅ皬鏃朵互鍐呭垯涓嶅厑璁哥‘璁� + console.log('inspSt.updateTime', inspSt.updateTime) + console.log('new Date().getTime()', new Date().getTime()) + console.log('inspSt.updateTime', new Date(inspSt.updateTime).getTime()) + console.log('new Date().getTime() - new Date(inspSt.updateTime).getTime()', new Date().getTime() - new Date(inspSt.updateTime).getTime()) + console.log("2 * 60 * 60 * 1000", 2 * 60 * 60 * 1000) + console.log('new Date().getTime() - new Date(inspSt.updateTime).getTime() < 2 * 60 * 60 * 1000', new Date().getTime() - new Date(inspSt.updateTime).getTime() < 2 * 60 * 60 * 1000) + if ( + new Date().getTime() - new Date(inspSt.updateTime).getTime() < 2 * 60 * 60 * 1000 + ) { + console.log("new Date().getTime() - new Date(inspSt.updateTime).getTime() < 2 * 60 * 60 * 1000",new Date().getTime() - new Date(inspSt.updateTime).getTime() < 2 * 60 * 60 * 1000) + 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')}` -- Gitblit v1.9.3