From f0610c371668b042d36d7772cb04b49a2afc69ea Mon Sep 17 00:00:00 2001 From: zhuguifei <zhuguifei@zhuguifeideiMac.local> Date: 星期四, 24 四月 2025 14:51:56 +0800 Subject: [PATCH] 完成移动端保养 --- eims-ui-mobile/src/service/maint.d.ts | 1 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsInspectStServiceImpl.java | 48 ++++ eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintStServiceImpl.java | 32 ++ eims-ui-mobile/src/service/maint.ts | 9 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsMaintStBo.java | 3 eims-ui-mobile/src/pages/inspect/insp-st.vue | 7 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsInspectStVo.java | 3 eims-ui-mobile/src/pages/maint/order-detail.vue | 191 ++++++++++------ eims-ui-mobile/src/pages/maint/maint-order.vue | 214 +++++++++++++++---- eims-ui-mobile/src/pages/maint/maint-st.vue | 12 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsMaintOrderBo.java | 6 eims-ui-mobile/src/pages.json | 57 ++++ eims-ui-mobile/src/pages/inspect/insp-record.vue | 46 ++- 13 files changed, 469 insertions(+), 160 deletions(-) diff --git a/eims-ui-mobile/src/pages.json b/eims-ui-mobile/src/pages.json index 3e3d43f..adfbb8a 100644 --- a/eims-ui-mobile/src/pages.json +++ b/eims-ui-mobile/src/pages.json @@ -92,11 +92,26 @@ { "path": "pages/inspect/insp-record", "type": "page", + "layout": "default", "needLogin": true, "style": { "navigationBarTitleText": "鐐规璁板綍", - "navigationStyle": "custom", - "navigationBarBackgroundColor": "#4D80F0" + "app-plus": { + "titleNView": { + "buttons": [ + { + "text": "鎻愪氦", + "fontSize": "14px", + "color": "#FFFFFF" + }, + { + "text": "", + "fontSize": "24px", + "color": "#FFFFFF" + } + ] + } + } } }, { @@ -119,11 +134,26 @@ { "path": "pages/maint/maint-order", "type": "page", + "layout": "default", "needLogin": true, "style": { "navigationBarTitleText": "淇濆吇宸ュ崟", - "navigationStyle": "custom", - "navigationBarBackgroundColor": "#4D80F0" + "app-plus": { + "titleNView": { + "buttons": [ + { + "text": "鎻愪氦", + "fontSize": "14px", + "color": "#FFFFFF" + }, + { + "text": "", + "fontSize": "24px", + "color": "#FFFFFF" + } + ] + } + } } }, { @@ -138,11 +168,26 @@ { "path": "pages/maint/order-detail", "type": "page", + "layout": "default", "needLogin": true, "style": { "navigationBarTitleText": "宸ュ崟鏄庣粏", - "navigationStyle": "custom", - "navigationBarBackgroundColor": "#4D80F0" + "app-plus": { + "titleNView": { + "buttons": [ + { + "text": "鎻愪氦", + "fontSize": "14px", + "color": "#FFFFFF" + }, + { + "text": "", + "fontSize": "24px", + "color": "#FFFFFF" + } + ] + } + } } }, { diff --git a/eims-ui-mobile/src/pages/inspect/insp-record.vue b/eims-ui-mobile/src/pages/inspect/insp-record.vue index 620f323..cf97685 100644 --- a/eims-ui-mobile/src/pages/inspect/insp-record.vue +++ b/eims-ui-mobile/src/pages/inspect/insp-record.vue @@ -1,26 +1,31 @@ <route lang="json5"> { + layout: 'default', needLogin: true, style: { navigationBarTitleText: '鐐规璁板綍', - navigationStyle: 'custom', - navigationBarBackgroundColor: '#4D80F0', + 'app-plus': { + titleNView: { + buttons: [ + { + text: '鎻愪氦', + fontSize: '14px', + color: '#FFFFFF', + }, + { + text: '', + fontSize: '24px', + color: '#FFFFFF', + }, + ], + }, + }, }, } </route> <template> <z-paging ref="paging" v-model="dataList" @query="queryList" show-refresher-update-time> <template #top> - <wd-navbar - title="鐐规璁板綍" - left-arrow - @click-left="goBack" - right-text="鎻愪氦" - @click-right="handleClickRight" - custom-style="background: #4D80F0;" - safeAreaInsetTop - ></wd-navbar> - <wd-card type="rectangle"> <template #title> <view class="flex justify-between"> @@ -35,7 +40,7 @@ </view> </view> </template> - <view class="flex h-[100rpx]" items-center> + <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"> @@ -60,6 +65,9 @@ <wd-icon class="icon-color-base" name="detection" size="40rpx"></wd-icon> <text class="ml-1">杩涜涓�</text> </template> + </view> + <view class="text-color-gray text-xs mt-2 flex"> + 鍒涘缓鏃堕棿: {{inspSt.createTime}} </view> </view> </view> @@ -152,6 +160,7 @@ equName: string assetNo: string planTimeStr?: string + createTime?: string status: string inspUser: number | string specialNote: string @@ -170,6 +179,7 @@ equName: '', assetNo: '', planTimeStr: '', + createTime: '', status: '', inspUser: '', specialNote: '', @@ -207,9 +217,11 @@ const goBack = () => { uni.navigateBack() } -function handleClickRight() { - handleConfirm() -} +onNavigationBarButtonTap((e) => { + if (e.index === 0) { + handleConfirm() + } +}) const toggleCollapse = () => { isAllExpanded.value = !isAllExpanded.value @@ -243,6 +255,7 @@ updateInspRecordBatch(params) .then((res: any) => { updateInspSt(resolve) + toast.success("鎿嶄綔鎴愬姛") }) .catch((res) => { console.error(res) @@ -283,6 +296,7 @@ inspSt.equName = options.equName inspSt.assetNo = options.assetNo inspSt.planTimeStr = options.planTimeStr + inspSt.createTime = options.createTime inspSt.specialNote = options?.specialNote inspSt.inspUser = userStore?.userInfo?.userId }) diff --git a/eims-ui-mobile/src/pages/inspect/insp-st.vue b/eims-ui-mobile/src/pages/inspect/insp-st.vue index 748ab44..f53f836 100644 --- a/eims-ui-mobile/src/pages/inspect/insp-st.vue +++ b/eims-ui-mobile/src/pages/inspect/insp-st.vue @@ -37,7 +37,7 @@ </view> </view> </template> - <view class="flex h-[100rpx]" items-center> + <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"> @@ -62,6 +62,9 @@ <wd-icon class="icon-color-base" name="detection" size="40rpx"></wd-icon> <text class="ml-1">杩涜涓�</text> </template> + </view> + <view class="text-color-gray text-xs mt-2 flex"> + 鍒涘缓鏃堕棿: {{item.createTime}} </view> </view> <wd-button size="small" icon="edit-outline" @click.stop="itemClick(item)">鏄庣粏</wd-button> @@ -113,7 +116,7 @@ function itemClick(item) { const inspCode = `${item.equId}_${item.planTime}_${viewMode.value}` uni.navigateTo({ - url: `/pages/inspect/insp-record?id=${item.id}&inspCode=${inspCode}&specialNote=${item.specialNote ?? ''}&equName=${item.equName ?? ''}&assetNo=${item.assetNo ?? ''}&planTimeStr=${item.planTimeStr ?? ''}`, + url: `/pages/inspect/insp-record?id=${item.id}&createTime=${item.createTime}&inspCode=${inspCode}&specialNote=${item.specialNote ?? ''}&equName=${item.equName ?? ''}&assetNo=${item.assetNo ?? ''}&planTimeStr=${item.planTimeStr ?? ''}`, }) } diff --git a/eims-ui-mobile/src/pages/maint/maint-order.vue b/eims-ui-mobile/src/pages/maint/maint-order.vue index bcfcb64..d4fd359 100644 --- a/eims-ui-mobile/src/pages/maint/maint-order.vue +++ b/eims-ui-mobile/src/pages/maint/maint-order.vue @@ -1,26 +1,38 @@ <route lang="json5" type="page"> { + layout: 'default', needLogin: true, style: { navigationBarTitleText: '淇濆吇宸ュ崟', - navigationStyle: 'custom', - navigationBarBackgroundColor: '#4D80F0', + 'app-plus': { + titleNView: { + buttons: [ + { + text: '鎻愪氦', + fontSize: '14px', + color: '#FFFFFF', + }, + { + text: '', + fontSize: '24px', + color: '#FFFFFF', + }, + ], + }, + }, }, } </route> <template> - <z-paging ref="paging" v-model="dataList" @query="queryList" show-refresher-update-time> + <z-paging + ref="paging" + v-model="dataList" + @query="queryList" + :auto="false" + show-refresher-update-time + > <template #top> - <wd-navbar - title="淇濆吇宸ュ崟" - left-arrow - @click-left="goBack" - right-text="鎻愪氦" - @click-right="handleClickRight" - custom-style="background: #4D80F0;" - safeAreaInsetTop - ></wd-navbar> <wd-cell> <template #title> <text class="text-color-gray">璁惧</text> @@ -41,7 +53,7 @@ </view> </view> </template> - <view class="flex h-[100rpx]" items-center> + <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"> @@ -58,7 +70,7 @@ </view> <view class="text-color-gray text-xs mt-2 flex"> <text>鐘舵�侊細</text> - <template v-if="maintSt.orderCount === maintSt.wcCount"> + <template v-if="maintSt.status === '1'"> <wd-icon class="icon-color-success" name="check-outline" size="34rpx"></wd-icon> <text class="ml-1">宸插畬鎴�</text> </template> @@ -66,6 +78,10 @@ <wd-icon class="icon-color-base" name="detection" size="40rpx"></wd-icon> <text class="ml-1">杩涜涓�</text> </template> + </view> + + <view class="text-color-gray text-xs mt-2 flex"> + 鍒涘缓鏃堕棿: {{ maintSt.createTime }} </view> </view> </view> @@ -129,14 +145,24 @@ </view> <!--鎿嶄綔宸ユ垨缁翠慨宸ヨ鑹�--> <template v-if="isOperatorOrRepair()"> - <wd-button - v-if="item.status === '0'" - size="small" - icon="edit-outline" - @click.stop="handleStartMaint(item)" - > - 寮�濮嬩繚鍏� - </wd-button> + <view class="flex flex-col justify-between" v-if="item.status === '0'"> + <wd-button + size="small" + icon="edit-outline" + @click.stop="handleStartMaint(item)" + > + 寮�濮嬩繚鍏� + </wd-button> + + <wd-button + class="mt-3" + size="small" + icon="edit-outline" + @click.stop="handleMaintFinish(item)" + > + 涓�閿繚鍏� + </wd-button> + </view> <wd-button v-if="item.status === '1'" size="small" @@ -167,20 +193,10 @@ <!--绠$悊鍛樿鑹�--> <template v-else-if="isLeader()"> - <wd-button - v-if="item.status === '0'" - size="small" - icon="warn-bold" - disabled - > + <wd-button v-if="item.status === '0'" size="small" icon="warn-bold" disabled> 寰呬繚鍏� </wd-button> - <wd-button - v-if="item.status === '1'" - size="small" - icon="warn-bold" - disabled - > + <wd-button v-if="item.status === '1'" size="small" icon="warn-bold" disabled> 淇濆吇涓� </wd-button> @@ -226,14 +242,17 @@ </template> <script setup lang="ts"> import type { MaintStVO } from '@/service/maint.d' -import { getMaintSt, getMaintStOrderList, updateMaintOrder } from '@/service/maint' +import { getMaintSt, getMaintStOrderList, updateMaintOrder, updateMaintSt } from '@/service/maint' import { ref, reactive } from 'vue' import { useToast, useMessage } from 'wot-design-uni' import { isLeader, isOperatorOrRepair } from '@/utils/RoleUtils' +import { formatDate } from '@/utils/DateUtils' const message = useMessage() +const toast = useToast() const paging = ref(null) const dataList = ref([]) +const maintStId = ref('') interface QueryParams { pageNum: number @@ -247,6 +266,7 @@ equName: '', assetNo: '', planTime: '', + createTime: '', orderCount: null, wcCount: null, dbyCount: null, @@ -260,7 +280,6 @@ pageSize, maintCode: maintCode.value, } - getMaintStOrderList(params) .then((res: any) => { // 璇峰嬁鍦ㄧ綉缁滆姹傚洖璋冧腑缁檇ataList璧嬪�硷紒锛佸彧闇�瑕佽皟鐢╟omplete灏卞彲浠ヤ簡 @@ -271,6 +290,17 @@ // 娉ㄦ剰锛屾瘡娆¢兘闇�瑕佸湪catch涓啓杩欏彞璇濆緢楹荤儲锛寊-paging鎻愪緵浜嗘柟妗堝彲浠ュ叏灞�缁熶竴澶勭悊 // 鍦ㄥ簳灞傜殑缃戠粶璇锋眰鎶涘嚭寮傚父鏃讹紝鍐檜ni.$emit('z-paging-error-emit');鍗冲彲 paging.value.complete(false) + }) +} +function initMaintSt(id: any) { + getMaintSt(id) + .then((res: any) => { + Object.assign(maintSt, res) + paging.value.reload() + }) + .catch((res) => { + console.error(res) + toast.error(res?.data?.msg || '璇锋眰澶辫触') }) } @@ -284,15 +314,44 @@ }) } +/** + * 寮�濮嬩繚鍏� + * @param item + */ function handleStartMaint(item) { + // 纭寮�濮嬩慨鏀圭姸鎬佷负1-淇濆吇涓� + const data = Object.assign({}, item) + data.status = '1' message .confirm({ msg: '纭畾寮�濮嬩繚鍏伙紵', title: '鎻愮ず', beforeConfirm: ({ resolve }) => { - // 纭寮�濮嬩慨鏀圭姸鎬佷负1-淇濆吇涓� - const data = Object.assign({}, item) - data.status = '1' + updateOrder(data, resolve) + }, + }) + .then(() => {}) + .catch((error) => { + console.log(error) + }) +} + + +/** + * 涓�閿繚鍏� + * @param item + */ +function handleMaintFinish(item) { + // 涓�閿繚鍏� + const data = Object.assign({}, item) + data.status = '2' + data.startTime = formatDate(new Date()) + data.endTime = formatDate(new Date()) + message + .confirm({ + msg: '纭畾浣跨敤涓�閿繚鍏伙紵', + title: '鎻愮ず', + beforeConfirm: ({ resolve }) => { updateOrder(data, resolve) }, }) @@ -308,25 +367,85 @@ * @param resolve */ function updateOrder(data: any, resolve: any) { + updateMaintOrder(data) .then((res: any) => { resolve(true) if (res?.code === 200) { reloadData() + // 淇濆吇鐘舵�佹墠闇�瑕佽烦杞� + if(data?.status === '1'){ + goToOrderDetail(data) + } } }) .catch((res) => { console.error(res) }) } -function reloadData() { - paging.value.reload() -} -const goBack = () => { - uni.navigateBack() + +function handleUpdateMaintSt() { + if (maintSt.orderCount !== maintSt.wcCount) { + toast.info('璇峰厛瀹屾垚鎵�鏈変繚鍏婚」锛�') + return false + } + + const data: any = Object.assign( + {}, + { + id: maintSt.id, + orderCount: maintSt.orderCount, + wcCount: maintSt.wcCount, + status: maintSt.status, + specialNote: maintSt.specialNote, + }, + ) + if (data.orderCount === data.wcCount) { + data.status = '1' + } + message + .confirm({ + msg: '纭畾鏇存柊宸ュ崟姹囨�绘暟鎹紵', + title: '鎻愮ず', + beforeConfirm: ({ resolve }) => { + updateMaintSt(data) + .then((res: any) => { + resolve(true) + if (res?.code === 200) { + reloadData() + toastSucces() + } + }) + .catch((res) => { + console.error(res) + }) + }, + }) + .then(() => {}) + .catch((error) => { + console.log(error) + }) } -function handleClickRight() {} +function toastSucces() { + toast.success('鎿嶄綔鎴愬姛') +} + +function reloadData() { + initMaintSt(maintStId.value) +} +onNavigationBarButtonTap((e) => { + if (e.index === 0) { + handleUpdateMaintSt() + } +}) + +onLoad(() => { + uni.$on('maint-order-refresh', reloadData) +}) +onUnload(() => { + uni.$off('maint-order-refresh', reloadData) +}) /** * 鏌ヨ淇濆吇鏄庣粏闇�瑕佺殑code @@ -334,9 +453,8 @@ const maintCode = computed(() => `${maintSt.equId}_${maintSt.planTime}`) onLoad((options) => { - const itemString = decodeURIComponent(options.maintSt) - const item = JSON.parse(itemString) - Object.assign(maintSt, item) + maintStId.value = options.id + reloadData() }) </script> diff --git a/eims-ui-mobile/src/pages/maint/maint-st.vue b/eims-ui-mobile/src/pages/maint/maint-st.vue index e267621..3ad9077 100644 --- a/eims-ui-mobile/src/pages/maint/maint-st.vue +++ b/eims-ui-mobile/src/pages/maint/maint-st.vue @@ -37,7 +37,7 @@ </view> </view> </template> - <view class="flex h-[100rpx]" items-center> + <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"> @@ -54,7 +54,7 @@ </view> <view class="text-color-gray text-xs mt-2 flex"> <text>鐘舵�侊細</text> - <template v-if="item.orderCount === item.wcCount"> + <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> @@ -62,6 +62,9 @@ <wd-icon class="icon-color-base" name="detection" size="40rpx"></wd-icon> <text class="ml-1">杩涜涓�</text> </template> + </view> + <view class="text-color-gray text-xs mt-2 flex"> + 鍒涘缓鏃堕棿: {{item.createTime}} </view> </view> <wd-button size="small" icon="edit-outline" @click.stop="itemClick(item)">鏄庣粏</wd-button> @@ -131,9 +134,8 @@ } function itemClick(item) { - const itemString = encodeURIComponent(JSON.stringify(item)) uni.navigateTo({ - url: `/pages/maint/maint-order?maintSt=${itemString}`, + url: `/pages/maint/maint-order?id=${item.id}`, }) } @@ -145,7 +147,7 @@ uni.$on('maint-st-refresh', reloadData) }) onUnload(() => { - uni.$off('maint-st-refres', reloadData) + uni.$off('maint-st-refresh', reloadData) }) </script> diff --git a/eims-ui-mobile/src/pages/maint/order-detail.vue b/eims-ui-mobile/src/pages/maint/order-detail.vue index 2539593..9823cd4 100644 --- a/eims-ui-mobile/src/pages/maint/order-detail.vue +++ b/eims-ui-mobile/src/pages/maint/order-detail.vue @@ -1,25 +1,30 @@ <route lang="json5" type="page"> { + layout: 'default', needLogin: true, style: { navigationBarTitleText: '宸ュ崟鏄庣粏', - navigationStyle: 'custom', - navigationBarBackgroundColor: '#4D80F0', + 'app-plus': { + titleNView: { + buttons: [ + { + text: '鎻愪氦', + fontSize: '14px', + color: '#FFFFFF', + }, + { + text: '', + fontSize: '24px', + color: '#FFFFFF', + }, + ], + }, + }, }, } </route> <template> - <view class="bg-base h-[100vh]"> - <wd-navbar - title="宸ュ崟鏄庣粏" - left-arrow - @click-left="goBack" - right-text="鎻愪氦" - @click-right="handleClickRight" - custom-style="background: #4D80F0;" - safeAreaInsetTop - ></wd-navbar> - + <view class="bg-base container" safeAreaInsetTopBottom> <wd-form ref="form" :model="order" :rules="rules"> <wd-cell-group custom-class="group" title="璁惧淇℃伅" border> <wd-cell title="璁惧鍚嶇О" title-width="200rpx" is-link> @@ -40,24 +45,12 @@ <wd-cell title="璁″垝淇濆吇鏃ユ湡" title-width="200rpx" is-link> <text>{{ order?.planTime }}</text> </wd-cell> - <wd-datetime-picker - label="淇濆吇寮�濮嬫椂闂�" - label-width="200rpx" - placeholder="璇烽�夋嫨鏃堕棿" - prop="startTime" - v-model="startTime" - @open="openStartTime" - @confirm="handleStartTime" - /> - <wd-datetime-picker - label="淇濆吇缁撴潫鏃堕棿" - label-width="200rpx" - placeholder="璇烽�夋嫨鏃堕棿" - prop="endTime" - v-model="endTime" - @open="openEndTime" - @confirm="handleEndTime" - /> + <wd-cell title="淇濆吇寮�濮嬫椂闂�" title-width="200rpx" is-link> + <text>{{ order?.startTime }}</text> + </wd-cell> + <wd-cell title="淇濆吇瀹屾垚鏃堕棿" title-width="200rpx" is-link> + <text>{{ order?.endTime }}</text> + </wd-cell> <wd-textarea label="宸ヤ綔鎻忚堪" @@ -89,25 +82,54 @@ clearable /> </wd-cell-group> + <view class="h-[2px] w-full bg-base"></view> + <!--鏄惁鏄剧ず绠$悊鍛橀獙璇佹寜閽� (宸ュ崟鐘舵�佷负2-寰呴獙璇� 涓旂櫥褰曚汉role-leader绠$悊鍛樿鑹�)--> + <wd-cell + title="楠岃瘉閫氳繃(绠$悊鍛�)" + title-width="200px" + v-if="order.status === '2' && isLeader()" + > + <view style="text-align: right"> + <wd-switch v-model="isVerify" /> + </view> + </wd-cell> + + <!--鏄惁鏄剧ず鎿嶄綔宸ヤ繚鍏诲畬鎴� (宸ュ崟鐘舵�佷负1-淇濆吇涓� 涓旂櫥褰曚汉role-鎿嶄綔宸ヨ鑹�)--> + <wd-cell + title="淇濆吇瀹屾垚(鎿嶄綔宸�)" + title-width="200px" + v-if="order.status === '1' && isOperatorOrRepair()" + > + <view style="text-align: right"> + <wd-switch v-model="isFinish" /> + </view> + </wd-cell> </wd-form> + <view class="h-[100rpx]"></view> </view> </template> <script setup lang="ts"> import { getMaintOrder, updateMaintOrder } from '@/service/maint' -import { formatDate } from '@/utils/DateUtils' -import { reactive } from 'vue' +import { reactive, onMounted } from 'vue' import { FormRules } from 'wot-design-uni/components/wd-form/types' import { useToast, useMessage } from 'wot-design-uni' +import { isLeader, isOperatorOrRepair } from '@/utils/RoleUtils' +const toast = useToast() const message = useMessage() const fileList = ref<[]>() -const startTime = ref<number>(0) -const endTime = ref<number>(0) + +// 绠$悊鍛橀獙鏄惁閫氳繃 +const isVerify = ref(false) +// 鎿嶄綔宸ヤ繚鍏绘槸瀹屾垚 +const isFinish = ref(false) interface MaintOrder { id: string equName: string + assetNo: string + status: string maintCode: string maintName: string planTime: string @@ -120,6 +142,8 @@ const order = reactive<MaintOrder>({ id: '', equName: '', + assetNo: '', + status: '', maintCode: '', maintName: '', planTime: '', @@ -149,23 +173,6 @@ }, ], } -function openStartTime() { - if (startTime.value === 0) { - startTime.value = Date.now() - } -} -function openEndTime() { - if (endTime.value === 0) { - endTime.value = Date.now() - } -} - -function handleStartTime(value) { - order.startTime = formatDate(new Date(value.value)) -} -function handleEndTime(value) { - order.endTime = formatDate(new Date(value.value)) -} function handleFileChange({ fileList }) {} @@ -173,33 +180,32 @@ getMaintOrder(id) .then((res: any) => { Object.assign(order, res) - startTime.value = new Date(order.startTime).getTime() - endTime.value = new Date(order.endTime).getTime() }) .catch((res) => {}) } -function updateOrder(resolve: any) { - updateMaintOrder(order) +function updateOrder(data: any, resolve: any) { + updateMaintOrder(data) .then((res: any) => { resolve(true) + toastSucces() + uni.$emit('maint-order-refresh') }) .catch((res) => { console.error(res) }) } - -const goBack = () => { - uni.navigateBack() +function toastSucces() { + toast.success('鎿嶄綔鎴愬姛') } -function handleClickRight() { +function handleClickRight(data: any) { message .confirm({ msg: '纭畾鎻愪氦锛�', title: '鎻愮ず', beforeConfirm: ({ resolve }) => { - updateOrder(resolve) + updateOrder(data, resolve) }, }) .then(() => {}) @@ -208,21 +214,64 @@ }) } +onNavigationBarButtonTap((e) => { + if (e.index === 0) { + // 绠$悊鍛樿鑹� 涓斿緟楠岃瘉鐘舵�� + if (isLeader()) { + switch (order.status) { + case '0': + case '1': + toast.warning('褰撳墠宸ュ崟绛夊緟鎿嶄綔宸ヤ繚鍏荤姸鎬侊紝涓嶅彲鎿嶄綔') + break + case '2': + // 鍕鹃�夐獙璇侊紝鍙彁浜� + if (isVerify.value) { + // 淇敼宸ュ崟鐘舵�佷负宸插畬鎴� + const data: any = Object.assign({}, { id: order.id, status: order.status }) + data.status = '3' + handleClickRight(data) + } else { + toast.warning('璇烽�夋嫨鏄惁楠岃瘉閫氳繃') + } + break + case '3': + toast.warning('褰撳墠宸ュ崟瀹屾垚鐘舵�侊紝涓嶅彲鎿嶄綔') + break + } + } else if (isOperatorOrRepair()) { + switch (order.status) { + case '0': + break + case '1': + { + const data = Object.assign({}, order) + // 鍕鹃�夊伐鍗曞畬鎴愶紝鏀瑰彉鐘舵�� + if (isFinish.value) { + // 淇敼宸ュ崟鐘舵�佷负寰呴獙璇� + data.status = '2' + } + handleClickRight(data) + } + break + case '2': + toast.warning('褰撳墠宸ュ崟绛夊緟绠$悊楠岃瘉鐘舵�侊紝涓嶅彲鎿嶄綔') + break + case '3': + toast.warning('褰撳墠宸ュ崟瀹屾垚鐘舵�侊紝涓嶅彲鎿嶄綔') + break + } + } + } +}) + +onMounted(() => {}) onLoad((options) => { initMaintOrder(options.id) }) </script> <style scoped lang="scss"> -:deep(.wd-navbar__text) { - font-size: 26rpx; - color: white; -} - -:deep(.wd-icon-arrow-left:before), -:deep(.wd-navbar__title) { - color: white; - font-weight: bold !important; - font-size: 32rpx; +.container { + height: 100vh; } </style> diff --git a/eims-ui-mobile/src/service/maint.d.ts b/eims-ui-mobile/src/service/maint.d.ts index 5571883..60b0832 100644 --- a/eims-ui-mobile/src/service/maint.d.ts +++ b/eims-ui-mobile/src/service/maint.d.ts @@ -16,6 +16,7 @@ equName?: string; assetNo?: string; status?: string; + createTime?: string; /** * diff --git a/eims-ui-mobile/src/service/maint.ts b/eims-ui-mobile/src/service/maint.ts index 4d1580b..4ffeaa9 100644 --- a/eims-ui-mobile/src/service/maint.ts +++ b/eims-ui-mobile/src/service/maint.ts @@ -10,6 +10,15 @@ return http.get<MaintStVO>(`/eims/maintSt/${id}`) } + +/** + * 鏇存柊宸ュ崟姹囨�� + * @param data + */ +export const updateMaintSt = (data: any) => { + return http.put<void>('/eims/maintSt', data) +} + /** * 淇濆吇姹囨�诲垪琛� */ diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsMaintOrderBo.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsMaintOrderBo.java index 958995c..0ff70f0 100644 --- a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsMaintOrderBo.java +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsMaintOrderBo.java @@ -31,7 +31,6 @@ /** * */ - @NotNull(message = "璁惧id涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) private Long equId; /** @@ -57,7 +56,6 @@ /** * 璁″垝琛ㄥ啑浣�-淇濆吇浜� */ - @NotNull(message = "璁″垝琛ㄥ啑浣�-淇濆吇浜轰笉鑳戒负绌�", groups = { AddGroup.class, EditGroup.class }) private Long maintUser; /** @@ -68,13 +66,11 @@ /** * 璁″垝琛ㄥ啑浣�-淇濆吇閮ㄩ棬 */ - @NotNull(message = "璁″垝琛ㄥ啑浣�-淇濆吇閮ㄩ棬涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) private Long maintDept; /** * 淇濆吇鍗曞彿 */ - @NotBlank(message = "淇濆吇鍗曞彿涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) private String maintCode; /** @@ -90,13 +86,11 @@ /** * */ - @NotBlank(message = "鐘舵�佷笉鑳戒负绌�", groups = { AddGroup.class, EditGroup.class }) private String status; /** * 淇濆吇璁″垝鏃堕棿 */ - @NotNull(message = "淇濆吇璁″垝鏃堕棿涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) @JsonFormat(pattern = "yyyy-MM-dd") private Date planTime; diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsMaintStBo.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsMaintStBo.java index ce64691..16e4dd1 100644 --- a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsMaintStBo.java +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsMaintStBo.java @@ -31,20 +31,17 @@ /** * */ - @NotBlank(message = "涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) private String title; /** * */ - @NotBlank(message = "涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) private Long equId; private String equName; private String assetNo; /** * */ - @NotNull(message = "涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) @JsonFormat(pattern = "yyyy-MM-dd") private Date planTime; diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsInspectStVo.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsInspectStVo.java index 8dee5d2..66703cd 100644 --- a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsInspectStVo.java +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsInspectStVo.java @@ -2,6 +2,7 @@ import java.util.Date; +import org.dromara.common.mybatis.core.domain.BaseEntity; import org.dromara.common.translation.annotation.Translation; import org.dromara.common.translation.constant.TransConstant; import org.dromara.eims.domain.EimsInspectSt; @@ -25,7 +26,7 @@ @Data @ExcelIgnoreUnannotated @AutoMapper(target = EimsInspectSt.class) -public class EimsInspectStVo implements Serializable { +public class EimsInspectStVo extends BaseEntity implements Serializable { @Serial private static final long serialVersionUID = 1L; diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsInspectStServiceImpl.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsInspectStServiceImpl.java index 6db24c0..c81fd16 100644 --- a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsInspectStServiceImpl.java +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsInspectStServiceImpl.java @@ -49,7 +49,53 @@ */ @Override public EimsInspectStVo queryById(Long id){ - return baseMapper.selectVoById(id); + EimsInspectStVo stVo = baseMapper.selectVoById(id); + return stVo; + } + + + /** + * + * @param stVo + * @param type Day-鏃ヨ鍥� Month-鏈堣鍥� + */ + private void fillStDataSingle(EimsInspectStVo stVo,String type) { + + LambdaQueryWrapper<EimsInspectRecord> recordLqw = Wrappers.lambdaQuery(); + recordLqw.eq(EimsInspectRecord::getEquId, stVo.getEquId()); + LocalDate planTime = stVo.getPlanTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + // 鏈堣鍥炬煡璇㈣寖鍥� + LocalDate startOfMonth = planTime.with(TemporalAdjusters.firstDayOfMonth()); + LocalDate endOfMonth = planTime.with(TemporalAdjusters.lastDayOfMonth()); + + // 鏃ヨ鍥炬煡璇㈣寖鍥� + if(type.equals("Day")){ + recordLqw.between(EimsInspectRecord::getPlanTime, planTime, planTime); + }else { + // 鏈堣鍥炬煡璇㈣寖鍥� + recordLqw.between(EimsInspectRecord::getPlanTime, startOfMonth, endOfMonth); + } + + + // 鎵ц鏌ヨ + List<EimsInspectRecordVo> recordList = recordMapper.selectVoList(recordLqw); + // TODO 鏍规嵁瀛楀吀eims_inspect_status + Map<String, Long> cMap = recordList.stream() + .filter(order -> List.of("0", "1").contains(order.getStatus())) + .collect(Collectors.groupingBy(EimsInspectRecordVo::getStatus, Collectors.counting())); + // TODO 鏍规嵁瀛楀吀eims_inspect_result + Map<String, Long> rMap = recordList.stream() + .filter(order ->order.getInspResult()!=null && List.of("1", "2").contains(order.getInspResult())) + .collect(Collectors.groupingBy(EimsInspectRecordVo::getInspResult, Collectors.counting())); + + stVo.setRecordCount(recordList.size()); + stVo.setUnCheckCount(cMap.getOrDefault("0", 0L).intValue()); + stVo.setCheckCount(cMap.getOrDefault("1", 0L).intValue()); + + stVo.setNormalNum(rMap.getOrDefault("1", 0L).intValue()); + stVo.setAbNormalNum(rMap.getOrDefault("2", 0L).intValue()); + + } /** diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintStServiceImpl.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintStServiceImpl.java index 78f55ad..2d78c60 100644 --- a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintStServiceImpl.java +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintStServiceImpl.java @@ -57,7 +57,37 @@ */ @Override public EimsMaintStVo queryById(Long id) { - return baseMapper.selectVoById(id); + EimsMaintStVo stVo = baseMapper.selectVoById(id); + if(stVo!=null){ + fillStDataSingle(stVo); + } + return stVo; + } + private void fillStDataSingle(EimsMaintStVo stVo) { + + //1.濉厖璁惧 + EimsEqu eimsEqu = equMapper.selectById(stVo.getEquId()); + stVo.setAssetNo(eimsEqu.getAssetNo()); + //2.缁熻鏁版嵁 + LambdaQueryWrapper<EimsMaintOrder> orderLqw = Wrappers.lambdaQuery(); + orderLqw.eq(EimsMaintOrder::getEquId, stVo.getEquId()); + LocalDate planTime = stVo.getPlanTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + LocalDate startOfMonth = planTime.with(TemporalAdjusters.firstDayOfMonth()); + LocalDate endOfMonth = planTime.with(TemporalAdjusters.lastDayOfMonth()); + orderLqw.between(EimsMaintOrder::getPlanTime, startOfMonth, endOfMonth); + // 鎵ц鏌ヨ + List<EimsMaintOrderVo> orderList = orderMapper.selectVoList(orderLqw); + // TODO 鏍规嵁瀛楀吀maint_order_status + Map<String, Long> cMap = orderList.stream() + .filter(order -> List.of("0", "1", "2", "3").contains(order.getStatus())) + .collect(Collectors.groupingBy(EimsMaintOrderVo::getStatus, Collectors.counting())); + stVo.setOrderCount(orderList.size()); + stVo.setDbyCount(cMap.getOrDefault("0", 0L).intValue()); + stVo.setByCount(cMap.getOrDefault("1", 0L).intValue()); + stVo.setDyzCount(cMap.getOrDefault("2", 0L).intValue()); + stVo.setWcCount(cMap.getOrDefault("3", 0L).intValue()); + + } /** -- Gitblit v1.9.3