From bab490d2da009c1a23b352b3b964e0c2dd06a0b3 Mon Sep 17 00:00:00 2001 From: baoshiwei <baoshiwei@shlanbao.cn> Date: 星期四, 12 六月 2025 17:32:42 +0800 Subject: [PATCH] 移动端功能优化 --- eims-ui-mobile/src/pages/repair/req-detail.vue | 252 +++++++ eims-ui-mobile/src/pages/inspect/insp-st.vue | 13 eims-ui-mobile/src/pages/maint/maint-order.vue | 10 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsInspectPlanBo.java | 6 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsRepairResServiceImpl.java | 47 + eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsRepairRes.java | 2 eims-ui-mobile/src/utils/RoleUtils.ts | 43 + eims-ui-mobile/src/components/repair/req-card.vue | 189 +++++ eims-ui-mobile/src/pages/inspect/insp-record.vue | 34 eims-ui-mobile/src/types/uni-pages.d.ts | 1 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsRepairFbServiceImpl.java | 2 eims-ui-mobile/src/pages/repair/repair-fb.vue | 52 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsInspectStServiceImpl.java | 1 eims-ui-mobile/src/pages/repair/res-detail.vue | 153 ++++ eims-ui-mobile/src/pages/repair/res-list.vue | 509 +++++--------- eims/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/constant/DictConstants.java | 5 eims-ui-mobile/src/pages/repair/repair-add.vue | 51 + eims-ui-mobile/src/components/repair/res-card.vue | 236 ++++++ eims-ui-mobile/src/pages/maint/order-detail.vue | 8 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsRepairReqBo.java | 2 eims-ui-mobile/src/pages/scan/index.vue | 116 +++ eims-ui-mobile/src/pages.json | 10 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsRepairResBo.java | 8 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsRepairResVo.java | 3 eims-ui-mobile/src/pages/repair/req-list.vue | 270 ++++--- eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsRepairReqServiceImpl.java | 8 26 files changed, 1,487 insertions(+), 544 deletions(-) diff --git a/eims-ui-mobile/src/components/repair/req-card.vue b/eims-ui-mobile/src/components/repair/req-card.vue new file mode 100644 index 0000000..3e937c3 --- /dev/null +++ b/eims-ui-mobile/src/components/repair/req-card.vue @@ -0,0 +1,189 @@ +<template> + <wd-card type="rectangle" :key="item.id"> + <template #title> + <view class="flex justify-between items-center"> + <view class="flex items-center menu-title-box"> + <view class="menu-indicator"></view> + <text class="ml-1 text-sm">{{ item.code }}</text> + </view> + + <view> + <wd-button size="small" v-if="item.status === '0'" type="info">寰呮帴鍗�</wd-button> + <wd-button size="small" v-else-if="item.status === '1'" type="warning">宸叉帴鍗�</wd-button> + <wd-button size="small" v-else-if="item.status === '2'" type="primary">缁翠慨涓�</wd-button> + <wd-button size="small" v-else-if="item.status === '3'" type="success">宸插畬鎴�</wd-button> + </view> + </view> + </template> + <wd-swipe-action> + <view class="flex items-center" @click.stop="itemClick(item)"> + <image + v-if="item.reqType === '1'" + class="slot-img text-center" + src="/static/ico/ico-huiyi.png" + /> + <image + v-else-if="item.reqType === '2'" + class="slot-img text-center" + src="/static/ico/ico-setting.png" + /> + <image + v-else-if="item.reqType === '3'" + class="slot-img text-center" + src="/static/ico/ico-faxian.png" + /> + <view class="flex-1 mt-1"> + <view class="text-color-base"> + <template v-if="item.reqType === '1'"> + <text>璁惧绫诲瀷</text> + <text class="mx-2">|</text> + <text>{{ item.equName }}</text> + </template> + + <template v-if="item.reqType === '2'"> + <text>宸ュ叿绫诲瀷</text> + <text class="mx-2">|</text> + <text>{{ item.fixtureName }}</text> + </template> + + <template v-if="item.reqType === '3'"> + <text>鍏朵粬绫诲瀷</text> + </template> + <view class="text-color-gray mt-1 text-mini"> + <text>鍙戠敓鏃堕棿: {{ item.occTime }}</text> + </view> + + <view class="text-color-gray mt-1 text-mini"> + <text>鎶ヤ慨浜�: {{ item.reqUserName }}</text> + </view> + <view class="text-color-gray mt-1 text-mini"> + <text>鎻忚堪: {{ item.reqDesc }}</text> + </view> + <view class="text-color-gray mt-1 text-mini"> + <text>绱ф�ョ▼搴�: </text> + <wd-tag type="danger" v-if="item.urgencyLevel === '1'">绱ф��</wd-tag> + <wd-tag type="warning" v-else-if="item.urgencyLevel === '2'">涓�鑸�</wd-tag> + <wd-tag type="success" v-else-if="item.urgencyLevel === '3'">鏅��</wd-tag> + </view> + </view> + <view class="text-color-gray text-sm mt-1"> + {{ item.location }} {{ item.madeIn }} + </view> + + </view> + <view v-if="isRepair() || isEquAdmin()"> + <wd-button size="small" icon="edit-outline" @click.stop="handleSelectReq(item)"> + 鎺ュ崟 + </wd-button> + </view> + </view> + <template #right> + <view class="h-full px-3 flex items-center"> + <wd-button size="small" type="error" @click.stop="handleDelete(item)">鍒犻櫎</wd-button> + </view> + </template> + </wd-swipe-action> + </wd-card> +</template> + +<script setup lang="ts"> +import { useToast, useMessage } from 'wot-design-uni' +import type { RepairReqVO } from '@/service/repair.d' +import {addRepairRes} from "@/service/repair"; +import { isEquAdmin, isRepair } from "@/utils/RoleUtils"; +import { useUserStore } from "@/store"; + +const userStore = useUserStore() +const message = useMessage() +const toast = useToast() +defineProps({ + item: { + type: Object as () => RepairReqVO, + required: true + } +}) + +const emit = defineEmits(['click']) + +function itemClick(item) { + emit('click', item) + // 璺宠浆鍒版姤淇崟璇︽儏椤甸潰 + uni.navigateTo({ + url: '/pages/repair/req-detail?id=' + item.id + }) +} + + +function handleSelectReq(item: any) { + // 寮瑰嚭纭鏄惁鎺ュ崟寮圭獥 + message.confirm({ + msg: '纭畾鎺ュ崟锛�', + title: '鎻愮ず', + beforeConfirm: ({ resolve }) => { + resolve(true) + addNewRepairRes(item) + }, + }) +} +function addNewRepairRes(data: any) { + console.error(data) + // 閫夋嫨鎶ヤ慨鍗曞悗锛屼慨鏀规姤淇崟鐘舵�佸拰鏂板缁翠慨宸ュ崟 + const resCode = `WXD${data.code.slice(3)}` + const deptId = userStore?.userInfo?.deptId + const userId = userStore?.userInfo?.userId + const resData = { + reqId: data.id, + reqCode: data.code, + reqUser: data.reqUser, + reqDept: data.reqDept, + resCode, + status: '1', + resUser: userId, + resDept: deptId, + } + addRepairRes(resData) + .then((res: any) => { + if (res.code === 200) { + toast.success(res?.msg || '鎿嶄綔鎴愬姛') + uni.$emit('list-refresh') + } else { + toast.error(res?.msg || '鐢熸垚缁翠慨宸ュ崟澶辫触锛岃閲嶈瘯') + } + }) + .catch((res) => { + toast.error(res?.msg || '鐢熸垚缁翠慨宸ュ崟澶辫触锛岃閲嶈瘯') + }) +} +</script> + +<style scoped lang="scss"> +.menu-title-box { + height: 30rpx; + line-height: 30rpx; +} + +.slot-img { + width: 72rpx; + height: 72rpx; + margin-right: 24rpx; +} +.text-mini { + font-size: 22rpx; +} + +.menu-indicator { + width: 6rpx; + height: 22rpx; + border-radius: 10rpx; + background-color: $uni-color-primary; +} +:deep(.wd-card__title-content) { + padding: 16rpx !important; +} +:deep(.wd-card__content) { + padding: 16rpx !important; +} +:deep(.wd-card__footer) { + padding: 10rpx !important; +} +</style> diff --git a/eims-ui-mobile/src/components/repair/res-card.vue b/eims-ui-mobile/src/components/repair/res-card.vue new file mode 100644 index 0000000..230b442 --- /dev/null +++ b/eims-ui-mobile/src/components/repair/res-card.vue @@ -0,0 +1,236 @@ +<template> + <wd-card type="rectangle" :key="item.id"> + <template #title> + <view class="flex justify-between items-center"> + <view class="flex items-center menu-title-box"> + <view class="menu-indicator"></view> + <text class="ml-1 text-sm">{{ item.resCode }}</text> + <text class="text-color-gray ml-2 text-mini">鎺ュ崟:{{ item.createTime }}</text> + </view> + + <view> + <wd-tag size="small" v-if="item.status === '1'" type="warning">宸叉帴鍗�</wd-tag> + <wd-tag size="small" v-else-if="item.status === '2'" type="primary">缁翠慨涓�</wd-tag> + <wd-tag size="small" v-else-if="item.status === '3'" type="success">宸插畬鎴�</wd-tag> + </view> + </view> + </template> + <view class="flex h-[240rpx] items-center"> + <image + v-if="item.reqType === '1'" + class="slot-img text-center" + src="/static/ico/ico-huiyi.png" + /> + <image + v-else-if="item.reqType === '2'" + class="slot-img text-center" + src="/static/ico/ico-setting.png" + /> + <image + v-else-if="item.reqType === '3'" + class="slot-img text-center" + src="/static/ico/ico-faxian.png" + /> + <view class="flex-1 mt-1"> + <view class="text-color-base"> + <template v-if="item.reqType === '1'"> + <text>璁惧绫诲瀷</text> + <text class="mx-2">|</text> + <text>{{ item.equName }}</text> + </template> + + <template v-if="item.reqType === '2'"> + <text>宸ュ叿绫诲瀷</text> + <text class="mx-2">|</text> + <text>{{ item.fixtureName }}</text> + </template> + + <template v-if="item.reqType === '3'"> + <text>鍏朵粬绫诲瀷</text> + </template> + <view class="text-color-gray mt-1 text-mini"> + <text>鎶ヤ慨浜�: {{ item.reqUserName }}</text> + </view> + <view class="text-color-gray mt-1 text-mini"> + <text>鎶ヤ慨鏃堕棿: {{ item.reqTime }}</text> + </view> + + <view class="text-color-gray mt-1 text-mini"> + <text>缁翠慨寮�濮�: {{ item.startTime }}</text> + </view> + <view class="text-color-gray mt-1 text-mini"> + <text>缁翠慨缁撴潫: {{ item.endTime }}</text> + </view> + <view class="text-color-gray mt-1 text-mini"> + <text>缁翠慨浜�: {{ item.resUserName }}</text> + </view> + </view> + </view> + <view> + <template v-if="item.status === '3'"> + <view class="h-full flex flex-col"> + <wd-button size="small" icon="warn-bold" @click.stop="itemClick(item)"> + 璇︽儏 + </wd-button> + <wd-button + class="mt-4" + size="small" + icon="edit-outline" + @click.stop="goToFeedBack(item)" + type="warning" + > + {{ item.fbId == null ? '鍐欒瘎浠�' : '鏌ョ湅璇勪环' }} + </wd-button> + </view> + </template> + <!--鎿嶄綔宸ユ垨缁翠慨宸ヨ鑹�--> + <template v-if="isRepair() || isEquAdmin()"> + <wd-button + v-if="item.status === '1'" + size="small" + icon="edit-outline" + @click.stop="handleStartRepair(item)" + > + 寮�濮嬬淮淇� + </wd-button> + <wd-button + v-else-if="item.status === '2'" + size="small" + icon="edit-outline" + @click.stop="itemClick(item)" + type="success" + > + 瀹屾垚缁翠慨 + </wd-button> + + </template> + + </view> + </view> + </wd-card> +</template> + +<script setup lang="ts"> +import type { RepairResVO } from '@/service/repair.d' +import { isEquAdmin, isLeader, isLineOrRepair, isRepair } from "@/utils/RoleUtils"; +import { formatDate } from "@/utils/DateUtils"; +import { updateRepairRes } from "@/service/repair"; +import { useToast, useMessage } from 'wot-design-uni' +import { useUserStore } from "@/store"; + +const userStore = useUserStore() +const message = useMessage() +const toast = useToast() +defineProps({ + item: { + type: Object as () => RepairResVO, + required: true + } +}) + +const emit = defineEmits(['click']) + +function handleClick(item) { + emit('click', item) +} + +/** + * 寮�濮嬬淮淇� + * @param item + */ +function handleStartRepair(item: any) { + // 纭寮�濮嬩慨鏀圭姸鎬佷负2-缁翠慨涓� + const data = Object.assign({}, item) + // 纭寮�濮嬩慨鏀圭姸鎬佷负2-缁翠慨涓� + data.status = '2' + // 璁剧疆寮�濮嬬淮淇椂闂� + data.startTime = formatDate(new Date()) + message + .confirm({ + msg: '纭畾寮�濮嬬淮淇紵', + title: '鎻愮ず', + beforeConfirm: ({ resolve }) => { + updateRepair(data, resolve) + }, + }) + .then(() => {}) + .catch((error) => { + console.log(error) + }) +} + +/** + * 鏇存柊缁翠慨宸ュ崟 + * @param data + * @param resolve + */ +function updateRepair(data: any, resolve: any) { + updateRepairRes(data) + .then((res: any) => { + resolve(true) + if (res?.code === 200) { + uni.$emit('list-refresh') + // 缁翠慨涓姸鎬佹墠闇�瑕佽烦杞� + if (data?.status === '3') { + goToDetail(data) + } + } + }) + .catch((res) => { + console.error(res) + }) +} + +/** + * 鏉$洰鐐瑰嚮浜嬩欢 + * @param item + */ +function itemClick(item: any) { + goToDetail(item) +} + +function goToDetail(item) { + uni.navigateTo({ + url: `/pages/repair/res-detail?id=${item.id}`, + }) +} + +function goToFeedBack(item) { + uni.navigateTo({ + url: `/pages/repair/repair-fb?id=${item.id}`, + }) +} + +</script> + +<style scoped lang="scss"> +.menu-title-box { + height: 30rpx; + line-height: 30rpx; +} + +.slot-img { + width: 72rpx; + height: 72rpx; + margin-right: 24rpx; +} +.text-mini { + font-size: 22rpx; +} + +.menu-indicator { + width: 6rpx; + height: 22rpx; + border-radius: 10rpx; + background-color: $uni-color-primary; +} +:deep(.wd-card__title-content) { + padding: 16rpx !important; +} +:deep(.wd-card__content) { + padding: 16rpx !important; +} +:deep(.wd-card__footer) { + padding: 10rpx !important; +} +</style> diff --git a/eims-ui-mobile/src/pages.json b/eims-ui-mobile/src/pages.json index 08bf8fa..dd4e52f 100644 --- a/eims-ui-mobile/src/pages.json +++ b/eims-ui-mobile/src/pages.json @@ -200,6 +200,16 @@ } }, { + "path": "pages/repair/req-detail", + "type": "page", + "layout": "default", + "needLogin": true, + "style": { + "navigationBarTitleText": "鎶ヤ慨璇︽儏", + "navigationStyle": "custom" + } + }, + { "path": "pages/repair/req-list", "type": "page", "layout": "default", diff --git a/eims-ui-mobile/src/pages/inspect/insp-record.vue b/eims-ui-mobile/src/pages/inspect/insp-record.vue index c039bad..d38c7ea 100644 --- a/eims-ui-mobile/src/pages/inspect/insp-record.vue +++ b/eims-ui-mobile/src/pages/inspect/insp-record.vue @@ -124,7 +124,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="璇疯緭鍏ュ紓甯告弿杩�" @@ -177,8 +177,8 @@ /> <!-- 鏂板鎻愪氦鎸夐挳 --> <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> + <wd-button type="primary" block size="large" 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 +186,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,8 +244,8 @@ status: '', inspUser: '', specialNote: '', - runTimes: 0, - faultTimes: 0, + runTimes: undefined, + faultTimes: undefined, }) const paging = ref(null) @@ -280,13 +280,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 +287,11 @@ } function handleClickRight() { - if (isOperatorOrRepair()) { + + if (inspSt.status === '0') { handleConfirm() + } else if (inspSt.status === '1') { + handleComplete() } } @@ -368,6 +364,7 @@ } else { inspSt.status = '0' } + updateInspectSt(inspSt) .then((res: any) => { toast.success('鎿嶄綔鎴愬姛') @@ -385,15 +382,18 @@ * 纭瀹屾垚鎸夐挳鐐瑰嚮浜嬩欢 */ function handleComplete() { - if (!isLeader()) { - toast.info('鏃犳潈闄愭搷浣�'); - return; + console.log('handleComplete', inspSt) + if (!inspSt.runTimes || !inspSt.faultTimes) { + 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')}` diff --git a/eims-ui-mobile/src/pages/inspect/insp-st.vue b/eims-ui-mobile/src/pages/inspect/insp-st.vue index 0ca9158..85c1cda 100644 --- a/eims-ui-mobile/src/pages/inspect/insp-st.vue +++ b/eims-ui-mobile/src/pages/inspect/insp-st.vue @@ -78,7 +78,8 @@ <script setup lang="ts"> import { getInspStList } from '@/service/inspect' import dayjs from 'dayjs' - +import { useUserStore, useAccessStore, useSystemConfigStore } from '@/store' +import { isLeader, isLineOrRepair, isOperator } from "@/utils/RoleUtils"; // 鏍囩椤电浉鍏� const activeTab = ref(0) // 榛樿閫変腑绗竴涓爣绛鹃〉锛堝緟鐐规锛� @@ -98,7 +99,7 @@ ]) const equList = ref<Record<string, any>[]>([{ label: '鎵�鏈夎澶�', value: '鎵�鏈夎澶�' }]) - +const userStore = useUserStore() // 鏍囩椤靛垏鎹㈠鐞嗗嚱鏁� function handleTabChange({ index }) { // 鏍规嵁鏍囩椤电储寮曡缃搴旂殑鐘舵�佸�� @@ -142,6 +143,14 @@ } else { delete params.planTime } + + console.log('queryList::', isLineOrRepair(), isOperator(), userStore.userInfo) + if (isLineOrRepair() || isOperator()) { + params.updateBy = userStore.userInfo.userId + } else if (isLeader()) { + delete params.updateBy + } + console.log('params::', params) getInspStList(params) .then((res: any) => { // 璇峰嬁鍦ㄧ綉缁滆姹傚洖璋冧腑缁檇ataList璧嬪�硷紒锛佸彧闇�瑕佽皟鐢╟omplete灏卞彲浠ヤ簡 diff --git a/eims-ui-mobile/src/pages/maint/maint-order.vue b/eims-ui-mobile/src/pages/maint/maint-order.vue index b67e041..7e60bdc 100644 --- a/eims-ui-mobile/src/pages/maint/maint-order.vue +++ b/eims-ui-mobile/src/pages/maint/maint-order.vue @@ -175,7 +175,7 @@ > <wd-input v-model="part.name" - label="鍚嶇О" + label="鍚嶇О锛�" label-width="100rpx" placeholder="澶囦欢鍚嶇О" @@ -183,7 +183,8 @@ /> <wd-input v-model="part.quantity" - label="鏁伴噺" label-width="100rpx" + label="鏁伴噺锛�" + label-width="100rpx" placeholder="鏁伴噺" type="number" :maxlength="5" /> </view> </view> @@ -260,7 +261,7 @@ import { getMaintSt, getMaintStOrderList, updateMaintOrder, updateMaintSt, updateMaintOrderBatch } from '@/service/maint' import { ref, reactive } from 'vue' import { useToast, useMessage } from 'wot-design-uni' -import { isLeader, isOperatorOrRepair } from '@/utils/RoleUtils' +import { isLeader, isLineOrRepair } from '@/utils/RoleUtils' import { formatDate } from '@/utils/DateUtils' import { useUserStore } from "@/store"; import { getSpareList } from '@/service/spare' @@ -561,9 +562,8 @@ } function handleClickRight() { - if(isOperatorOrRepair()){ + handleUpdateMaintSt() - } } diff --git a/eims-ui-mobile/src/pages/maint/order-detail.vue b/eims-ui-mobile/src/pages/maint/order-detail.vue index d4755ba..6672463 100644 --- a/eims-ui-mobile/src/pages/maint/order-detail.vue +++ b/eims-ui-mobile/src/pages/maint/order-detail.vue @@ -17,7 +17,7 @@ safeAreaInsetTop > <template #right> - <text v-if="isOperatorOrRepair()" class="text-white">鎻愪氦</text> + <text v-if="isLineOrRepair()" class="text-white">鎻愪氦</text> <text v-else-if="isLeader()" class="text-white">楠岃瘉</text> </template> </wd-navbar> @@ -93,7 +93,7 @@ <wd-cell title="淇濆吇瀹屾垚(鎿嶄綔宸�)" title-width="200px" - v-if="order.status === '1' && isOperatorOrRepair()" + v-if="order.status === '1' && isLineOrRepair()" > <view style="text-align: right"> <wd-switch v-model="isFinish" /> @@ -109,7 +109,7 @@ 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' +import { isLeader, isLineOrRepair } from '@/utils/RoleUtils' const toast = useToast() const message = useMessage() @@ -238,7 +238,7 @@ toast.warning('褰撳墠宸ュ崟瀹屾垚鐘舵�侊紝涓嶅彲鎿嶄綔') break } - } else if (isOperatorOrRepair()) { + } else if (isLineOrRepair()) { switch (order.status) { case '0': break diff --git a/eims-ui-mobile/src/pages/repair/repair-add.vue b/eims-ui-mobile/src/pages/repair/repair-add.vue index a498a80..1a05452 100644 --- a/eims-ui-mobile/src/pages/repair/repair-add.vue +++ b/eims-ui-mobile/src/pages/repair/repair-add.vue @@ -115,9 +115,9 @@ /> <wd-cell title="鎶ヤ慨鍥剧墖" title-width="200rpx" prop="fileList"> <wd-upload - :file-list="model.fileList" + v-model:file-list="model.fileList" :action="VITE_UPLOAD_BASEURL" - @change="handleFileChange" + @success="handleUploadSuccess" ></wd-upload> </wd-cell> @@ -130,9 +130,26 @@ @open="openOccTime" @confirm="handleOccTimeConfirm" /> + <!-- <wd-picker + :columns="urgencyList" + label-key="dictLabel" + value-key="dictValue" + label="绱ф�ョ▼搴�" + v-model="model.urgencyLevel" + @confirm="handleConfirmUrgencyLevel" + /> --> + <wd-cell title="绱ф�ョ▼搴�" title-width="200rpx" prop="urgencyLevel"> + <wd-radio-group v-model="model.urgencyLevel" inline shape="dot"> @change="handleConfirmUrgencyLevel"> + <wd-radio v-for="item in urgencyList" :value="item.dictValue">{{item.dictLabel}}</wd-radio> + </wd-radio-group> + </wd-cell> + </wd-cell-group> - <wd-cell-group custom-class="mt-2" title="鍏朵粬淇℃伅" border> + + <wd-button style="margin: 20px" block @click="handleSubmit">鎻愪氦</wd-button> + + <!-- <wd-cell-group custom-class="mt-2" title="鍏朵粬淇℃伅" border> <wd-picker :columns="faultList" label-key="dictLabel" @@ -149,7 +166,7 @@ v-model="model.urgencyLevel" @confirm="handleConfirmUrgencyLevel" /> - </wd-cell-group> + </wd-cell-group> --> </wd-form> </view> </template> @@ -314,7 +331,10 @@ model.reqTime = formatDate(new Date()) model.reqDept = userStore?.userInfo?.deptId model.reqUser = userStore?.userInfo?.userId - model.faultPicture = model.fileList.join(',') + console.log('model', model) + const map = model.fileList?.map((file) => file.url) + console.log('map', map) + model.faultPicture = map.join(',') addRepairReq(model) .then((res: any) => { if (res?.code === 200) { @@ -326,17 +346,21 @@ } }) .catch((res) => { + console.error('娣诲姞鎶ヤ慨澶辫触:', res) toast.error(res?.data?.msg || '璇锋眰澶辫触') }) } -/** - * 涓婁紶鐐规鍥剧墖 - * @param fileList - */ -function handleFileChange({ fileList }) { - console.log('fileList:', fileList) - model.fileList = fileList + +function handleUploadSuccess({ file, fileList }) { + console.log('handleUploadSuccess', file) + // 鍒ゆ柇 file.response鏄笉鏄� 瀵硅薄锛屼笉鏄璞″皢json瀛楃涓茶浆鎹负瀵硅薄 + if (typeof file.response === 'string') { + file.response = JSON.parse(file.response) + console.log('file.response', file.response) + file.ossId = file.response.data.ossId + file.url = file.response.data.url + } } function checkData() { @@ -371,11 +395,14 @@ */ function openOccTime() { occTime.value = Date.now() + console.log('openOccTime', occTime) + model.occTime = formatDate(new Date(occTime.value)) } /** * 纭閫夋嫨鍙戠敓鏃堕棿 */ function handleOccTimeConfirm({ value }) { + console.log('handleOccTimeConfirm', value) model.occTime = formatDate(new Date(value)) } diff --git a/eims-ui-mobile/src/pages/repair/repair-fb.vue b/eims-ui-mobile/src/pages/repair/repair-fb.vue index 125226f..38a6d05 100644 --- a/eims-ui-mobile/src/pages/repair/repair-fb.vue +++ b/eims-ui-mobile/src/pages/repair/repair-fb.vue @@ -57,30 +57,13 @@ </view> </template> <wd-cell title="缁翠慨婊℃剰搴�"> - <wd-rate v-model="repairFb.repairSatisfaction" change="handleChange"></wd-rate> + <wd-radio-group v-model="repairFb.repairSatisfaction" inline shape="dot"> + <wd-radio :value="0">涓嶆弧鎰�</wd-radio> + <wd-radio :value="1">婊℃剰</wd-radio> + </wd-radio-group> </wd-cell> - <wd-cell title="缁翠慨鍙婃椂鎬�"> - <wd-rate v-model="repairFb.repairTimeliness" change="handleChange"></wd-rate> - </wd-cell> - <wd-cell title="缁翠慨鍙婃�佸害"> - <wd-rate v-model="repairFb.serviceAttitude" change="handleChange"></wd-rate> - </wd-cell> - <wd-cell title="缁翠慨鐜板満6S"> - <wd-rate v-model="repairFb.repairSs" change="handleChange"></wd-rate> - </wd-cell> - <wd-textarea - label="缁撴灉鍙嶉" - label-width="200rpx" - type="textarea" - v-model="repairFb.fbResult" - auto-height - :maxlength="200" - show-word-limit - placeholder="璇疯緭鍏ョ粨鏋滃弽棣�" - clearable - /> - <wd-textarea + v-if="repairFb.repairSatisfaction === 0" label="鎰忚鎴栧缓璁�" label-width="200rpx" type="textarea" @@ -90,8 +73,12 @@ show-word-limit placeholder="璇疯緭鍏ユ剰瑙佹垨寤鸿" clearable + required + /> </wd-cell-group> + + <wd-button style="margin: 20px" block @click="handleRepairFb">鎻愪氦</wd-button> </view> </template> <script setup lang="ts"> @@ -103,9 +90,11 @@ updateRepairFb, } from '@/service/repair' import { reactive } from 'vue' -import { isLeader, isOperatorOrRepair } from '@/utils/RoleUtils' +import { isLeader, isLineOrRepair } from '@/utils/RoleUtils' import { RepairResVO, RepairFbVO, RepairRecordVO } from '@/service/repair.d' +import { useUserStore } from "@/store"; +const userStore = useUserStore() const isUpdate = ref(false) const repairRes = reactive<RepairResVO>({ id: '', @@ -129,7 +118,7 @@ resCode: '', fbResult: '', suggestions: '', - repairSatisfaction: 0, + repairSatisfaction: 1, repairTimeliness: 0, serviceAttitude: 0, repairSs: 0, @@ -192,9 +181,16 @@ } function handleRepairFb() { - if(isOperatorOrRepair()){ + if(repairRes.reqUser !== userStore.userInfo.userId){ uni.showToast({ - title: '鏃犳潈闄�,璇风櫥褰曠鐞嗗憳璐﹀彿鎿嶄綔', + title: '鍙湁璇锋眰浜烘墠鏈夎瘎浠锋潈闄�', + icon: 'none', + }) + return false + } + if (repairFb.repairSatisfaction === 0 && !repairFb.suggestions) { + uni.showToast({ + title: '璇峰~鍐欐剰瑙佹垨寤鸿', icon: 'none', }) return false @@ -209,6 +205,8 @@ title: '淇敼鎴愬姛', icon: 'none', }) + uni.navigateBack() + uni.$emit('res-list-refresh') } }) .catch((res) => {}) @@ -220,6 +218,8 @@ title: '璇勪环鎴愬姛', icon: 'none', }) + uni.navigateBack() + uni.$emit('res-list-refresh') } }) .catch((res) => {}) diff --git a/eims-ui-mobile/src/pages/repair/req-detail.vue b/eims-ui-mobile/src/pages/repair/req-detail.vue new file mode 100644 index 0000000..987569c --- /dev/null +++ b/eims-ui-mobile/src/pages/repair/req-detail.vue @@ -0,0 +1,252 @@ +<route lang="json5" type="page"> +{ + layout: 'default', + needLogin: true, + style: { + navigationBarTitleText: '鎶ヤ慨璇︽儏', + navigationStyle: 'custom' + }, +} +</route> +<template> + <view class="bg-base container" safeAreaInsetTopBottom> + <wd-navbar + title="鎶ヤ慨璇︽儏" + left-arrow + @click-left="goBack" + custom-style="background: #4D80F0;" + safeAreaInsetTop + ></wd-navbar> + + <view class="content"> + <!-- 鐘舵�佸睍绀� --> + <view class="status-card"> + <view class="status-header"> + <text class="status-code">{{ repairReq.code }}</text> + <view class="status-tag"> + <wd-button size="small" v-if="repairReq.status === '0'" type="info">寰呮帴鍗�</wd-button> + <wd-button size="small" v-else-if="repairReq.status === '1'" type="warning">宸叉帴鍗�</wd-button> + <wd-button size="small" v-else-if="repairReq.status === '2'" type="primary">缁翠慨涓�</wd-button> + <wd-button size="small" v-else-if="repairReq.status === '3'" type="success">宸插畬鎴�</wd-button> + </view> + </view> + </view> + + <!-- 璁惧淇℃伅 --> + <wd-cell-group + v-if="repairReq.reqType === '1'" + custom-class="mt-2" + title="璁惧淇℃伅" + use-slot + border + > + <wd-cell title="璁惧鍚嶇О" title-width="200rpx"> + <text>{{ repairReq.equName }}</text> + </wd-cell> + <wd-cell title="璧勪骇缂栧彿" title-width="200rpx"> + <text>{{ repairReq.assetNo }}</text> + </wd-cell> + </wd-cell-group> + + <!-- 宸ュ叿淇℃伅 --> + <wd-cell-group + v-if="repairReq.reqType === '2'" + custom-class="mt-2" + title="宸ュ叿淇℃伅" + use-slot + border + > + <wd-cell title="宸ュ叿鍚嶇О" title-width="200rpx"> + <text>{{ repairReq.fixtureName }}</text> + </wd-cell> + </wd-cell-group> + + <!-- 鎶ヤ慨淇℃伅 --> + <wd-cell-group custom-class="mt-2" title="鎶ヤ慨淇℃伅" use-slot border> + <wd-cell title="鎶ヤ慨绫诲瀷" title-width="200rpx"> + <text v-if="repairReq.reqType === '1'">璁惧绫诲瀷</text> + <text v-else-if="repairReq.reqType === '2'">宸ュ叿绫诲瀷</text> + <text v-else-if="repairReq.reqType === '3'">鍏朵粬绫诲瀷</text> + </wd-cell> + <wd-cell title="鍙戠敓鏃堕棿" title-width="200rpx"> + <text>{{ repairReq.occTime }}</text> + </wd-cell> + <wd-cell title="鎶ヤ慨鏃堕棿" title-width="200rpx"> + <text>{{ repairReq.reqTime }}</text> + </wd-cell> + <wd-cell title="鎶ヤ慨浜�" title-width="200rpx"> + <text>{{ repairReq.reqUserName }}</text> + </wd-cell> + <wd-cell title="绱ф�ョ▼搴�" title-width="200rpx"> + <wd-tag type="danger" v-if="repairReq.urgencyLevel === '1'">绱ф��</wd-tag> + <wd-tag type="warning" v-else-if="repairReq.urgencyLevel === '2'">涓�鑸�</wd-tag> + <wd-tag type="success" v-else-if="repairReq.urgencyLevel === '3'">鏅��</wd-tag> + </wd-cell> + </wd-cell-group> + + <!-- 鏁呴殰鎻忚堪 --> + <wd-cell-group custom-class="mt-2" title="鏁呴殰鎻忚堪" use-slot border> + <view class="description-box"> + <text>{{ repairReq.reqDesc }}</text> + </view> + </wd-cell-group> + + <!-- 鏁呴殰鍥剧墖 --> + <wd-cell-group v-if="repairReq.faultPicture" custom-class="mt-2" title="鏁呴殰鍥剧墖" use-slot border> + <view class="image-box"> + <image + class="fault-image" + :src="repairReq.faultPicture" + mode="aspectFit" + @click="previewImage" + /> + </view> + </wd-cell-group> + </view> + </view> +</template> + +<script setup lang="ts"> +import { reactive, onMounted } from 'vue' +import { useToast } from 'wot-design-uni' +import { getRepairReqList } from '@/service/repair' +import type { RepairReqVO } from '@/service/repair.d' + +const toast = useToast() + +// 鎶ヤ慨璇锋眰鏁版嵁 +const repairReq = reactive<RepairReqVO>({ + id: '', + code: '', + status: '', + occTime: '', + reqTime: '', + reqDept: 0, + reqUser: 0, + reqDesc: '', + urgencyLevel: '', + faultPicture: '', + reqType: '', + equId: '', + repairId: '', + repairDept: 0, + repairUser: 0, + faultType: '', + remark: '', + reqUserName: '', + equName: '', + assetNo: '', + fixtureName: '' +}) + +// 鑾峰彇鎶ヤ慨璇锋眰璇︽儏 +function getRepairReqDetail(id: string | number) { + getRepairReqList({ id }) + .then((res: any) => { + if (res && res.rows && res.rows.length > 0) { + Object.assign(repairReq, res.rows[0]) + } else { + toast.error('鑾峰彇鎶ヤ慨璇︽儏澶辫触') + } + }) + .catch((err) => { + console.error('鑾峰彇鎶ヤ慨璇︽儏澶辫触', err) + toast.error('鑾峰彇鎶ヤ慨璇︽儏澶辫触') + }) +} + +// 棰勮鍥剧墖 +function previewImage() { + if (repairReq.faultPicture) { + uni.previewImage({ + urls: [repairReq.faultPicture], + current: repairReq.faultPicture + }) + } +} + +// 杩斿洖涓婁竴椤� +function goBack() { + uni.navigateBack() +} + +// 椤甸潰鍔犺浇鏃惰幏鍙栨姤淇鎯� +onLoad((options) => { + if (options && options.id) { + getRepairReqDetail(options.id) + } else { + toast.error('鍙傛暟閿欒') + setTimeout(() => { + goBack() + }, 1500) + } +}) +</script> + +<style scoped lang="scss"> +.container { + min-height: 100vh; + background-color: #f5f5f5; +} + +.content { + padding: 20rpx; +} + +.status-card { + background-color: #ffffff; + border-radius: 12rpx; + padding: 24rpx; + margin-bottom: 20rpx; + box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05); +} + +.status-header { + display: flex; + justify-content: space-between; + align-items: center; +} + +.status-code { + font-size: 32rpx; + font-weight: bold; + color: #333333; +} + +.description-box { + padding: 24rpx; + background-color: #f9f9f9; + border-radius: 8rpx; + margin: 16rpx; + color: #666666; + line-height: 1.6; +} + +.image-box { + padding: 24rpx; + display: flex; + justify-content: center; +} + +.fault-image { + width: 80%; + height: 400rpx; + border-radius: 8rpx; + box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1); +} + +:deep(.wd-cell-group__title) { + font-size: 28rpx; + font-weight: bold; + color: #4D80F0; +} + +:deep(.wd-cell__title) { + color: #666666; +} + +:deep(.wd-cell__value) { + color: #333333; + font-weight: 500; +} +</style> \ No newline at end of file diff --git a/eims-ui-mobile/src/pages/repair/req-list.vue b/eims-ui-mobile/src/pages/repair/req-list.vue index c93a9ea..ea3ff6f 100644 --- a/eims-ui-mobile/src/pages/repair/req-list.vue +++ b/eims-ui-mobile/src/pages/repair/req-list.vue @@ -23,125 +23,134 @@ custom-style="background: #4D80F0;" safeAreaInsetTop ></wd-navbar> - <wd-drop-menu v-if="!isSelectReq"> - <wd-drop-menu-item - v-model="reqTypeId" - label-key="dictLabel" - value-key="dictValue" - :options="reqTypeList" - @change="handleReqType" - /> - <wd-drop-menu-item - v-model="filterDate" - :options="filterDateList" - @change="handleFilterDate" - /> - <wd-drop-menu-item - v-model="status" - label-key="dictLabel" - value-key="dictValue" - :options="statusList" - @change="handleReqStatu" - /> - </wd-drop-menu> +<!-- <wd-drop-menu v-if="!isSelectReq">--> +<!-- <wd-drop-menu-item--> +<!-- v-model="reqTypeId"--> +<!-- label-key="dictLabel"--> +<!-- value-key="dictValue"--> +<!-- :options="reqTypeList"--> +<!-- @change="handleReqType"--> +<!-- />--> +<!-- <wd-drop-menu-item--> +<!-- v-model="filterDate"--> +<!-- :options="filterDateList"--> +<!-- @change="handleFilterDate"--> +<!-- />--> +<!-- <wd-drop-menu-item--> +<!-- v-model="status"--> +<!-- label-key="dictLabel"--> +<!-- value-key="dictValue"--> +<!-- :options="statusList"--> +<!-- @change="handleReqStatu"--> +<!-- />--> +<!-- </wd-drop-menu>--> </template> <view class="bg-base"> - <wd-card type="rectangle" v-for="(item, index) in dataList" :key="item.id"> - <template #title> - <view class="flex justify-between items-center"> - <view class="flex items-center menu-title-box"> - <view class="menu-indicator"></view> - <text class="ml-1 text-sm">{{ item.code }}</text> - </view> + <ReqCard + v-for="item in dataList" + :key="item.id" + :item="item" + @itemClick="itemClick" + ></ReqCard> +<!-- <wd-card type="rectangle" v-for="(item, index) in dataList" :key="item.id">--> +<!-- <template #title>--> +<!-- <view class="flex justify-between items-center">--> +<!-- <view class="flex items-center menu-title-box">--> +<!-- <view class="menu-indicator"></view>--> +<!-- <text class="ml-1 text-sm">{{ item.code }}</text>--> +<!-- </view>--> - <view> - <wd-button size="small" v-if="item.status === '0'" type="info">寰呮帴鍗�</wd-button> - <wd-button size="small" v-else-if="item.status === '1'" type="warning"> - 宸叉帴鍗� - </wd-button> - <wd-button size="small" v-else-if="item.status === '2'" type="primary"> - 缁翠慨涓� - </wd-button> - <wd-button size="small" v-else-if="item.status === '3'" type="success"> - 宸插畬鎴� - </wd-button> - </view> - </view> - </template> - <wd-swipe-action> - <view class="flex h-[160rpx] items-center" @click.stop="itemClick(item)"> - <image - v-if="item.reqType === '1'" - class="slot-img text-center" - src="/static/ico/ico-huiyi.png" - /> - <image - v-else-if="item.reqType === '2'" - class="slot-img text-center" - src="/static/ico/ico-setting.png" - /> - <image - v-else-if="item.reqType === '3'" - class="slot-img text-center" - src="/static/ico/ico-faxian.png" - /> - <view class="flex-1 mt-1"> - <view class="text-color-base"> - <template v-if="item.reqType === '1'"> - <text>璁惧绫诲瀷</text> - <text class="mx-2">|</text> - <text>{{ item.equName }}</text> - </template> +<!-- <view>--> +<!-- <wd-button size="small" v-if="item.status === '0'" type="info">寰呮帴鍗�</wd-button>--> +<!-- <wd-button size="small" v-else-if="item.status === '1'" type="warning">--> +<!-- 宸叉帴鍗�--> +<!-- </wd-button>--> +<!-- <wd-button size="small" v-else-if="item.status === '2'" type="primary">--> +<!-- 缁翠慨涓�--> +<!-- </wd-button>--> +<!-- <wd-button size="small" v-else-if="item.status === '3'" type="success">--> +<!-- 宸插畬鎴�--> +<!-- </wd-button>--> +<!-- </view>--> +<!-- </view>--> +<!-- </template>--> +<!-- <wd-swipe-action>--> +<!-- <view class="flex h-[160rpx] items-center" @click.stop="itemClick(item)">--> +<!-- <image--> +<!-- v-if="item.reqType === '1'"--> +<!-- class="slot-img text-center"--> +<!-- src="/static/ico/ico-huiyi.png"--> +<!-- />--> +<!-- <image--> +<!-- v-else-if="item.reqType === '2'"--> +<!-- class="slot-img text-center"--> +<!-- src="/static/ico/ico-setting.png"--> +<!-- />--> +<!-- <image--> +<!-- v-else-if="item.reqType === '3'"--> +<!-- class="slot-img text-center"--> +<!-- src="/static/ico/ico-faxian.png"--> +<!-- />--> +<!-- <view class="flex-1 mt-1">--> +<!-- <view class="text-color-base">--> +<!-- <template v-if="item.reqType === '1'">--> +<!-- <text>璁惧绫诲瀷</text>--> +<!-- <text class="mx-2">|</text>--> +<!-- <text>{{ item.equName }}</text>--> +<!-- </template>--> - <template v-if="item.reqType === '2'"> - <text>宸ュ叿绫诲瀷</text> - <text class="mx-2">|</text> - <text>{{ item.fixtureName }}</text> - </template> +<!-- <template v-if="item.reqType === '2'">--> +<!-- <text>宸ュ叿绫诲瀷</text>--> +<!-- <text class="mx-2">|</text>--> +<!-- <text>{{ item.fixtureName }}</text>--> +<!-- </template>--> - <template v-if="item.reqType === '3'"> - <text>鍏朵粬绫诲瀷</text> - </template> - <view class="text-color-gray mt-1 text-mini"> - <text>鍙戠敓鏃堕棿: {{ item.occTime }}</text> - </view> +<!-- <template v-if="item.reqType === '3'">--> +<!-- <text>鍏朵粬绫诲瀷</text>--> +<!-- </template>--> +<!-- <view class="text-color-gray mt-1 text-mini">--> +<!-- <text>鍙戠敓鏃堕棿: {{ item.occTime }}</text>--> +<!-- </view>--> - <view class="text-color-gray mt-1 text-mini"> - <text>鎶ヤ慨鏃堕棿: {{ item.reqTime }}</text> - </view> - <view class="text-color-gray mt-1 text-mini"> - <text>鎶ヤ慨浜�: {{ item.reqUserName }}</text> - </view> - </view> - <view class="text-color-gray text-sm mt-1"> - {{ item.location }} {{ item.madeIn }} - </view> - </view> - <view v-if="isSelectReq"> - <wd-button size="small" icon="edit-outline" @click.stop="handleSelectReq(item)"> - 鎺ュ崟 - </wd-button> - </view> - </view> - <template #right> - <view class="h-full px-3 flex items-center"> - <wd-button size="small" type="error" @click.stop="handleDelete(item)">鍒犻櫎</wd-button> - </view> - </template> - </wd-swipe-action> - </wd-card> +<!-- <view class="text-color-gray mt-1 text-mini">--> +<!-- <text>鎶ヤ慨鏃堕棿: {{ item.reqTime }}</text>--> +<!-- </view>--> +<!-- <view class="text-color-gray mt-1 text-mini">--> +<!-- <text>鎶ヤ慨浜�: {{ item.reqUserName }}</text>--> +<!-- </view>--> +<!-- </view>--> +<!-- <view class="text-color-gray text-sm mt-1">--> +<!-- {{ item.location }} {{ item.madeIn }}--> +<!-- </view>--> +<!-- </view>--> +<!-- <view v-if="isSelectReq">--> +<!-- <wd-button size="small" icon="edit-outline" @click.stop="handleSelectReq(item)">--> +<!-- 鎺ュ崟--> +<!-- </wd-button>--> +<!-- </view>--> +<!-- </view>--> +<!-- <template #right>--> +<!-- <view class="h-full px-3 flex items-center">--> +<!-- <wd-button size="small" type="error" @click.stop="handleDelete(item)">鍒犻櫎</wd-button>--> +<!-- </view>--> +<!-- </template>--> +<!-- </wd-swipe-action>--> +<!-- </wd-card>--> </view> </z-paging> </template> <script setup lang="ts"> -import { onMounted, getCurrentInstance, ref } from 'vue' import { useToast, useMessage } from 'wot-design-uni' import { getRepairReqList, delRepairReq } from '@/service/repair' import { DICT_REPAIR_REQ_STATUS, DICT_REPAIR_REQ_TYPE, getDictInfo } from '@/service/dict' import dayjs from "dayjs"; +import { isEquAdmin, isRepair } from "@/utils/RoleUtils"; +import { useUserStore } from "@/store"; +import ReqCard from "@/components/repair/req-card.vue"; +const userStore = useUserStore() const message = useMessage() const toast = useToast() // 鎶ヤ慨鍗曠被鍨� @@ -180,31 +189,38 @@ const queryParams: any = { pageNum, pageSize, - reqType: reqTypeId.value, - status: status.value, + params: {}, } - if (reqTypeId.value === -1) { - delete queryParams.reqType - } - if (status.value === -1) { - delete queryParams.status - } + // if (reqTypeId.value === -1) { + // delete queryParams.reqType + // } + // if (status.value === -1) { + // delete queryParams.status + // } + // + // if (filterDate.value === '1') { + // // 鑾峰彇褰撳墠鏃ユ湡 + // const now = dayjs() + // queryParams.params = { + // beginReqTime: now.startOf('day').format('YYYY-MM-DD 00:00:00'), + // endReqTime: now.endOf('day').format('YYYY-MM-DD 23:59:59'), + // } + // } else if (filterDate.value === '2') { + // const now = dayjs() + // queryParams.params = { + // beginReqTime: now.startOf('month').format('YYYY-MM-DD 00:00:00'), + // endReqTime: now.endOf('month').format('YYYY-MM-DD 23:59:59'), + // } + // } else { + // delete queryParams.params + // } - if (filterDate.value === '1') { - // 鑾峰彇褰撳墠鏃ユ湡 - const now = dayjs() - queryParams.params = { - beginReqTime: now.startOf('day').format('YYYY-MM-DD 00:00:00'), - endReqTime: now.endOf('day').format('YYYY-MM-DD 23:59:59'), - } - } else if (filterDate.value === '2') { - const now = dayjs() - queryParams.params = { - beginReqTime: now.startOf('month').format('YYYY-MM-DD 00:00:00'), - endReqTime: now.endOf('month').format('YYYY-MM-DD 23:59:59'), - } - } else { - delete queryParams.params + // 鏌ヨ鏈畬鎴愮殑鎶ヤ慨鍗� + queryParams.params.status = '0,1,2' + queryParams.reqUser = userStore?.userInfo?.userId + if (isRepair() || isEquAdmin()) { + queryParams.params.status = '0' + queryParams.reqUser = undefined } getRepairReqList(queryParams) @@ -330,10 +346,10 @@ onLoad(() => { initData() - uni.$on('req-list-refresh', reloadData) + uni.$on('list-refresh', reloadData) }) onUnload(() => { - uni.$off('req-list-refresh', reloadData) + uni.$off('list-refresh', reloadData) }) </script> diff --git a/eims-ui-mobile/src/pages/repair/res-detail.vue b/eims-ui-mobile/src/pages/repair/res-detail.vue index 77b739b..ddd618f 100644 --- a/eims-ui-mobile/src/pages/repair/res-detail.vue +++ b/eims-ui-mobile/src/pages/repair/res-detail.vue @@ -30,7 +30,15 @@ <wd-cell title="鏁呴殰绫诲瀷" title-width="200rpx" is-link> <text>{{ reqType?.dictLabel }}</text> </wd-cell> - <wd-cell title="鎶ヤ慨鎻忚堪" :label="repairRes?.reqDesc" is-link /> + + <wd-textarea + label="鎶ヤ慨鎻忚堪" + label-width="200rpx" + type="textarea" + v-model="repairRes.reqDesc" + auto-height + readonly + /> </wd-cell-group> <wd-cell-group @@ -64,6 +72,11 @@ </wd-cell-group> <wd-cell-group custom-class="mt-2" title="缁翠慨淇℃伅" use-slot border> + <wd-cell title="鏁呴殰绫诲埆" title-width="200rpx" prop="faultType"> + <wd-radio-group v-model="repairRes.faultType" inline shape="dot"> > + <wd-radio v-for="item in faultList" :value="item.dictValue">{{item.dictLabel}}</wd-radio> + </wd-radio-group> + </wd-cell> <wd-textarea label="鍘熷洜鍒嗘瀽" label-width="200rpx" @@ -112,28 +125,90 @@ clearable /> </wd-cell-group> + <wd-cell-group custom-class="mt-2" title="澶囦欢淇℃伅" use-slot border> + <!-- 澶囦欢淇℃伅褰曞叆鍖哄煙 --> + <view v-if="repairRes.spareParts && repairRes.spareParts.length > 0" class="mt-2"> + <view + v-for="(part, partIndex) in repairRes.spareParts" + :key="partIndex" + class="flex justify-between mt-1" + > + <wd-input + v-model="part.name" + label="鍚嶇О锛�" + label-width="100rpx" + placeholder="澶囦欢鍚嶇О" + + + /> + <wd-input + v-model="part.quantity" + label="鏁伴噺锛�" + label-width="100rpx" + placeholder="鏁伴噺" type="number" :maxlength="5" /> + </view> + </view> + <!-- 缁翠慨璇存槑鍖哄煙 --> + <view class="mt-2 flex justify-end"> + <wd-button type="success" style="margin: 20px" @click.stop="addSparePart()"> + 娣诲姞澶囦欢 + </wd-button> + </view> <view class="h-[2px] w-full bg-base"></view> + </wd-cell-group> </wd-form> +<!-- <wd-button style="margin: 20px" block @click="handleClickRight">鎻愪氦</wd-button>--> + <view class="h-[20px] w-full bg-base"></view> </view> + + <!-- 澶囦欢閫夋嫨寮瑰嚭灞� --> + <wd-popup v-model="showSparePopup" position="bottom" height="33.33vh"> + <view class="flex justify-between p-2 bg-white"> + <wd-button type="text" @click="closeSparePopup">鍙栨秷</wd-button> + <wd-button type="text" @click="addOtherSparePart">鍏朵粬</wd-button> + + </view> + <wd-input + v-model="searchKeyword" + placeholder="璇疯緭鍏ュ浠跺悕绉版垨鍨嬪彿" + clearable + @input="filterSpareParts" + /> + <view class="p-2"> + <view + v-for="(part, index) in sparePartsList" + :key="index" + class="flex justify-between items-center p-2 border-b" + @click="selectFilteredSparePart(part)" + > + <text>{{ part.name }} ({{ part.code }})</text> + <text>鍓╀綑: {{ part.actualStock }}</text> + </view> + </view> + </wd-popup> </template> <script setup lang="ts"> import { getRepairRes, updateRepairRes } from '@/service/repair' import { RepairResVO } from '@/service/repair.d' -import { reactive, onMounted, ref } 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' -import { DICT_REPAIR_REQ_TYPE, getDictInfo } from '@/service/dict' +import { isEquAdmin, isLeader, isLineOrRepair, isRepair } from "@/utils/RoleUtils"; +import { DICT_REPAIR_FAULT_TYPE, DICT_REPAIR_REQ_TYPE, getDictInfo } from "@/service/dict"; import { formatDate } from '@/utils/DateUtils' const toast = useToast() const message = useMessage() - +const showSparePopup = ref(false) +import { getSpareList } from '@/service/spare' +import { ref } from "vue"; const fileList = ref<[]>() - +const selectedPartIndex = ref(-1) +const sparePartsList = ref([]) +const searchKeyword = ref('') // 鎶ヤ慨鍗曠被鍨� const reqTypeList = ref<any>([]) - +// 鏁呴殰绫诲埆 +const faultList = ref<any>([]) const repairRes = reactive<RepairResVO>({ id: '', resCode: '', @@ -158,6 +233,59 @@ ], } +function filterSpareParts() { + if (!searchKeyword.value) { + loadSpareParts() + } else { + loadSpareParts(searchKeyword.value) + } +} +// 澶囦欢閫夋嫨鐩稿叧閫昏緫 +function addSparePart() { + // if (!item.spareParts) { + // item.spareParts = [] + // } + repairRes.spareParts.value = [] + + selectSparePart() +} + +function selectSparePart(item: any) { + showSparePopup.value = true + + loadSpareParts() +} + +function loadSpareParts(value?: string) { + getSpareList({ name: value, pageNum: 1, pageSize: 10 }).then((res: any) => { + sparePartsList.value = res.rows + + }) +} + +function selectFilteredSparePart(part: any) { + repairRes.spareParts.value.push({ + id: part.id, + name: part.name, + quantity: '', + }) + closeSparePopup() +} +function addOtherSparePart() { + repairRes.spareParts.value.push({ + id: '', + name: '', + quantity: '', + }) + closeSparePopup(); +} + +function closeSparePopup() { + showSparePopup.value = false + selectedPartIndex.value = -1 + searchKeyword.value = '' +} + function handleFileChange({ fileList }) {} function initRepairRes(id: any) { @@ -172,6 +300,8 @@ initRepairRes(options.id) const reqList = await getDictInfo(DICT_REPAIR_REQ_TYPE) reqTypeList.value = reqList + const fList = await getDictInfo(DICT_REPAIR_FAULT_TYPE) + faultList.value = fList } function hanldeUpdateRepairRes(data: any, resolve: any) { @@ -180,6 +310,7 @@ resolve(true) toastSucces() uni.$emit('res-list-refresh') + uni.navigateBack() }) .catch((res) => { console.error(res) @@ -207,9 +338,7 @@ onNavigationBarButtonTap((e) => { if (e.index === 0) { // 绠$悊鍛樿鑹� - if (isLeader()) { - toast.warning('褰撳墠鐧诲綍瑙掕壊涓嶅彲鎿嶄綔') - } else if (isOperatorOrRepair()) { + if (isRepair() || isEquAdmin()) { switch (repairRes.status) { // 宸叉帴鍗� case '1': @@ -232,9 +361,7 @@ } } } else if (e.index === 1) { - if (isLeader()) { - toast.warning('褰撳墠鐧诲綍瑙掕壊涓嶅彲鎿嶄綔') - } else if (isOperatorOrRepair()) { + if (isRepair() || isEquAdmin()) { switch (repairRes.status) { // 宸叉帴鍗� case '1': diff --git a/eims-ui-mobile/src/pages/repair/res-list.vue b/eims-ui-mobile/src/pages/repair/res-list.vue index 914a751..e782d72 100644 --- a/eims-ui-mobile/src/pages/repair/res-list.vue +++ b/eims-ui-mobile/src/pages/repair/res-list.vue @@ -12,177 +12,38 @@ title="璁惧缁翠慨" left-arrow @click-left="goBack" - right-text="鎻愪氦" - @click-right="handleClickRight" custom-style="background: #4D80F0;" safeAreaInsetTop > - <template #right> - <text v-if="isOperatorOrRepair()" class="text-white">鎺ュ崟</text> - </template> +<!-- <template #right>--> +<!-- <text v-if="isLineOrRepair()" class="text-white">鎺ュ崟</text>--> +<!-- </template>--> </wd-navbar> - <wd-drop-menu> - <wd-drop-menu-item - v-model="resTypeId" - label-key="dictLabel" - value-key="dictValue" - :options="resTypeList" - @change="handleResType" - /> - <wd-drop-menu-item - v-model="filterDate" - :options="filterDateList" - @change="handleFilterDate" - /> - <wd-drop-menu-item - v-model="status" - label-key="dictLabel" - value-key="dictValue" - :options="statusList" - @change="handleResStatu" - /> - </wd-drop-menu> +<!-- <wd-drop-menu>--> +<!-- <wd-drop-menu-item--> +<!-- v-model="resTypeId"--> +<!-- label-key="dictLabel"--> +<!-- value-key="dictValue"--> +<!-- :options="resTypeList"--> +<!-- @change="handleResType"--> +<!-- />--> +<!-- <wd-drop-menu-item--> +<!-- v-model="filterDate"--> +<!-- :options="filterDateList"--> +<!-- @change="handleFilterDate"--> +<!-- />--> +<!-- <wd-drop-menu-item--> +<!-- v-model="status"--> +<!-- label-key="dictLabel"--> +<!-- value-key="dictValue"--> +<!-- :options="statusList"--> +<!-- @change="handleResStatu"--> +<!-- />--> +<!-- </wd-drop-menu>--> </template> <view class="bg-base"> - <wd-card type="rectangle" v-for="(item, index) in dataList" :key="item.id"> - <template #title> - <view class="flex justify-between items-center"> - <view class="flex items-center menu-title-box"> - <view class="menu-indicator"></view> - <text class="ml-1 text-sm">{{ item.resCode }}</text> - <text class="text-color-gray ml-2 text-mini">鎺ュ崟:{{ item.createTime }}</text> - </view> - - <view> - <wd-tag size="small" v-if="item.status === '1'" type="warning">宸叉帴鍗�</wd-tag> - <wd-tag size="small" v-else-if="item.status === '2'" type="primary">缁翠慨涓�</wd-tag> - <wd-tag size="small" v-else-if="item.status === '3'" type="success">宸插畬鎴�</wd-tag> - </view> - </view> - </template> - <view class="flex h-[240rpx] items-center"> - <image - v-if="item.reqType === '1'" - class="slot-img text-center" - src="/static/ico/ico-huiyi.png" - /> - <image - v-else-if="item.reqType === '2'" - class="slot-img text-center" - src="/static/ico/ico-setting.png" - /> - <image - v-else-if="item.reqType === '3'" - class="slot-img text-center" - src="/static/ico/ico-faxian.png" - /> - <view class="flex-1 mt-1"> - <view class="text-color-base"> - <template v-if="item.reqType === '1'"> - <text>璁惧绫诲瀷</text> - <text class="mx-2">|</text> - <text>{{ item.equName }}</text> - </template> - - <template v-if="item.reqType === '2'"> - <text>宸ュ叿绫诲瀷</text> - <text class="mx-2">|</text> - <text>{{ item.fixtureName }}</text> - </template> - - <template v-if="item.reqType === '3'"> - <text>鍏朵粬绫诲瀷</text> - </template> - <view class="text-color-gray mt-1 text-mini"> - <text>鎶ヤ慨浜�: {{ item.reqUserName }}</text> - </view> - <view class="text-color-gray mt-1 text-mini"> - <text>鎶ヤ慨鏃堕棿: {{ item.reqTime }}</text> - </view> - - <view class="text-color-gray mt-1 text-mini"> - <text>缁翠慨寮�濮�: {{ item.startTime }}</text> - </view> - <view class="text-color-gray mt-1 text-mini"> - <text>缁翠慨缁撴潫: {{ item.endTime }}</text> - </view> - <view class="text-color-gray mt-1 text-mini"> - <text>缁翠慨浜�: {{ item.resUserName }}</text> - </view> - </view> - </view> - <view> - <!--鎿嶄綔宸ユ垨缁翠慨宸ヨ鑹�--> - <template v-if="isOperatorOrRepair()"> - <wd-button - v-if="item.status === '1'" - size="small" - icon="edit-outline" - @click.stop="handleStartRepair(item)" - > - 寮�濮嬬淮淇� - </wd-button> - <wd-button - v-else-if="item.status === '2'" - size="small" - icon="edit-outline" - @click.stop="itemClick(item)" - > - 缁翠慨涓� - </wd-button> - <view class="h-full flex flex-col" v-else-if="item.status === '3'"> - <wd-button size="small" icon="warn-bold" @click.stop="itemClick(item)"> - 璇︽儏 - </wd-button> - <wd-button - class="mt-4" - size="small" - icon="edit-outline" - @click.stop="goToFeedBack(item)" - > - 鏌ョ湅璇勪环 - </wd-button> - </view> - </template> - - <!--绠$悊鍛樿鑹�--> - <template v-else-if="isLeader()"> - <wd-button - v-if="item.status === '1'" - size="small" - icon="warn-bold" - disabled - @click.stop="itemClick(item)" - > - 寰呯淮淇� - </wd-button> - <wd-button - v-else-if="item.status === '2'" - size="small" - icon="warn-bold" - disabled - @click.stop="itemClick(item)" - > - 缁翠慨涓� - </wd-button> - <view class="h-full flex flex-col" v-else-if="item.status === '3'"> - <wd-button size="small" icon="warn-bold" @click.stop="itemClick(item)"> - 璇︽儏 - </wd-button> - <wd-button - class="mt-4" - size="small" - icon="edit-outline" - @click.stop="goToFeedBack(item)" - > - {{ item.fbId == null ? '鍐欒瘎浠�' : '鏌ョ湅璇勪环' }} - </wd-button> - </view> - </template> - </view> - </view> - </wd-card> + <res-card v-for="(item, index) in dataList" :key="item.id" :item="item" @click="handleResClick" /> </view> </z-paging> </template> @@ -192,10 +53,11 @@ import { useToast, useMessage } from 'wot-design-uni' import { getRepairResList, addRepairRes, updateRepairRes } from '@/service/repair' import { DICT_REPAIR_RES_STATUS, DICT_REPAIR_REQ_TYPE, getDictInfo } from '@/service/dict' -import { isLeader, isOperatorOrRepair } from '@/utils/RoleUtils' +import { isLeader, isLineOrRepair, isRepair } from "@/utils/RoleUtils"; import { useUserStore } from '@/store' import { formatDate } from '@/utils/DateUtils' import dayjs from "dayjs"; +import ResCard from "@/components/repair/res-card.vue"; const userStore = useUserStore() const message = useMessage() @@ -232,15 +94,15 @@ ]) const resTypeList = ref<any>([{ dictLabel: '鎵�鏈夌被鍨�', dictValue: -1 }]) const statusList = ref<any>([{ dictLabel: '鎵�鏈夌姸鎬�', dictValue: -1 }]) -function handleResType({ value }) { - reloadData() -} -function handleResStatu({ value }) { - reloadData() -} -function handleFilterDate({ value }) { - reloadData() -} +// function handleResType({ value }) { +// reloadData() +// } +// function handleResStatu({ value }) { +// reloadData() +// } +// function handleFilterDate({ value }) { +// reloadData() +// } const paging = ref(null) const dataList = ref([]) @@ -249,35 +111,44 @@ const queryParams: any = { pageNum, pageSize, - reqType: resTypeId.value, - status: status.value, + params: {}, + // reqType: resTypeId.value, + // status: status.value, } - if (resTypeId.value === -1) { - delete queryParams.reqType - } - if (status.value === -1) { - delete queryParams.status - } - - if (filterDate.value === '1') { - // 鑾峰彇褰撳墠鏃ユ湡 - const now = dayjs() - queryParams.params = { - beginReqTime: now.startOf('day').format('YYYY-MM-DD 00:00:00'), - endReqTime: now.endOf('day').format('YYYY-MM-DD 23:59:59'), - } - } else if (filterDate.value === '2') { - const now = dayjs() - queryParams.params = { - beginReqTime: now.startOf('month').format('YYYY-MM-DD 00:00:00'), - endReqTime: now.endOf('month').format('YYYY-MM-DD 23:59:59'), - } - } else { - delete queryParams.params - } + // if (resTypeId.value === -1) { + // delete queryParams.reqType + // } + // if (status.value === -1) { + // delete queryParams.status + // } + // + // if (filterDate.value === '1') { + // // 鑾峰彇褰撳墠鏃ユ湡 + // const now = dayjs() + // queryParams.params = { + // beginReqTime: now.startOf('day').format('YYYY-MM-DD 00:00:00'), + // endReqTime: now.endOf('day').format('YYYY-MM-DD 23:59:59'), + // } + // } else if (filterDate.value === '2') { + // const now = dayjs() + // queryParams.params = { + // beginReqTime: now.startOf('month').format('YYYY-MM-DD 00:00:00'), + // endReqTime: now.endOf('month').format('YYYY-MM-DD 23:59:59'), + // } + // } else { + // delete queryParams.params + // } // 濡傛灉鏄粠鎵爜椤甸潰杩囨潵锛屽彧鑳芥煡璇㈠浐瀹氳澶囩殑鏁版嵁 if (option?.from === 'scan') { queryParams.assetNo = option.assetNo + } + queryParams.params.status = '0,1,2,3' + queryParams.reqUser = userStore?.userInfo?.userId + if (isRepair()) { + queryParams.params.status = null + queryParams.resUser = userStore?.userInfo?.userId + delete queryParams.reqUser + delete queryParams.params } getRepairResList(queryParams) .then((res: any) => { @@ -291,128 +162,128 @@ paging.value.reload() } -/** - * 鏉$洰鐐瑰嚮浜嬩欢 - * @param item - */ -function itemClick(item: any) { - goToDetail(item) -} - -/** - * 寮�濮嬬淮淇� - * @param item - */ -function handleStartRepair(item: any) { - // 纭寮�濮嬩慨鏀圭姸鎬佷负2-缁翠慨涓� - const data = Object.assign({}, item) - // 纭寮�濮嬩慨鏀圭姸鎬佷负2-缁翠慨涓� - data.status = '2' - // 璁剧疆寮�濮嬬淮淇椂闂� - data.startTime = formatDate(new Date()) - message - .confirm({ - msg: '纭畾寮�濮嬬淮淇紵', - title: '鎻愮ず', - beforeConfirm: ({ resolve }) => { - updateRepair(data, resolve) - }, - }) - .then(() => {}) - .catch((error) => { - console.log(error) - }) -} - -/** - * 鏇存柊缁翠慨宸ュ崟 - * @param data - * @param resolve - */ -function updateRepair(data: any, resolve: any) { - updateRepairRes(data) - .then((res: any) => { - resolve(true) - if (res?.code === 200) { - reloadData() - // 缁翠慨涓姸鎬佹墠闇�瑕佽烦杞� - if (data?.status === '2') { - goToDetail(data) - } - } - }) - .catch((res) => { - console.error(res) - }) -} - -function goToDetail(item) { - uni.navigateTo({ - url: `/pages/repair/res-detail?id=${item.id}`, - }) -} - -function goToFeedBack(item) { - uni.navigateTo({ - url: `/pages/repair/repair-fb?id=${item.id}`, - }) -} +// /** +// * 鏉$洰鐐瑰嚮浜嬩欢 +// * @param item +// */ +// function itemClick(item: any) { +// goToDetail(item) +// } +// +// /** +// * 寮�濮嬬淮淇� +// * @param item +// */ +// function handleStartRepair(item: any) { +// // 纭寮�濮嬩慨鏀圭姸鎬佷负2-缁翠慨涓� +// const data = Object.assign({}, item) +// // 纭寮�濮嬩慨鏀圭姸鎬佷负2-缁翠慨涓� +// data.status = '2' +// // 璁剧疆寮�濮嬬淮淇椂闂� +// data.startTime = formatDate(new Date()) +// message +// .confirm({ +// msg: '纭畾寮�濮嬬淮淇紵', +// title: '鎻愮ず', +// beforeConfirm: ({ resolve }) => { +// updateRepair(data, resolve) +// }, +// }) +// .then(() => {}) +// .catch((error) => { +// console.log(error) +// }) +// } +// +// /** +// * 鏇存柊缁翠慨宸ュ崟 +// * @param data +// * @param resolve +// */ +// function updateRepair(data: any, resolve: any) { +// updateRepairRes(data) +// .then((res: any) => { +// resolve(true) +// if (res?.code === 200) { +// reloadData() +// // 缁翠慨涓姸鎬佹墠闇�瑕佽烦杞� +// if (data?.status === '2') { +// goToDetail(data) +// } +// } +// }) +// .catch((res) => { +// console.error(res) +// }) +// } +// +// function goToDetail(item) { +// uni.navigateTo({ +// url: `/pages/repair/res-detail?id=${item.id}`, +// }) +// } +// +// function goToFeedBack(item) { +// uni.navigateTo({ +// url: `/pages/repair/repair-fb?id=${item.id}`, +// }) +// } const goBack = () => { uni.navigateBack() } -function handleClickRight() { - if (isLeader()) { - toast.info('璇风櫥褰曠淮淇伐璐﹀彿鎺ュ崟') - } else if (isOperatorOrRepair()) { - handleSelectReq() - } -} +// function handleClickRight() { +// if (isLineOrRepair()) { +// handleSelectReq() +// } else { +// toast.info('璇风櫥褰曟姤淇伐璐﹀彿鎺ュ崟') +// } +// } - -/** - * 閫夋嫨鎶ヤ慨鍗� - */ -function handleSelectReq() { - uni.navigateTo({ - url: '/pages/repair/req-list', - events: { - // 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹� - selectReq: function (data) { - console.error(data) - // 閫夋嫨鎶ヤ慨鍗曞悗锛屼慨鏀规姤淇崟鐘舵�佸拰鏂板缁翠慨宸ュ崟 - const resCode = `WXD${data.data.code.slice(3)}` - const deptId = userStore?.userInfo?.deptId - const userId = userStore?.userInfo?.userId - const resData = { - reqId: data.data.id, - reqCode: data.data.code, - reqUser: data.data.reqUser, - reqDept: data.data.reqDept, - resCode, - status: '1', - resUser: userId, - resDept: deptId, - } - addRepairRes(resData) - .then((res: any) => { - if (res.code === 200) { - toast.success(res?.msg || '鎿嶄綔鎴愬姛') - reloadData() - } else { - toast.error(res?.msg || '鐢熸垚缁翠慨宸ュ崟澶辫触锛岃閲嶈瘯') - } - }) - .catch((res) => { - toast.error(res?.msg || '鐢熸垚缁翠慨宸ュ崟澶辫触锛岃閲嶈瘯') - }) - }, - }, - success: function (res) { - // 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹� - res.eventChannel.emit('OnSelectReq', { data: '缁翠慨鍗曢〉闈㈤�夋嫨鎶ヤ慨鍗�' }) - }, - }) -} +// +// /** +// * 閫夋嫨鎶ヤ慨鍗� +// */ +// function handleSelectReq() { +// uni.navigateTo({ +// url: '/pages/repair/req-list', +// events: { +// // 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹� +// selectReq: function (data) { +// console.error(data) +// // 閫夋嫨鎶ヤ慨鍗曞悗锛屼慨鏀规姤淇崟鐘舵�佸拰鏂板缁翠慨宸ュ崟 +// const resCode = `WXD${data.data.code.slice(3)}` +// const deptId = userStore?.userInfo?.deptId +// const userId = userStore?.userInfo?.userId +// const resData = { +// reqId: data.data.id, +// reqCode: data.data.code, +// reqUser: data.data.reqUser, +// reqDept: data.data.reqDept, +// resCode, +// status: '1', +// resUser: userId, +// resDept: deptId, +// } +// addRepairRes(resData) +// .then((res: any) => { +// if (res.code === 200) { +// toast.success(res?.msg || '鎿嶄綔鎴愬姛') +// reloadData() +// } else { +// toast.error(res?.msg || '鐢熸垚缁翠慨宸ュ崟澶辫触锛岃閲嶈瘯') +// } +// }) +// .catch((res) => { +// toast.error(res?.msg || '鐢熸垚缁翠慨宸ュ崟澶辫触锛岃閲嶈瘯') +// }) +// }, +// }, +// success: function (res) { +// // 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹� +// res.eventChannel.emit('OnSelectReq', { data: '缁翠慨鍗曢〉闈㈤�夋嫨鎶ヤ慨鍗�' }) +// }, +// }) +// } async function initData() { const rList: any = await getDictInfo(DICT_REPAIR_REQ_TYPE) @@ -423,10 +294,10 @@ onLoad((options) => { Object.assign(option, options) initData() - uni.$on('res-list-refresh', reloadData) + uni.$on('list-refresh', reloadData) }) onUnload(() => { - uni.$off('res-list-refresh', reloadData) + uni.$off('list-refresh', reloadData) }) </script> diff --git a/eims-ui-mobile/src/pages/scan/index.vue b/eims-ui-mobile/src/pages/scan/index.vue index b9ccad5..eecf651 100644 --- a/eims-ui-mobile/src/pages/scan/index.vue +++ b/eims-ui-mobile/src/pages/scan/index.vue @@ -57,10 +57,44 @@ <view class="h-[1px] bg-base"></view> <view class="bg-white flex justify-around py-4"> <wd-button icon="edit-outline" @click.stop="handleInsp">鐐规</wd-button> - <wd-button icon="laptop" @click.stop="handMaint">淇濆吇</wd-button> - <wd-button icon="tools" @click.stop="showActions">缁翠慨</wd-button> + <wd-button icon="laptop" v-if="isRepair() || isLeader()" @click.stop="handMaint"> + 淇濆吇 + </wd-button> + <wd-button icon="laptop" @click.stop="handleRequest">鎶ヤ慨</wd-button> + <!-- <wd-button icon="tools" @click.stop="showActions">缁翠慨</wd-button>--> </view> </view> + <view class="h-[10px] bg-base"></view> + <wd-tabs v-model="tab"> + + <wd-tab title="缁翠慨璇锋眰"> + <view class="h-[10px] bg-base"></view> + <!-- 缁翠慨璇锋眰鍖哄煙 --> + <view class="mt-2" v-if="reqList.length > 0"> + + + <view class="bg-base"> + <req-card + v-for="item in reqList" + :key="item.id" + :item="item" + @click="handleReqClick" + /> + </view> + </view> + </wd-tab> + <wd-tab title="缁翠慨鍗�"> + <view class="h-[10px] bg-base"></view> + <!-- 缁翠慨鍗曞尯鍩� --> + <view class="mt-2" v-if="resList.length > 0"> + + + <view class="bg-base"> + <res-card v-for="item in resList" :key="item.id" :item="item" /> + </view> + </view> + </wd-tab> + </wd-tabs> <wd-action-sheet v-model="show" @@ -79,16 +113,25 @@ <script setup lang="ts"> import dayjs from 'dayjs' import type { EquVO } from '@/service/equ.d' +import type { RepairReqVO, RepairResVO } from '@/service/repair.d' import { useToast, useMessage } from 'wot-design-uni' import { getEquByAssetNo } from '@/service/equ' import { getInspStByStId } from '@/service/inspect' +import { isLeader, isRepair } from '@/utils/RoleUtils' +import { getRepairReqList, getRepairResList } from '@/service/repair' +import ReqCard from '@/components/repair/req-card.vue' +import ResCard from '@/components/repair/res-card.vue' +import { useUserStore } from '@/store' +const tab = ref<number>(0) const message = useMessage() const toast = useToast() const model = reactive<EquVO>({}) - +const userStore = useUserStore() const scanResult = ref<string>('') const show = ref<boolean>(false) const exist = ref<boolean>(false) +const reqList = ref<RepairReqVO[]>([]) +const resList = ref<RepairResVO[]>([]) const actions = ref([ { name: '鏂板鎶ヤ慨', @@ -105,6 +148,8 @@ if (res?.equId) { exist.value = true Object.assign(model, res) + // 鍔犺浇缁翠慨璇锋眰鍜岀淮淇崟鏁版嵁 + loadRepairData(res.equId) } else { toast.error('鏈煡璇㈠埌璇ヨ祫浜х紪鍙风浉鍏虫暟鎹紒') } @@ -114,6 +159,38 @@ toast.error(res?.data?.msg || '璇锋眰澶辫触') }) } + +// 鍔犺浇缁翠慨璇锋眰鍜岀淮淇崟鏁版嵁 +function loadRepairData(equId: string | number) { + // 鍔犺浇鏈帴鍗曠殑缁翠慨璇锋眰 + getRepairReqList({ + equId, + status: '0', + }).then((res: any) => { + if (res?.rows) { + reqList.value = res.rows + } + }) + + // 鍔犺浇鏈畬鎴愮殑缁翠慨鍗� + const params = { + equId, + params: { + status: '0,1,2', + }, + } + // 濡傛灉鏄淮淇伐鍒欏姞杞芥湰瑕佹帴鍗曠殑缁翠慨鍗� + if (isRepair()) { + params.resUser = userStore?.userInfo?.userId + params.params.status = '0,1,2' + } + getRepairResList(params).then((res: any) => { + if (res?.rows) { + resList.value = res.rows + } + }) +} + function handleInfo() { uni.showToast({ title: '鍔熻兘寮�鍙戜腑', @@ -152,6 +229,19 @@ }) } +function handleRequest() { + if (!model?.assetNo) { + uni.showToast({ + title: '鏈煡璇㈠埌璁惧锛岃鑱旂郴绠$悊鍛橈紒', + icon: 'none', + }) + return false + } + uni.navigateTo({ + url: `/pages/repair/repair-add?equId=${model?.equId}&equName=${model?.equName}&from=scan`, + }) +} + function showActions() { show.value = true } @@ -159,6 +249,7 @@ function close() { show.value = false } + function select({ item, index }) { console.error(model?.equId) console.error(!model?.equId) @@ -182,10 +273,29 @@ break } } +;`/pages/repair/req-list`, + // 澶勭悊缁翠慨璇锋眰鐐瑰嚮浜嬩欢 + function handleReqClick(item) { + uni.navigateTo({ + url: `/pages/repair/req-detail?id=${item.id}`, + }) + } + +// // 澶勭悊缁翠慨鍗曠偣鍑讳簨浠� +// function handleResClick(item) { +// uni.navigateTo({ +// url: `/pages/repair/res-detail?id=${item.id}`, +// }) +// } + onLoad((options) => { + uni.$on('list-refresh', loadRepairData) scanResult.value = options?.result initData(options?.result) }) +onUnload(() => { + uni.$off('list-refresh', loadRepairData) +}) </script> <style scoped lang="scss"> diff --git a/eims-ui-mobile/src/types/uni-pages.d.ts b/eims-ui-mobile/src/types/uni-pages.d.ts index d3446bb..68e1709 100644 --- a/eims-ui-mobile/src/types/uni-pages.d.ts +++ b/eims-ui-mobile/src/types/uni-pages.d.ts @@ -18,6 +18,7 @@ "/pages/my/index" | "/pages/repair/repair-add" | "/pages/repair/repair-fb" | + "/pages/repair/req-detail" | "/pages/repair/req-list" | "/pages/repair/res-detail" | "/pages/repair/res-list" | diff --git a/eims-ui-mobile/src/utils/RoleUtils.ts b/eims-ui-mobile/src/utils/RoleUtils.ts index 027a6fb..b111052 100644 --- a/eims-ui-mobile/src/utils/RoleUtils.ts +++ b/eims-ui-mobile/src/utils/RoleUtils.ts @@ -23,12 +23,42 @@ export const ROLE_REPAIR = 'repair' /** + * 璁惧绠$悊鍛� + */ +export const ROLE_EQU_ADMIN = 'equadmin' + +/** * 鐧诲綍瑙掕壊鏄搷浣滃伐鎴栫淮淇伐 */ -export const isOperatorOrRepair = () => { - // const roles = useUserStore()?.userInfo?.roles || [] - // return roles.includes(ROLE_OPERATOR) || roles.includes(ROLE_REPAIR) - return true +export const isLineOrRepair = () => { + const roles = useUserStore()?.userInfo?.roles || [] + return roles.includes(ROLE_LINE) || roles.includes(ROLE_REPAIR) +} + + +export const isOperator = () => { + const roles = useUserStore()?.userInfo?.roles || [] + return roles.includes(ROLE_OPERATOR) +} + +export const isRepair = () => { + const roles = useUserStore()?.userInfo?.roles || [] + return roles.includes(ROLE_REPAIR) +} + +export const isLine = () => { + const roles = useUserStore()?.userInfo?.roles || [] + return roles.includes(ROLE_LINE) +} + +export const isSuperAdmin = () => { + const roles = useUserStore()?.userInfo?.roles || [] + return roles.includes(ROLE_SUPER_ADMIN) +} + +export const isEquAdmin = () => { + const roles = useUserStore()?.userInfo?.roles || [] + return roles.includes(ROLE_EQU_ADMIN) } /** @@ -37,7 +67,7 @@ export const isLeader = () => { const roles = useUserStore()?.userInfo?.roles || [] return ( - roles.includes(ROLE_LINE) || roles.includes(ROLE_SUPER_ADMIN) || roles.includes(ROLE_LEADER) + roles.includes(ROLE_SUPER_ADMIN) || roles.includes(ROLE_EQU_ADMIN) || roles.includes(ROLE_LEADER) ) } @@ -58,4 +88,7 @@ if (roles.includes(ROLE_REPAIR)) { return '缁翠慨宸�' } + if (roles.includes(ROLE_EQU_ADMIN)) { + return '璁惧绠$悊鍛�' + } } diff --git a/eims/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/constant/DictConstants.java b/eims/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/constant/DictConstants.java index e1f3e62..5f28d05 100644 --- a/eims/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/constant/DictConstants.java +++ b/eims/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/constant/DictConstants.java @@ -94,6 +94,11 @@ * 瀹屾垚 */ String WANCHENG = "3"; + + /** + * 璇勪环 + */ + String PINGJIA = "4"; } /** diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsRepairRes.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsRepairRes.java index b1f1899..b2eb041 100644 --- a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsRepairRes.java +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsRepairRes.java @@ -106,5 +106,7 @@ */ private Long fbId; + private String faultType; + } diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsInspectPlanBo.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsInspectPlanBo.java index 6e2d184..3c188d7 100644 --- a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsInspectPlanBo.java +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsInspectPlanBo.java @@ -59,7 +59,7 @@ /** * 鐐规鍛ㄦ湡 */ - @NotNull(message = "鐐规鍛ㄦ湡涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) +// @NotNull(message = "鐐规鍛ㄦ湡涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) private Long inspCycle; /** @@ -75,7 +75,7 @@ /** * 鐐规浜� */ - @NotNull(message = "鐐规浜轰笉鑳戒负绌�", groups = { AddGroup.class, EditGroup.class }) +// @NotNull(message = "鐐规浜轰笉鑳戒负绌�", groups = { AddGroup.class, EditGroup.class }) private Long inspUser; /** @@ -104,7 +104,7 @@ /** * 涓嬫鎵ц鏃堕棿 */ - @NotNull(message = "涓嬫鎵ц鏃堕棿涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) +// @NotNull(message = "涓嬫鎵ц鏃堕棿涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) @JsonFormat(pattern = "yyyy-MM-dd") private Date inspNextTime; diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsRepairReqBo.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsRepairReqBo.java index 2e62264..7ae188b 100644 --- a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsRepairReqBo.java +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsRepairReqBo.java @@ -115,5 +115,7 @@ */ private String remark; + private String statusLt; + } diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsRepairResBo.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsRepairResBo.java index 23d9ed1..c800bf5 100644 --- a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsRepairResBo.java +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsRepairResBo.java @@ -10,6 +10,8 @@ import lombok.EqualsAndHashCode; import jakarta.validation.constraints.*; import java.util.Date; +import java.util.List; + import com.fasterxml.jackson.annotation.JsonFormat; /** @@ -119,6 +121,12 @@ private String assetNo;//璁惧璧勪骇缂栧彿 + private Long equId; + + + private String statusLt; + + private List<EimsSpareBo> spareParts; diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsRepairResVo.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsRepairResVo.java index aec73bf..054655c 100644 --- a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsRepairResVo.java +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsRepairResVo.java @@ -16,7 +16,7 @@ import java.io.Serial; import java.io.Serializable; import java.util.Date; - +import java.util.List; /** @@ -149,6 +149,7 @@ @Translation(type = TransConstant.REPAIR_REQ_ID_TO_CODE, mapper = "reqId") private String reqCode;//鎶ヤ慨缂栫爜 + private List<EimsSpareVo> spareParts; } 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 0f7a628..4578011 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 @@ -256,6 +256,7 @@ qw.eq(bo.getInspUser() != null, "st.maint_user", bo.getInspUser()); qw.eq(bo.getVerifyUser() != null, "st.verify_user", bo.getVerifyUser()); qw.eq(bo.getStatus() != null, "st.status", bo.getStatus()); + qw.eq(bo.getUpdateBy() != null, "st.update_by", bo.getUpdateBy()); qw.orderByDesc( "st.create_time"); return qw; } diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsRepairFbServiceImpl.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsRepairFbServiceImpl.java index de5fb8a..94b53e8 100644 --- a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsRepairFbServiceImpl.java +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsRepairFbServiceImpl.java @@ -1,5 +1,6 @@ package org.dromara.eims.service.impl; +import org.dromara.common.core.constant.DictConstants; import org.dromara.common.core.service.RepairResService; import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.StringUtils; @@ -103,6 +104,7 @@ bo.setId(add.getId()); //鏂板鏃舵洿鏂皉epair_res琛ㄨ瘎浠穒d EimsRepairRes eimsRepairRes = repairResMapper.selectById(bo.getResId()); + eimsRepairRes.setStatus(DictConstants.REPAIR_RES_STATUS_DETAIL.PINGJIA); eimsRepairRes.setFbId(add.getId()); repairResMapper.updateById(eimsRepairRes); } diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsRepairReqServiceImpl.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsRepairReqServiceImpl.java index 4e95350..7f17f4c 100644 --- a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsRepairReqServiceImpl.java +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsRepairReqServiceImpl.java @@ -95,11 +95,13 @@ qw.eq(bo.getRepairUser() != null, "a.repair_user", bo.getRepairUser()); qw.eq(StringUtils.isNotBlank(bo.getFaultType()), "a,fault_type", bo.getFaultType()); qw.in(params.containsKey("createBy"), "a.create_by", (List<Long>) params.get("createBy")); - qw.eq(params.containsKey("status"), "a.status", params.get("status")); + Object status = params.get("status") == null ? "" : params.get("status"); + + String[] split = status.toString().split(","); + qw.in(params.containsKey("status"), "a.status", split); qw.between(params.get("beginReqTime") != null && params.get("endReqTime") != null, "a.req_time", params.get("beginReqTime"), params.get("endReqTime")); - - + qw.ne(StringUtils.isNotBlank(bo.getStatusLt()), "a.status", bo.getStatusLt()); qw.eq(bo.getCreateBy()!=null, "a.create_by", bo.getCreateBy()); qw.eq(StringUtils.isNotEmpty(bo.getStatus()), "a.status", bo.getStatus()); qw.orderByDesc("a.create_time"); diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsRepairResServiceImpl.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsRepairResServiceImpl.java index ffdb5d5..d37a7ba 100644 --- a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsRepairResServiceImpl.java +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsRepairResServiceImpl.java @@ -7,6 +7,7 @@ import org.dromara.common.core.constant.DictConstants; import org.dromara.common.core.domain.model.LoginUser; import org.dromara.common.core.service.RepairResService; +import org.dromara.common.core.utils.DateUtils; import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.SpringUtils; import org.dromara.common.core.utils.StringUtils; @@ -18,10 +19,10 @@ import lombok.RequiredArgsConstructor; import org.dromara.common.satoken.utils.LoginHelper; import org.dromara.eims.domain.*; -import org.dromara.eims.domain.vo.EimsEquVo; -import org.dromara.eims.domain.vo.EimsFixtureVo; -import org.dromara.eims.domain.vo.EimsRepairReqVo; +import org.dromara.eims.domain.bo.EimsSpareInoutBo; +import org.dromara.eims.domain.vo.*; import org.dromara.eims.mapper.*; +import org.dromara.eims.service.IEimsSpareInoutService; import org.dromara.eims.utils.DataFilterUtil; import org.dromara.system.domain.SysDept; import org.dromara.system.domain.vo.SysDeptVo; @@ -29,7 +30,6 @@ import org.redisson.misc.LogHelper; import org.springframework.stereotype.Service; import org.dromara.eims.domain.bo.EimsRepairResBo; -import org.dromara.eims.domain.vo.EimsRepairResVo; import org.dromara.eims.service.IEimsRepairResService; import org.springframework.transaction.annotation.Transactional; @@ -51,6 +51,7 @@ private final EimsRepairRecordMapper recordMapper; private final EimsEquMapper equMapper; private final EimsFixtureMapper fixtureMapper; + private final IEimsSpareInoutService spareInoutService; /** * 鏌ヨ缁翠慨宸ュ崟 @@ -66,6 +67,7 @@ EimsRepairReqVo reqVo = reqMapper.selectVoById(reqId); resVo.setReqType(reqVo.getReqType()); resVo.setReqCode(reqVo.getCode()); + resVo.setReqDesc(reqVo.getReqDesc()); if(reqVo.getEquId()!=null){ EimsEquVo equVo = equMapper.selectVoById(reqVo.getEquId()); @@ -83,9 +85,25 @@ } } + resVo.setSpareParts(querySpareParts(resVo.getResCode())); } return resVo; + } + + + public List<EimsSpareVo> querySpareParts(String code) { + // 鏌ヨ鍏宠仈鐨勫浠讹紝鍏崇郴濡備笅锛氬浠跺嚭鍏ュ簱鍗曠殑associatedOrder 鍏宠仈浼犲叆鐨刢ode,澶囦欢鍑哄叆搴撴槑缁嗛�氳繃鍑哄叆搴撳崟鐨刬d鍏宠仈锛屽浠跺悕绉伴�氳繃鍑哄叆搴撴槑缁嗕腑鐨剆pareId鍏宠仈 + + EimsSpareInoutBo bo = new EimsSpareInoutBo(); + bo.setAssociatedOrder(code); + List<EimsSpareInoutVo> list = spareInoutService.queryList(bo); + if (!list.isEmpty()) { + // 鏌ヨ澶囦欢鏄庣粏鍜屽悕绉� + EimsSpareInoutVo eimsSpareInoutVo = spareInoutService.queryById(list.get(0).getId()); + return eimsSpareInoutVo.getSpareList(); + } + return List.of(); } /** @@ -261,6 +279,23 @@ recordMapper.insert(record); } validEntityBeforeSave(update); + // 鍒ゆ柇澶囦欢鍒楄〃鏄惁涓虹┖锛屼笉涓虹┖鍒欐柊澧炰竴涓浠跺嚭搴撳崟锛屽悓鏃跺鍔犲嚭搴撴槑缁� + if (bo.getSpareParts() != null && bo.getSpareParts().size() > 0) { + EimsSpareInoutBo spareInoutBo = new EimsSpareInoutBo(); + // 鏍规嵁鏃ユ湡鐢熸垚鍗曞彿锛屾牸寮忎负CK+鏃ユ湡+娴佹按鍙� + spareInoutBo.setOrderCode("CK"+ DateUtils.dateTimeNow("yyyyMMddHHmmss")); + spareInoutBo.setOrderTime(new Date()); + spareInoutBo.setType(DictConstants.SPARE_INOUT_TYPE_DETAIL.CK); + spareInoutBo.setPartnerName(loginUser.getNickname()); + spareInoutBo.setSpareList(bo.getSpareParts()); + spareInoutBo.setChargeUser(loginUser.getUserId()); + spareInoutBo.setChargeDept(loginUser.getDeptId()); + spareInoutBo.setAssociatedOrder(bo.getResCode()); + // 淇濆瓨杩涙暟鎹簱 + Boolean b = spareInoutService.insertByBo(spareInoutBo); + + + } return baseMapper.updateById(update) > 0; } @@ -302,6 +337,7 @@ qw.eq(bo.getReqType() != null, "req.req_type", bo.getReqType()); qw.eq(bo.getReqUser() != null, "res.req_user", bo.getReqUser()); qw.eq(bo.getAssetNo() != null, "equ.asset_no", bo.getAssetNo()); + qw.eq(bo.getEquId() != null, "req.equ_id", bo.getEquId()); qw.between(params.get("beginReqTime") != null && params.get("endReqTime") != null, "req.req_time", params.get("beginReqTime"), params.get("endReqTime")); @@ -314,6 +350,9 @@ qw.eq(StringUtils.isNotBlank(bo.getStatus()), "res.status", bo.getStatus()); + String s = params.get("status") == null ? "" : params.get("status").toString(); + String[] status = s.split(","); + qw.in(params.get("status") != null, "res.status", status); qw.orderByDesc("res.create_time"); return qw; } -- Gitblit v1.9.3