eims-ui-mobile/env/.env
@@ -7,8 +7,7 @@ # h5é¨ç½²ç½ç«çbaseï¼é ç½®å° manifest.config.ts éç h5.router.base VITE_APP_PUBLIC_BASE=/ VITE_SERVER_BASEURL = 'http://lanpucloud.cn:8091' VITE_UPLOAD_BASEURL = 'http://lanpucloud.cn:8091/resource/oss/upload' # æäºåå¦å¯è½éè¦å¨å¾®ä¿¡å°ç¨åºé颿 ¹æ® developãtrialãrelease åå«è®¾ç½®ä¸ä¼ å°åï¼åè代ç å¦ä¸ã # ä¸é¢çåéå¦ææ²¡æè®¾ç½®ï¼ä¼é»è®¤ä½¿ç¨ VITE_SERVER_BASEURL or VITE_UPLOAD_BASEURL eims-ui-mobile/env/.env.development
@@ -4,3 +4,5 @@ VITE_DELETE_CONSOLE = false # æ¯å¦å¼å¯sourcemap VITE_SHOW_SOURCEMAP = true VITE_SERVER_BASEURL = 'http://192.168.21.236:8080' VITE_UPLOAD_BASEURL = 'http://192.168.21.236:8080/resource/oss/upload' eims-ui-mobile/env/.env.production
@@ -4,3 +4,5 @@ VITE_DELETE_CONSOLE = true # æ¯å¦å¼å¯sourcemap VITE_SHOW_SOURCEMAP = false VITE_SERVER_BASEURL = 'http://lanpucloud.cn:8091' VITE_UPLOAD_BASEURL = 'http://lanpucloud.cn:8091/resource/oss/upload' eims-ui-mobile/package.json
@@ -110,7 +110,7 @@ "qs": "6.5.3", "vue": "3.4.21", "vue-i18n": "^9.1.9", "wot-design-uni": "^1.4.0", "wot-design-uni": "^1.9.1", "z-paging": "^2.8.4" }, "devDependencies": { eims-ui-mobile/src/pages/equ/equ-list.vue
@@ -39,7 +39,7 @@ <view class="flex justify-between items-baseline"> <view class="flex items-center menu-title-box"> <view class="menu-indicator"></view> <text class="ml-1 text-xs">{{ item.assetNo }}</text> <text class="ml-1 text-sm">{{ item.assetNo }}</text> <wd-tag v-if="item.status === '0'" class="ml-2" bg-color="cyan">è¯ç¨</wd-tag> <wd-tag v-else-if="item.status === '1'" class="ml-2" type="success">使ç¨</wd-tag> <wd-tag v-else-if="item.status === '2'" class="ml-2" type="danger">åç¨</wd-tag> @@ -61,7 +61,7 @@ {{ item.equName }} <text class="text-color-gray ml-2 text-mini">{{ item.modelNo }}</text> </view> <view class="text-color-gray text-xs mt-1"> <view class="text-color-gray text-sm mt-1"> {{ item.location }} | {{ item.madeIn }} </view> </view> eims-ui-mobile/src/pages/fixture/fixture-list.vue
@@ -22,7 +22,7 @@ <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-xs">{{ item.fixtureName }}</text> <text class="ml-1 text-sm">{{ item.fixtureName }}</text> <text class="ml-1 text-mini text-color-gray">{{ item.assetNo }}</text> </view> @@ -40,7 +40,7 @@ <text class="text-color-gray ml-2 text-mini">è§æ ¼: {{ item.specNo }}</text> <text class="text-color-gray ml-2 text-mini">åå·: {{ item.modelNo }}</text> </view> <view class="text-color-gray text-xs mt-1 flex"> <view class="text-color-gray text-sm mt-1 flex"> <template v-if="!item.borrowStatus || item.borrowStatus === '0'" > eims-ui-mobile/src/pages/home/index.vue
@@ -61,7 +61,7 @@ <template #title> <view class="flex items-center menu-title-box"> <view class="menu-indicator"></view> <view class="ml-1 text-xs">æ°æ®æ»è§</view> <view class="ml-1 text-sm">æ°æ®æ»è§</view> </view> </template> <view class="flex flex-row justify-around"> @@ -85,7 +85,7 @@ <template #title> <view class="flex items-center menu-title-box"> <view class="menu-indicator"></view> <view class="ml-1 text-xs">å¿«æ·æä½</view> <view class="ml-1 text-sm">å¿«æ·æä½</view> </view> </template> <wd-grid :column="4"> @@ -108,7 +108,7 @@ <template #title> <view class="flex items-center menu-title-box"> <view class="menu-indicator"></view> <view class="ml-1 text-xs">设å¤ç®¡ç</view> <view class="ml-1 text-sm">设å¤ç®¡ç</view> </view> </template> <wd-grid :column="4"> @@ -130,7 +130,7 @@ <template #title> <view class="flex items-center menu-title-box"> <view class="menu-indicator"></view> <view class="ml-1 text-xs">å°è´¦ç¸å ³</view> <view class="ml-1 text-sm">å°è´¦ç¸å ³</view> </view> </template> <wd-grid :column="4"> eims-ui-mobile/src/pages/inspect/insp-record.vue
@@ -6,7 +6,13 @@ } </route> <template> <z-paging ref="paging" v-model="dataList" :auto="false" @query="queryList" show-refresher-update-time> <z-paging ref="paging" v-model="dataList" :auto="false" @query="queryList" show-refresher-update-time > <template #top> <wd-navbar title="ç¹æ£è®°å½" @@ -24,10 +30,13 @@ <wd-card type="rectangle"> <template #title> <view class="flex justify-between"> <view class="flex items-center menu-title-box"> <view class="flex items-center menu-title-box center" style="align-content: center; flex-wrap: wrap" > <view class="menu-indicator"></view> <view class="ml-1 text-sm align-center">{{ inspSt.equName }}</view> <view class="text-color-gray ml-2 text-mini">{{ inspSt.assetNo }}</view> <view class="ml-1 text-lg align-center">{{ inspSt.equName }}</view> <view class="text-color-gray ml-2 text-sm">{{ inspSt.assetNo }}</view> </view> <view class="flex items-center"> @@ -38,19 +47,19 @@ <view class="flex h-[140rpx]" items-center> <image class="slot-img text-center" src="/static/images/camera.png" /> <view class="flex-1"> <view class="text-color-gray text-xs mt-1 flex"> <view class="text-color-gray text-sm mt-1 flex"> <text class="mr-3">ç¹æ£æ»æ°: {{ dataCount }}</text> | <text class="mx-3">å·²ç¹æ£: {{ checkCount }}</text> | <text class="ml-3">æªç¹æ£: {{ dataCount - checkCount }}</text> </view> <view class="text-color-gray text-xs mt-2 flex"> <view class="text-color-gray text-sm mt-2 flex"> <text class="mr-3">æ£å¸¸: {{ normalNum }}</text> | <text class="mx-3">å¼å¸¸: {{ abNormalNum }}</text> </view> <view class="text-color-gray text-xs mt-2 flex"> <view class="text-color-gray text-sm mt-2 flex"> <text>ç¶æï¼</text> <template v-if="dataCount > 0 && dataCount === checkCount"> <wd-icon class="icon-color-success" name="check-outline" size="34rpx"></wd-icon> @@ -61,7 +70,7 @@ <text class="ml-1">è¿è¡ä¸</text> </template> </view> <view class="text-color-gray text-xs mt-2 flex">å建æ¶é´: {{ inspSt.createTime }}</view> <view class="text-color-gray text-sm mt-2 flex">å建æ¶é´: {{ inspSt.createTime }}</view> </view> </view> </wd-card> @@ -71,18 +80,23 @@ <view class="w-full h-[24rpx]"></view> <wd-cell> <template #title> <text class="text-color-gray">ç¹æ£é¡¹</text> <text class="text-color-gray text-sm">ç¹æ£é¡¹</text> </template> <wd-button size="small" type="text" @click.stop="toggleCollapse"> {{ isAllExpanded ? 'å ¨é¨æå ' : 'å ¨é¨å±å¼' }} </wd-button> <!-- <wd-button size="small" type="text" @click.stop="toggleCollapse">--> <!-- {{ isAllExpanded ? 'å ¨é¨æå ' : 'å ¨é¨å±å¼' }}--> <!-- </wd-button>--> </wd-cell> <wd-collapse v-model="collSelects" title="ç¹æ£é¡¹" ref="collapseRef"> <wd-collapse-item :name="item.id" v-for="(item, index) in dataList" disabled> <wd-collapse v-model="collSelects" title="ç¹æ£é¡¹" ref="collapseRef" accordion> <wd-collapse-item :name="item.id" v-for="(item, index) in dataList" :key="item.id" :class="getItemClass(item)" > <template #title="{ expanded, disabled, isFirst }"> <view class="flex justify-between"> <view class="flex justify-center items-center" style="max-width: 60%;"> <text class="text-sm" >{{ item.inspName }}</text> <view class="flex justify-center items-center" style="max-width: 60%"> <text class="text-sm">{{ item.inspName }}</text> </view> <view class="flex items-center"> @@ -105,18 +119,27 @@ </view> </view> </template> <view class="text-color-gray text-xs flex justify-between"> <view v-if="item.showDesc" class="mt-2"> <wd-input v-model="item.inspDesc" placeholder="请è¾å ¥å¼å¸¸æè¿°" clearable :maxlength="200" /> </view> <view class="text-color-gray text-sm flex justify-between"> <text class="mr-3">ç¹æ£äºº: {{ item.inspUserName }}</text> <text class="mx-3">ç¹æ£æ¶é´: {{ item.inspTime }}</text> </view> </wd-collapse-item> </wd-collapse> <view class="w-full h-[24rpx]"></view> <wd-cell> <template #title> <text class="text-color-gray">å ¶ä»</text> </template> </wd-cell> <!-- <view class="w-full h-[24rpx]"></view>--> <!-- <wd-cell>--> <!--<!– <template #title>–>--> <!--<!– <text class="text-color-gray">å ¶ä»</text>–>--> <!--<!– </template>–>--> <!-- </wd-cell>--> <view class="w-full h-[1px] bg-base"></view> <wd-input label="è¿è¡æ¶é´" @@ -125,6 +148,7 @@ v-model="inspSt.runTimes" placeholder="请è¾å ¥è¿è¡æ¶é´(h)" inputmode="numeric" size="large" /> <wd-input label="æ éæ¶é´" @@ -133,6 +157,7 @@ v-model="inspSt.faultTimes" placeholder="请è¾å ¥æ éæ¶é´(h)" inputmode="numeric" size="large" /> <wd-textarea label="ç¹è®°äºé¡¹" @@ -144,13 +169,17 @@ show-word-limit placeholder="请è¾å ¥ç¹è®°äºé¡¹" clearable size="large" /> <!-- æ°å¢æäº¤æé® --> <view class="flex justify-center mt-4"> <wd-button type="primary" block size="large" @click="handleClickRight">æäº¤</wd-button> </view> </view> </z-paging> </template> <script setup lang="ts"> import { ref } from 'vue' import { useUserStore, useAccessStore, useSystemConfigStore } from '@/store' import { isLeader, isOperatorOrRepair } from '@/utils/RoleUtils' import { @@ -194,7 +223,8 @@ const userStore = useUserStore() const collSelects = ref<string[]>([]) const collSelects = ref('') const selectedItems = ref([]) // ç¹æ£æ±æ»æ°æ®(ä¸ä¸ªé¡µé¢ä¼ å¼) const inspSt = reactive<InspSt>({ @@ -237,7 +267,19 @@ } function inspResultClick(item: any) { // userStore?.userInfo?.userId console.log('inspResultClick', userStore.userInfo) // èªå¨å¡«å ç¹æ£äººåæ¶é´ item.inspUserName = userStore?.userInfo?.realName || '' // ä¿®æ¹æ¶é´æ ¼å¼ä¸º YYYY-MM-DD HH:mm:ss const now = new Date() item.inspTime = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')} ${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}:${String(now.getSeconds()).padStart(2, '0')}` if (item.inspResult === '2') { item.showDesc = true } else { item.showDesc = false item.inspDesc = '' } } const goBack = () => { @@ -245,10 +287,9 @@ } function handleClickRight() { if(isOperatorOrRepair()){ if (isOperatorOrRepair()) { handleConfirm() } } const toggleCollapse = () => { @@ -257,10 +298,31 @@ } function handleConfirm() { console.log('handleConfirm') if (!dataChange.value) { message.alert('请æä½åæäº¤!') return false } // æ£æ¥æ¯å¦æå¼å¸¸é¡¹æªå¡«åæè¿° const invalidItems = dataList.value.filter( (item) => item.inspResult === '2' && !item.inspDesc?.trim(), ) if (invalidItems.length > 0) { message.alert('è¯·å¡«åææå¼å¸¸é¡¹çå¼å¸¸æè¿°!') return false } // è¿æ»¤åºå·²éæ©çé¡¹ç® selectedItems.value = dataList.value.filter( (item) => item.inspResult === '1' || item.inspResult === '2', ) if (selectedItems.value.length === 0) { message.alert('请è³å°éæ©ä¸ä¸ªç¹æ£é¡¹!') return false } message .confirm({ msg: 'ç¡®å®æäº¤ï¼', @@ -278,8 +340,9 @@ } function updateData(resolve: any) { console.log('updateData', selectedItems.value) const params = { inspRecordList: dataList.value, inspRecordList: selectedItems.value, } // æ´æ°ç¹æ£è®°å½ updateInspRecordBatch(params) @@ -313,8 +376,17 @@ */ function itemClick(item: any) {} function getItemClass(item: any) { if (item.inspResult === '1') { return 'status-normal' } else if (item.inspResult === '2') { return 'status-abnormal' } return '' } watch( () => [...dataList.value], // ä½¿ç¨æ©å±è¿ç®ç¬¦åå»ºæ°æ°ç»ä»¥è§¦åçå¬ () => [...dataList.value, inspSt], // ä½¿ç¨æ©å±è¿ç®ç¬¦åå»ºæ°æ°ç»ä»¥è§¦åçå¬ (newVal, oldVal) => { if (oldVal.length > 0) { dataChange.value = true @@ -375,7 +447,7 @@ margin-right: 24rpx; } .text-mini { font-size: 22rpx; font-size: 24rpx; } .menu-indicator { @@ -394,13 +466,26 @@ background: $uni-color-primary; } :deep(.wd-navbar__text) { font-size: 26rpx; font-size: 28rpx; color: white; } :deep(.wd-icon-arrow-left:before), :deep(.wd-navbar__title) { color: white; font-weight: 0; font-size: 32rpx; font-size: 34rpx; } // æ°å¢æ ·å¼ï¼ç¹æ£é¡¹èæ¯è² .status-normal { background-color: #e6f7ff; // æ£å¸¸ç¶æèæ¯è²ï¼ç»¿è²ï¼ } .status-abnormal { background-color: #fffbe6; // å¼å¸¸ç¶æèæ¯è²ï¼é»è²ï¼ } :deep(.wd-radio-group) { // æ¹ä¸ºæ èæ¯è² background-color: transparent; } </style> eims-ui-mobile/src/pages/inspect/insp-st.vue
@@ -43,19 +43,19 @@ <view class="flex h-[140rpx]" items-center> <image class="slot-img text-center" src="/static/images/camera.png" /> <view class="flex-1"> <view class="text-color-gray text-xs mt-1 flex"> <text class="mr-3">ç¹æ£æ»æ°: {{ item.recordCount }}</text> <view class="text-color-gray text-sm mt-1 flex"> <text class="mr-3">æ»æ°: {{ item.recordCount }}</text> | <text class="mx-3">å·²ç¹æ£: {{ item.checkCount }}</text> | <text class="ml-3">æªç¹æ£: {{ item.unCheckCount }}</text> </view> <view class="text-color-gray text-xs mt-2 flex"> <view class="text-color-gray text-sm mt-2 flex"> <text class="mr-3">æ£å¸¸: {{ item.normalNum }}</text> | <text class="mx-3">å¼å¸¸: {{ item.abNormalNum }}</text> </view> <view class="text-color-gray text-xs mt-2 flex"> <view class="text-color-gray text-sm mt-2 flex"> <text>ç¶æï¼</text> <template v-if="item.recordCount === item.checkCount"> <wd-icon class="icon-color-success" name="check-outline" size="34rpx"></wd-icon> @@ -66,7 +66,7 @@ <text class="ml-1">è¿è¡ä¸</text> </template> </view> <view class="text-color-gray text-xs mt-2 flex">å建æ¶é´: {{ item.createTime }}</view> <view class="text-color-gray text-sm mt-2 flex">å建æ¶é´: {{ item.createTime }}</view> </view> <wd-button size="small" icon="edit-outline" @click.stop="itemClick(item)">æç»</wd-button> </view> @@ -164,7 +164,7 @@ height: 40rpx; } .text-mini { font-size: 22rpx; font-size: 24rpx; } .menu-indicator { eims-ui-mobile/src/pages/maint/maint-order.vue
@@ -39,31 +39,31 @@ <view class="flex justify-between"> <view class="flex items-center menu-title-box"> <view class="menu-indicator"></view> <view class="ml-1 text-sm align-center">{{ maintSt.equName }}</view> <view class="text-color-gray ml-2 text-mini">{{ maintSt.assetNo }}</view> <view class="ml-1 text-lg align-center">{{ maintSt.equName }}</view> <view class="text-color-gray ml-2 text-sm">{{ maintSt.assetNo }}</view> </view> <view class="flex items-center"> <text class="text-color-gray text-mini">{{ maintSt.planTime }}</text> <text class="text-color-gray text-sm">{{ maintSt.planTime }}</text> </view> </view> </template> <view class="flex h-[140rpx]" items-center> <image class="slot-img text-center" src="/static/images/camera.png" /> <view class="flex-1"> <view class="text-color-gray text-xs mt-1 flex"> <view class="text-color-gray text-sm mt-1 flex"> <text class="mr-3">工忻æ°: {{ maintSt.orderCount }}</text> | <text class="mx-3">已宿: {{ maintSt.wcCount }}</text> </view> <view class="text-color-gray text-xs mt-2 flex"> <view class="text-color-gray text-sm mt-2 flex"> <text class="mr-3">å¾ ä¿å »: {{ maintSt.dbyCount }}</text> | <text class="mx-3">ä¿å »ä¸: {{ maintSt.byCount }}</text> | <text class="ml-3">å¾ éªè¯: {{ maintSt.dyzCount }}</text> </view> <view class="text-color-gray text-xs mt-2 flex"> <view class="text-color-gray text-sm mt-2 flex"> <text>ç¶æï¼</text> <template v-if="maintSt.status === '1'"> <wd-icon class="icon-color-success" name="check-outline" size="34rpx"></wd-icon> @@ -75,7 +75,7 @@ </template> </view> <view class="text-color-gray text-xs mt-2 flex"> <view class="text-color-gray text-sm mt-2 flex"> å建æ¶é´: {{ maintSt.createTime }} </view> </view> @@ -87,145 +87,118 @@ <view class="w-full h-[24rpx]"></view> <wd-cell class="mb-[2px]"> <template #title> <text class="text-color-gray">ä¿å »é¡¹</text> <text class="text-color-gray text-sm">ä¿å »é¡¹</text> </template> </wd-cell> <wd-card type="rectangle" v-for="(item, index) in dataList" :key="item.id"> <wd-card type="rectangle" v-for="(item, index) in dataList" :key="item.id" :class="['status-' + item.maintFun]"> <template #title> <view class="flex justify-between"> <view class="flex items-center menu-title-box"> <view class="menu-indicator"></view> <view class="ml-1 text-sm align-center"> <wd-text :text="item.maintName" :lines="1"></wd-text> </view> <view class="flex items-center"> <view class="menu-indicator"></view> <view class="ml-1 text-sm align-center"> <wd-text color="black" :text="item.maintName"></wd-text> </view> <view class="flex items-center w-[20%] justify-end"> <text class="text-color-gray text-mini"> {{ item?.planTime }} </text> <!-- æ°å¢ç¶ææ¾ç¤ºï¼ç»å®ç¹å»äºä»¶ --> <view v-if="item.status === '2'" class="ml-auto text-sm" style="width: 60px; text-align: end" :style="{ color: getStatusColor(item.maintFun) }" @click.stop="handleUndoAction(item)" > {{ getStatusText(item.maintFun) }} </view> </view> </template> <view class="flex h-[200rpx]" items-center> <image class="slot-img text-center" src="/static/ico/ico-platform.png" /> <view class="flex-1 text-color-gray text-xs flex-row"> <view class="mr-3 mt-2">ä¿å »åå·: {{ item.maintCode }}</view> <view class="mr-3 mt-2">计åä¿å »æ¥æ: {{ item.planTime }}</view> <view class="mr-3 mt-2">ä¿å »å¼å§æ¶é´: {{ item.startTime }}</view> <view class="mr-3 mt-2">ä¿å »ç»ææ¶é´: {{ item.endTime }}</view> <view class="text-color-gray text-xs mt-2 flex"> <text>ç¶æï¼</text> <template v-if="item.status === '0'"> <wd-icon class="icon-color-warning" name="books" size="34rpx"></wd-icon> <text class="ml-1">å¾ ä¿å »</text> </template> <template v-else-if="item.status === '1'"> <wd-icon class="icon-color-base" name="books" size="34rpx"></wd-icon> <text class="ml-1">ä¿å »ä¸</text> </template> <template v-else-if="item.status === '2'"> <wd-icon class="icon-color-purple" name="books" size="34rpx"></wd-icon> <text class="ml-1">å¾ éªè¯</text> </template> <template v-else-if="item.status === '3'"> <wd-icon class="icon-color-success" name="check-outline" size="34rpx"></wd-icon> <text class="ml-1">已宿</text> </template> <text class="mx-3">|</text> <wd-icon class="icon-color-base" name="camera" size="30rpx"></wd-icon> <text class="ml-1">{{ item.maintUserName }}</text> <!-- æé®åºå --> <view v-if="item.maintFun == null" class="flex justify-around mt-2"> <wd-button type="primary" size="small" class="mr-2" @click.stop="handleAction(item, '0')" > æ£æ¥ </wd-button> <wd-button type="success" size="small" class="mr-2" @click.stop="handleAction(item, '1')" > ä¿å » </wd-button> <wd-button type="warning" size="small" @click.stop="handleAction(item, '2')"> ç»´ä¿® </wd-button> </view> <!-- æ£æåºå --> <view v-else class="mt-2"> <!-- ä¿å »è¯´æåºå --> <view v-if="item.maintFun === '1'" class="mt-2"> <wd-input v-model="item.maintDesc" placeholder="请è¾å ¥ä¿å »è¯´æ" clearable :maxlength="200" /> </view> <!-- 维修说æåºå --> <view v-if="item.maintFun === '2'" class="mt-2"> <wd-input v-model="item.repairDesc" placeholder="请è¾å ¥ç»´ä¿®è¯´æ" clearable :maxlength="200" /> </view> <!-- å¤ä»¶ä¿¡æ¯å½å ¥åºå --> <view v-if="item.spareParts && item.spareParts.length > 0" class="mt-2"> <view v-for="(part, partIndex) in item.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> <!--æä½å·¥æç»´ä¿®å·¥è§è²--> <template v-if="isOperatorOrRepair()"> <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> <!-- 维修说æåºå --> <view v-if="item.maintFun === '2'" class="mt-2"> <wd-button type="info" size="small" @click.stop="addSparePart(item, index)"> æ·»å å¤ä»¶ </wd-button> </view> <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" icon="edit-outline" @click.stop="itemClick(item)" > ä¿å »ä¸ </wd-button> <wd-button v-if="item.status === '2'" size="small" icon="edit-outline" @click.stop="itemClick(item)" > å¾ éªè¯ </wd-button> <wd-button v-if="item.status === '3'" size="small" icon="check-outline" @click.stop="itemClick(item)" > 已宿 </wd-button> </template> <!--管çåè§è²--> <template v-else-if="isLeader()"> <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> <wd-button v-if="item.status === '2'" size="small" icon="edit-outline" @click.stop="itemClick(item)" > å¾ éªè¯ </wd-button> <wd-button v-if="item.status === '3'" size="small" icon="check-outline" @click.stop="itemClick(item)" > 已宿 </wd-button> </template> <!-- ä¿å »äººåä¿å »æ¶é´åºå --> <view class="flex justify-between mt-2"> <text>ä¿å »äºº: {{ item.maintUserName }}</text> <text>ä¿å »æ¶é´: {{ item.endTime }}</text> </view> </view> </wd-card> <wd-cell> <template #title> <text class="text-color-gray">å ¶ä»ä¿¡æ¯</text> </template> </wd-cell> <view class="h-[2px] w-full bg-base"></view> <wd-textarea label="ç¹è®°äºé¡¹" label-width="200rpx" type="textarea" v-model="maintSt.specialNote" v-model="specialNote" auto-height :maxlength="200" show-word-limit @@ -233,22 +206,63 @@ clearable /> </view> <!-- æ°å¢æäº¤æé® --> <view class="flex justify-center mt-4"> <wd-button type="primary" block size="large" @click="handleClickRight">æäº¤</wd-button> </view> </z-paging> <!-- å¤ä»¶éæ©å¼¹åºå± --> <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 type { MaintStVO } from '@/service/maint.d' import { getMaintSt, getMaintStOrderList, updateMaintOrder, updateMaintSt } from '@/service/maint' 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 { formatDate } from '@/utils/DateUtils' import { useUserStore } from "@/store"; import { getSpareList } from '@/service/spare' const message = useMessage() const toast = useToast() const userStore = useUserStore() const paging = ref(null) const dataList = ref([]) const maintStId = ref('') const showSparePopup = ref(false) const selectedPartIndex = ref(-1) const sparePartsList = ref([]) const searchKeyword = ref('') const dataChange = ref(false) const specialNote = ref('') interface QueryParams { pageNum: number pageSize: number @@ -272,7 +286,7 @@ const queryList = (pageNum?: number, pageSize?: number) => { const params: QueryParams = { pageNum, pageSize, pageSize: 30, maintCode: maintCode.value, } getMaintStOrderList(params) @@ -307,6 +321,65 @@ uni.navigateTo({ url: `/pages/maint/order-detail?id=${item.id}`, }) } // å¤ä»¶éæ©ç¸å ³é»è¾ function addSparePart(item: any, index: number) { if (!item.spareParts) { item.spareParts = [] } selectedPartIndex.value = index // item.spareParts.push({ name: '', quantity: '' }) selectSparePart(item) } function selectSparePart(item: any) { showSparePopup.value = true loadSpareParts() } function loadSpareParts(value?: string) { getSpareList({ name: value }).then((res: any) => { sparePartsList.value = res.rows }) } function filterSpareParts() { if (!searchKeyword.value) { loadSpareParts() } else { loadSpareParts(searchKeyword.value) } } function selectFilteredSparePart(part: any) { dataList.value[selectedPartIndex.value].spareParts.push({ id: part.id, name: part.name, quantity: '', }) closeSparePopup() } function closeSparePopup() { showSparePopup.value = false selectedPartIndex.value = -1 searchKeyword.value = '' } function confirmSpareSelection() { closeSparePopup() } function addOtherSparePart() { dataList.value[selectedPartIndex.value].spareParts.push({ id: '', name: '', quantity: '', }) closeSparePopup(); } /** @@ -380,19 +453,36 @@ } function handleUpdateMaintSt() { if (maintSt.orderCount !== maintSt.wcCount) { toast.info('请å 宿ææä¿å »é¡¹ï¼') // if (maintSt.orderCount !== maintSt.wcCount) { // toast.info('请å 宿ææä¿å »é¡¹ï¼') // return false // } // å 夿ä¿å »é¡¹æ¯å¦ææ´æ¹ console.log('handleUPdateMaintst', dataChange.value) if (!dataChange.value) { message.alert('请æä½åæäº¤!') return false } // è¿æ»¤æ maintFun为空çä¿å »é¡¹ const submitList = dataList.value.filter((item) => item.maintFun != null) // 妿maintFun为1çå夿ä¿å »è¯´æä¸è½ä¸ºç©ºï¼å¦æä¸º2åå¤æç»´ä¿®è¯´æä¸è½ä¸ºç©º if (submitList.some((item) => item.maintFun === '1' && !item.maintDesc)) { toast.info('请填åä¿å »è¯´æï¼') return false } else if (submitList.some((item) => item.maintFun === '2' && !item.repairDesc)) { toast.info('请填å维修说æï¼') return false } const data: any = Object.assign( {}, { id: maintSt.id, orderCount: maintSt.orderCount, wcCount: maintSt.wcCount, wcCount: submitList.length, status: maintSt.status, specialNote: maintSt.specialNote, specialNote: specialNote.value, }, ) if (data.orderCount === data.wcCount) { @@ -403,6 +493,7 @@ msg: 'ç¡®å®æ´æ°å·¥åæ±æ»æ°æ®ï¼', title: 'æç¤º', beforeConfirm: ({ resolve }) => { updateMaintOrderBatch({maintOrderList:submitList}) updateMaintSt(data) .then((res: any) => { resolve(true) @@ -457,6 +548,90 @@ maintStId.value = options.id reloadData() }) watch( () => [...dataList.value, specialNote.value ], // ä½¿ç¨æ©å±è¿ç®ç¬¦åå»ºæ°æ°ç»ä»¥è§¦åçå¬ (newVal, oldVal) => { if (oldVal.length > 0) { console.log('dataChange',oldVal, newVal) dataChange.value = true } }, { deep: true }, ) /** * å¤çæé®ç¹å»äºä»¶ * @param item ä¿å »é¡¹ * @param action æä½ç±»åï¼check/check/maintain/repairï¼ */ function handleAction(item: any, action: number) { // 设置å½åéä¸çæä½ç±»å item.maintFun = action item.status = '2' // èªå¨å¡«å ä¿å »äººåæ¶é´ item.maintUserName = userStore?.userInfo?.realName || '' const now = new Date() item.endTime = `${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')}`; console.log('handleAction', item) } /** * æ¤éä¿å »æä½ * @param item ä¿å »é¡¹ */ function handleUndoAction(item: any) { message .confirm({ msg: 'ç¡®å®æ¤éå½åæä½ï¼', title: 'æç¤º', beforeConfirm: ({ resolve }) => { // éç½®ç¶æåç¸å ³å段 item.maintFun = null; item.status = '0'; item.maintDesc = ''; item.repairDesc = ''; item.spareParts = []; item.maintUserName = ''; item.endTime = ''; resolve(true); }, }) .then(() => { toast.success('æä½å·²æ¤é'); dataChange.value = true; }) .catch((error) => { console.log(error); }); } // æ°å¢æ¹æ³ï¼è·åç¶æææ¬ function getStatusText(maintFun: string): string { switch (maintFun) { case '0': return 'å·²æ£æ¥'; case '1': return 'å·²ä¿å »'; case '2': return '已维修'; default: return ''; } } // æ°å¢æ¹æ³ï¼è·åç¶æé¢è² function getStatusColor(maintFun: string): string { switch (maintFun) { case '0': return '#007bff'; // æ£æ¥æé®é¢è² case '1': return '#28a745'; // ä¿å »æé®é¢è² case '2': return '#ffc107'; // ç»´ä¿®æé®é¢è² default: return '#000'; } } </script> <style scoped lang="scss"> @@ -472,7 +647,7 @@ } .text-mini { font-size: 22rpx; font-size: 24rpx; } .menu-indicator { @@ -494,7 +669,7 @@ } :deep(.wd-navbar__text) { font-size: 26rpx; font-size: 28rpx; color: white; } @@ -502,6 +677,20 @@ :deep(.wd-navbar__title) { color: white; font-weight: 0; font-size: 32rpx; font-size: 34rpx; } // æ°å¢æ ·å¼ï¼å¨æè®¾ç½®å¡çèæ¯è² :deep(.wd-card) { transition: background-color 0.3s ease; &.status-0 { background-color: #e6f7ff; // æ£æ¥ç¶æèæ¯è² } &.status-1 { background-color: #f6ffed; // ä¿å »ç¶æèæ¯è² } &.status-2 { background-color: #fffbe6; // ç»´ä¿®ç¶æèæ¯è² } } </style> eims-ui-mobile/src/pages/maint/maint-st.vue
@@ -43,19 +43,19 @@ <view class="flex h-[140rpx]" items-center> <image class="slot-img text-center" src="/static/images/camera.png" /> <view class="flex-1"> <view class="text-color-gray text-xs mt-1 flex"> <view class="text-color-gray text-sm mt-1 flex"> <text class="mr-3">工忻æ°: {{ item.orderCount }}</text> | <text class="mx-3">已宿: {{ item.wcCount }}</text> </view> <view class="text-color-gray text-xs mt-2 flex"> <view class="text-color-gray text-sm mt-2 flex"> <text class="mr-3">å¾ ä¿å »: {{ item.dbyCount }}</text> | <text class="mx-3">ä¿å »ä¸: {{ item.byCount }}</text> | <text class="ml-3">å¾ éªè¯: {{ item.dyzCount }}</text> </view> <view class="text-color-gray text-xs mt-2 flex"> <view class="text-color-gray text-sm mt-2 flex"> <text>ç¶æï¼</text> <template v-if="item.status === '1'"> <wd-icon class="icon-color-success" name="check-outline" size="34rpx"></wd-icon> @@ -66,7 +66,7 @@ <text class="ml-1">è¿è¡ä¸</text> </template> </view> <view class="text-color-gray text-xs mt-2 flex">å建æ¶é´: {{ item.createTime }}</view> <view class="text-color-gray text-sm mt-2 flex">å建æ¶é´: {{ item.createTime }}</view> </view> <wd-button size="small" icon="edit-outline" @click.stop="itemClick(item)">æç»</wd-button> </view> @@ -208,7 +208,7 @@ height: 40rpx; } .text-mini { font-size: 22rpx; font-size: 24rpx; } .menu-indicator { eims-ui-mobile/src/pages/repair/repair-fb.vue
@@ -29,20 +29,20 @@ <template #title> <view class="flex items-center menu-title-box"> <view class="menu-indicator"></view> <view class="ml-1 text-xs">ç»´ä¿®æ¦è§</view> <view class="ml-1 text-sm">ç»´ä¿®æ¦è§</view> </view> </template> <wd-steps :active="repairRecordList.length" vertical class="px-4"> <wd-step v-for="(item, index) in repairRecordList"> <template #title> <view class="flex items-center menu-title-box"> <view class="ml-1 text-xs">{{ item?.operaResult }}</view> <view class="ml-1 text-sm">{{ item?.operaResult }}</view> </view> </template> <template #description> <view class="flex items-center menu-title-box"> <view class="ml-1 text-xs">{{ item?.operaUserName }}</view> <view class="ml-1 text-xs">{{ item?.handleTime }}</view> <view class="ml-1 text-sm">{{ item?.operaUserName }}</view> <view class="ml-1 text-sm">{{ item?.handleTime }}</view> </view> </template> </wd-step> @@ -53,7 +53,7 @@ <template #title> <view class="flex items-center menu-title-box"> <view class="menu-indicator"></view> <view class="ml-1 text-xs">ç»´ä¿®è¯ä»·</view> <view class="ml-1 text-sm">ç»´ä¿®è¯ä»·</view> </view> </template> <wd-cell title="维修满æåº¦"> eims-ui-mobile/src/pages/repair/req-list.vue
@@ -52,7 +52,7 @@ <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-xs">{{ item.code }}</text> <text class="ml-1 text-sm">{{ item.code }}</text> </view> <view> @@ -114,7 +114,7 @@ <text>æ¥ä¿®äºº: {{ item.reqUserName }}</text> </view> </view> <view class="text-color-gray text-xs mt-1"> <view class="text-color-gray text-sm mt-1"> {{ item.location }} {{ item.madeIn }} </view> </view> eims-ui-mobile/src/pages/repair/res-list.vue
@@ -50,7 +50,7 @@ <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-xs">{{ item.resCode }}</text> <text class="ml-1 text-sm">{{ item.resCode }}</text> <text class="text-color-gray ml-2 text-mini">æ¥å:{{ item.createTime }}</text> </view> eims-ui-mobile/src/pages/scan/index.vue
@@ -19,7 +19,7 @@ <view class="flex justify-between items-baseline"> <view class="flex items-center menu-title-box"> <view class="menu-indicator"></view> <text class="ml-1 text-xs">{{ model.assetNo }}</text> <text class="ml-1 text-sm">{{ model.assetNo }}</text> <wd-tag v-if="model.status === '0'" class="ml-2" bg-color="cyan">è¯ç¨</wd-tag> <wd-tag v-else-if="model.status === '1'" class="ml-2" type="success">使ç¨</wd-tag> <wd-tag v-else-if="model.status === '2'" class="ml-2" type="danger">åç¨</wd-tag> @@ -41,7 +41,7 @@ {{ model.equName }} <text class="text-color-gray ml-2 text-mini">{{ model.modelNo }}</text> </view> <view class="text-color-gray text-xs mt-1"> <view class="text-color-gray text-sm mt-1"> {{ model.location }} | {{ model.madeIn }} </view> </view> eims-ui-mobile/src/pages/spare/spare-list.vue
@@ -22,7 +22,7 @@ <view class="flex justify-between items-baseline"> <view class="flex items-center menu-title-box"> <view class="menu-indicator"></view> <text class="ml-1 text-xs">{{ item.code }}</text> <text class="ml-1 text-sm">{{ item.code }}</text> </view> <view> @@ -38,10 +38,10 @@ {{ item.name }} <text class="text-color-gray ml-2 text-mini">{{ item.modelNo }}</text> </view> <view class="text-color-gray text-xs mt-1"> <view class="text-color-gray text-sm mt-1"> åºå: {{ item.actualStock }} | åä»·: {{ item.referPrice }} </view> <view class="text-color-gray text-xs mt-1"> <view class="text-color-gray text-sm mt-1"> ä¾åºå: {{ item.supplier }} </view> </view> eims-ui-mobile/src/service/maint.ts
@@ -48,3 +48,10 @@ export const updateMaintOrder = (data: any) => { return http.put<void>('/eims/maintOrder', data) } /** * æ¹éæ´æ°ä¿å »å·¥å */ export const updateMaintOrderBatch = (data: any) => { return http.put<void>('/eims/maintOrder/editBatch', data) } eims/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/constant/DictConstants.java
@@ -219,6 +219,16 @@ String CK = "2"; // é¢ç¨åºåº } /** * ä¿å »æ¹æ³ */ String MAINT_METHOD = "maint_method"; interface MAINT_METHOD_DETAIL { String CHECK = "0"; String MAINT = "1"; String REPAIR = "2"; } eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/EimsMaintOrderController.java
@@ -11,8 +11,10 @@ import jakarta.servlet.http.HttpServletResponse; import jakarta.validation.constraints.*; import cn.dev33.satoken.annotation.SaCheckPermission; import org.dromara.common.core.constant.DictConstants; import org.dromara.common.core.utils.DateUtils; import org.dromara.common.core.utils.StringUtils; import org.dromara.eims.domain.bo.MaintOrderBo; import org.dromara.eims.domain.vo.MaintOrdeGroupVo; import org.springframework.web.bind.annotation.*; import org.springframework.validation.annotation.Validated; @@ -79,7 +81,14 @@ params.put("beginPlanTime",startOfMonth); params.put("endPlanTime",endOfMonth); return eimsMaintOrderService.queryPageListCustom(bo, pageQuery); TableDataInfo<EimsMaintOrderVo> tableDataInfo = eimsMaintOrderService.queryPageListCustom(bo, pageQuery); tableDataInfo.getRows().forEach(e -> { // 妿ä¿å »æ¹æ³æ¯ç»´ä¿®ï¼æ¥è¯¢å ³èçå¤ä»¶ if (DictConstants.MAINT_METHOD_DETAIL.REPAIR.equals(e.getMaintFun())) { e.setSpareParts(eimsMaintOrderService.querySpareParts(e.getMaintCode())); } }); return tableDataInfo; } /** @@ -127,6 +136,14 @@ return toAjax(eimsMaintOrderService.updateByBo(bo)); } @SaCheckPermission("eims:maintOrder:edit") @Log(title = "ä¿å »å·¥å-æ¹éä¿®æ¹", businessType = BusinessType.UPDATE) @RepeatSubmit() @PutMapping("editBatch") public R<Void> editBatch(@Validated(EditGroup.class) @RequestBody MaintOrderBo bo) { return toAjax(eimsMaintOrderService.updateBatchByBo(bo)); } /** * å é¤ä¿å »å·¥å * eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsMaintOrder.java
@@ -113,5 +113,14 @@ */ private String remark; /** * ä¿å »æ¹å¼ï¼0-æ£æ¥ï¼1-ä¿å »ï¼2-ç»´ä¿®ï¼ */ private String maintFun; /** * 维修说æ */ private String repairDesc; } eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsMaintOrderBo.java
@@ -9,7 +9,10 @@ import lombok.EqualsAndHashCode; import jakarta.validation.constraints.*; import java.util.Date; import java.util.List; import com.fasterxml.jackson.annotation.JsonFormat; import org.dromara.eims.domain.EimsSpareInout; /** * ä¿å »å·¥åä¸å¡å¯¹è±¡ eims_maint_order @@ -114,9 +117,21 @@ */ private String remark; /** * ä¿å »æ¹å¼ï¼0-æ£æ¥ï¼1-ä¿å »ï¼2-ç»´ä¿®ï¼ */ private String maintFun; /** * 维修说æ */ private String repairDesc; // å ³èè¡¨åæ®µ private String equName; private String maintUserName; private List<EimsSpareBo> spareParts; } eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsSpareBo.java
@@ -33,7 +33,6 @@ /** * ç±»å */ @NotNull(message = "ç±»åä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) private Long type; /** @@ -45,7 +44,6 @@ /** * å¤ä»¶ç¼ç */ @NotBlank(message = "å¤ä»¶ç¼ç ä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) private String code; /** eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsSpareInoutdtBo.java
@@ -21,7 +21,7 @@ public class EimsSpareInoutdtBo extends BaseEntity { /** * * */ @NotNull(message = "ä¸è½ä¸ºç©º", groups = { EditGroup.class }) private Long id; @@ -29,7 +29,7 @@ /** * åºåºåæå ¥åºåid */ @NotNull(message = "åºåºåæå ¥åºåidä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) private Long inoutId; /** @@ -41,13 +41,13 @@ /** * ä¹ååºå */ @NotNull(message = "ä¹ååºåä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) private Long beforeStock; /** * å®é åºå */ @NotNull(message = "å®é åºåä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) private Long actualStock; /** @@ -59,13 +59,13 @@ /** * åä»· */ @NotNull(message = "åä»·ä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) private Long unitPrice; /** * éé¢ */ @NotNull(message = "éé¢ä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) private Long amount; /** @@ -74,4 +74,7 @@ private String remark; private String spareName; } eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/MaintOrderBo.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,10 @@ package org.dromara.eims.domain.bo; import lombok.Data; import java.util.List; @Data public class MaintOrderBo { private List<EimsMaintOrderBo> maintOrderList; } eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsMaintOrderVo.java
@@ -12,11 +12,12 @@ import org.dromara.common.excel.convert.ExcelDictConvert; import io.github.linpeilie.annotations.AutoMapper; import lombok.Data; import org.dromara.eims.domain.bo.EimsSpareBo; import java.io.Serial; import java.io.Serializable; import java.util.Date; import java.util.List; /** @@ -155,5 +156,17 @@ @ExcelProperty(value = "夿³¨") private String remark; /** * ä¿å »æ¹å¼ï¼0-æ£æ¥ï¼1-ä¿å »ï¼2-ç»´ä¿®ï¼ */ private String maintFun; /** * 维修说æ */ private String repairDesc; private List<EimsSpareVo> spareParts; } eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsSpareInoutdtVo.java
@@ -94,4 +94,6 @@ private String unit; } eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IEimsMaintOrderService.java
@@ -1,9 +1,12 @@ package org.dromara.eims.service; import org.dromara.eims.domain.bo.EimsSpareBo; import org.dromara.eims.domain.bo.MaintOrderBo; import org.dromara.eims.domain.vo.EimsMaintOrderVo; import org.dromara.eims.domain.bo.EimsMaintOrderBo; import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.eims.domain.vo.EimsSpareVo; import org.dromara.eims.domain.vo.MaintOrdeGroupVo; import java.util.Collection; @@ -59,6 +62,14 @@ Boolean updateByBo(EimsMaintOrderBo bo); /** * æ¹éä¿®æ¹ä¿å »å·¥å * * @param bo ä¿å »å·¥åä¸å¡å¯¹è±¡ * @return æä½ç»æ */ boolean updateBatchByBo(MaintOrderBo bo); /** * æ ¡éªå¹¶æ¹éå é¤ä¿å »å·¥åä¿¡æ¯ * * @param ids å¾ å é¤ç主é®éå @@ -83,4 +94,6 @@ * @return */ TableDataInfo<MaintOrdeGroupVo> queryPageGroupList(EimsMaintOrderBo bo, PageQuery pageQuery); List<EimsSpareVo> querySpareParts(String id); } eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintOrderServiceImpl.java
@@ -20,17 +20,19 @@ import org.dromara.common.satoken.utils.LoginHelper; import org.dromara.eims.domain.EimsMaintPlan; import org.dromara.eims.domain.bo.EimsMaintPlanBo; import org.dromara.eims.domain.vo.EimsEquVo; import org.dromara.eims.domain.vo.MaintOrdeGroupVo; import org.dromara.eims.domain.EimsSpareInout; import org.dromara.eims.domain.bo.EimsSpareBo; import org.dromara.eims.domain.bo.EimsSpareInoutBo; import org.dromara.eims.domain.bo.MaintOrderBo; import org.dromara.eims.domain.vo.*; import org.dromara.eims.mapper.EimsEquMapper; import org.dromara.eims.mapper.EimsMaintPlanMapper; import org.dromara.eims.service.IEimsSpareInoutService; import org.dromara.system.domain.SysDept; import org.dromara.system.domain.vo.SysDeptVo; import org.dromara.system.mapper.SysDeptMapper; import org.springframework.stereotype.Service; import org.dromara.eims.domain.bo.EimsMaintOrderBo; import org.dromara.eims.domain.vo.EimsMaintOrderVo; import org.dromara.eims.domain.EimsMaintOrder; import org.dromara.eims.mapper.EimsMaintOrderMapper; import org.dromara.eims.service.IEimsMaintOrderService; @@ -52,6 +54,7 @@ private final EimsMaintPlanMapper planMapper; private final SysDeptMapper sysDeptMapper; private final EimsEquMapper equMapper; private final IEimsSpareInoutService spareInoutService; /** * æ¥è¯¢ä¿å »å·¥å @@ -293,6 +296,45 @@ } /** * æ¹éä¿®æ¹ä¿å »å·¥å * * @param bo ä¿å »å·¥å * @return æ¯å¦ä¿®æ¹æå */ @Override public boolean updateBatchByBo(MaintOrderBo bo) { LoginUser loginUser = LoginHelper.getLoginUser(); List<EimsMaintOrder> list = MapstructUtils.convert(bo.getMaintOrderList(), EimsMaintOrder.class); list.forEach(e -> { e.setStatus(DictConstants.MAINT_ORDER_STATUS_DETAIL.DAIYANZHENG); e.setEndTime(new Date()); e.setMaintUser(loginUser.getUserId()); e.setUpdateTime(new Date()); }); bo.getMaintOrderList().forEach(item -> { // 夿å¤ä»¶å表æ¯å¦ä¸ºç©ºï¼ä¸ä¸ºç©ºåæ°å¢ä¸ä¸ªå¤ä»¶åºåºåï¼åæ¶å¢å åºåºæç» if (item.getSpareParts() != null && item.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(item.getSpareParts()); spareInoutBo.setChargeUser(loginUser.getUserId()); spareInoutBo.setChargeDept(loginUser.getDeptId()); spareInoutBo.setAssociatedOrder(item.getMaintCode()); // ä¿åè¿æ°æ®åº Boolean b = spareInoutService.insertByBo(spareInoutBo); } }); return baseMapper.updateBatchById(list); } /** * ä¿ååçæ°æ®æ ¡éª */ private void validEntityBeforeSave(EimsMaintOrder entity){ @@ -326,4 +368,20 @@ } return String.join(StringUtils.SEPARATOR, list); } @Override public List<EimsSpareVo> querySpareParts(String code) { // æ¥è¯¢å ³èçå¤ä»¶ï¼å ³ç³»å¦ä¸ï¼å¤ä»¶åºå ¥åºåçassociatedOrder å ³èä¼ å ¥çcode,å¤ä»¶åºå ¥åºæç»éè¿åºå ¥åºåçidå ³èï¼å¤ä»¶åç§°éè¿åºå ¥åºæç»ä¸çspareIdå ³è 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(); } } eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsSpareInoutServiceImpl.java
@@ -136,58 +136,61 @@ if (flag) { bo.setId(add.getId()); } //å ¥åºï¼åºå åºåº-åºå ï¼é»è®¤å ¥åºï¼ int OperationType; //åºåº if(bo.getType().equals(DictConstants.SPARE_INOUT_TYPE_DETAIL.CK)){ OperationType = -1; } else { OperationType = 1; } // å ¥åºï¼åºå åºåº-åºå ï¼é»è®¤å ¥åºï¼ int OperationType = bo.getType().equals(DictConstants.SPARE_INOUT_TYPE_DETAIL.CK) ? -1 : 1; List<EimsSpareBo> spareList = Optional.ofNullable(bo.getSpareList()).orElse(new ArrayList<>()); // æå ¥åºåºæç» List<EimsSpareInoutdt> dtList = spareList.stream() .map(eimsSpareBo -> { EimsSpareInoutdt dt = new EimsSpareInoutdt(); dt.setInoutId(add.getId()); dt.setSpareId(eimsSpareBo.getId()); dt.setBeforeStock(eimsSpareBo.getActualStock()); // 注æå ¥åºåºåº dt.setActualStock(eimsSpareBo.getActualStock() + (eimsSpareBo.getQuantity() * OperationType)); dt.setQuantity(eimsSpareBo.getQuantity()); // 设置åä»·åéé¢ Optional.ofNullable(eimsSpareBo.getReferPrice()).ifPresent(referPrice -> { dt.setUnitPrice(referPrice); dt.setAmount(referPrice.multiply(BigDecimal.valueOf(eimsSpareBo.getQuantity()))); }); // å并两次循ç¯ä¸ºä¸æ¬¡å¾ªç¯ List<EimsSpareInoutdt> dtList = new ArrayList<>(); List<EimsSpare> updateSpareList = new ArrayList<>(); return dt; }) .toList(); for (EimsSpareBo eimsSpareBo : spareList) { EimsSpare spare = spareMapper.selectById(eimsSpareBo.getId()); if (spare == null) { spare = new EimsSpare(); spare.setName(eimsSpareBo.getName()); spare.setCode(eimsSpareBo.getCode()); spare.setActualStock(100L); spareMapper.insert(spare); eimsSpareBo.setId(spare.getId()); } // æå ¥åºåºæç» EimsSpareInoutdt dt = new EimsSpareInoutdt(); dt.setInoutId(add.getId()); dt.setSpareId(spare.getId()); dt.setBeforeStock(spare.getActualStock()); dt.setActualStock(spare.getActualStock() + (eimsSpareBo.getQuantity() * OperationType)); dt.setQuantity(eimsSpareBo.getQuantity()); // 设置åä»·åéé¢ Optional.ofNullable(spare.getReferPrice()).ifPresent(referPrice -> { dt.setUnitPrice(referPrice); dt.setAmount(referPrice.multiply(BigDecimal.valueOf(eimsSpareBo.getQuantity()))); }); dtList.add(dt); // æ´æ°å¤ä»¶åºå EimsSpare updatedSpare = new EimsSpare(); updatedSpare.setId(spare.getId()); updatedSpare.setActualStock(spare.getActualStock() + (eimsSpareBo.getQuantity() * OperationType)); Optional.ofNullable(spare.getReferPrice()).ifPresent(referPrice -> { updatedSpare.setStockAmount(referPrice.multiply(BigDecimal.valueOf(updatedSpare.getActualStock()))); }); updateSpareList.add(updatedSpare); } // æ¹éæå ¥æ°æ® if (!dtList.isEmpty()) { inoutdtMapper.insertBatch(dtList); } // æ´æ°å¤ä»¶çåºå List<EimsSpare> updateSpareList = spareList.stream().map(spareBo -> { EimsSpare spare = new EimsSpare(); spare.setId(spareBo.getId()); spare.setActualStock(spareBo.getActualStock() + (spareBo.getQuantity() * OperationType)); // 设置åä»·åéé¢ Optional.ofNullable(spareBo.getReferPrice()).ifPresent(referPrice -> { spare.setStockAmount(referPrice.multiply(BigDecimal.valueOf(spare.getActualStock()))); }); return spare; }).toList(); // æ¹éæ´æ°å¤ä»¶åºå if (!updateSpareList.isEmpty()) { spareMapper.updateBatchById(updateSpareList); } return flag; }