From 1dc84e14accf77681279e63fbba188770bfc8b40 Mon Sep 17 00:00:00 2001 From: zhuguifei <zhuguifei@zhuguifeideiMac.local> Date: 星期三, 23 四月 2025 17:58:10 +0800 Subject: [PATCH] 新增保养工单,准备开发保养工单角色权限控制 --- eims-ui-mobile/src/service/maint.d.ts | 126 +++++++ eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintOrderServiceImpl.java | 11 eims-ui-mobile/src/static/ico/ico-platform.png | 0 eims-ui-mobile/src/pages/my/index.vue | 1 eims-ui-mobile/src/service/maint.ts | 34 ++ eims-ui-mobile/src/pages/inspect/insp-st.vue | 4 eims-ui-mobile/src/pages/maint/order-detail.vue | 228 ++++++++++++++ eims-ui-mobile/src/pages/maint/maint-order.vue | 388 ++++++++++++++++++++++++ eims-ui-mobile/src/pages/maint/maint-st.vue | 31 + eims-ui-mobile/src/utils/DateUtils.ts | 5 eims-ui-mobile/src/pages.json | 26 + eims-ui-mobile/src/pages/spare/index.vue | 1 eims-ui-mobile/src/pages/equ/equ-list.vue | 1 eims-ui-mobile/src/utils/RoleUtils.ts | 41 ++ eims-ui-mobile/src/pages/inspect/insp-record.vue | 4 eims-ui-mobile/src/types/uni-pages.d.ts | 2 eims-ui-mobile/src/style/index.scss | 7 17 files changed, 882 insertions(+), 28 deletions(-) diff --git a/eims-ui-mobile/src/pages.json b/eims-ui-mobile/src/pages.json index df35397..3e3d43f 100644 --- a/eims-ui-mobile/src/pages.json +++ b/eims-ui-mobile/src/pages.json @@ -67,6 +67,7 @@ "path": "pages/equ/equ-list", "type": "page", "layout": "default", + "needLogin": true, "style": { "navigationBarTitleText": "璁惧鍒楄〃" } @@ -91,6 +92,7 @@ { "path": "pages/inspect/insp-record", "type": "page", + "needLogin": true, "style": { "navigationBarTitleText": "鐐规璁板綍", "navigationStyle": "custom", @@ -101,6 +103,7 @@ "path": "pages/inspect/insp-st", "type": "page", "layout": "default", + "needLogin": true, "style": { "navigationBarTitleText": "鐐规姹囨��" } @@ -114,17 +117,39 @@ } }, { + "path": "pages/maint/maint-order", + "type": "page", + "needLogin": true, + "style": { + "navigationBarTitleText": "淇濆吇宸ュ崟", + "navigationStyle": "custom", + "navigationBarBackgroundColor": "#4D80F0" + } + }, + { "path": "pages/maint/maint-st", "type": "page", "layout": "default", + "needLogin": true, "style": { "navigationBarTitleText": "淇濆吇姹囨��" + } + }, + { + "path": "pages/maint/order-detail", + "type": "page", + "needLogin": true, + "style": { + "navigationBarTitleText": "宸ュ崟鏄庣粏", + "navigationStyle": "custom", + "navigationBarBackgroundColor": "#4D80F0" } }, { "path": "pages/my/index", "type": "page", "layout": "tabbar", + "needLogin": true, "style": { "navigationBarTitleText": "鎴戠殑" } @@ -133,6 +158,7 @@ "path": "pages/spare/index", "type": "page", "layout": "tabbar", + "needLogin": true, "style": { "navigationBarTitleText": "spare" } diff --git a/eims-ui-mobile/src/pages/equ/equ-list.vue b/eims-ui-mobile/src/pages/equ/equ-list.vue index 4a72014..0e6ff84 100644 --- a/eims-ui-mobile/src/pages/equ/equ-list.vue +++ b/eims-ui-mobile/src/pages/equ/equ-list.vue @@ -1,6 +1,7 @@ <route lang="json5" type="page"> { layout: 'default', + needLogin: true, style: { navigationBarTitleText: '璁惧鍒楄〃', }, diff --git a/eims-ui-mobile/src/pages/inspect/insp-record.vue b/eims-ui-mobile/src/pages/inspect/insp-record.vue index f0b128d..620f323 100644 --- a/eims-ui-mobile/src/pages/inspect/insp-record.vue +++ b/eims-ui-mobile/src/pages/inspect/insp-record.vue @@ -1,5 +1,6 @@ <route lang="json5"> { + needLogin: true, style: { navigationBarTitleText: '鐐规璁板綍', navigationStyle: 'custom', @@ -52,7 +53,7 @@ <view class="text-color-gray text-xs mt-2 flex"> <text>鐘舵�侊細</text> <template v-if="dataCount > 0 && dataCount === checkCount"> - <wd-icon class="icon-color-success" name="check-outline" size="40rpx"></wd-icon> + <wd-icon class="icon-color-success" name="check-outline" size="34rpx"></wd-icon> <text class="ml-1">宸插畬鎴�</text> </template> <template v-else> @@ -330,5 +331,6 @@ :deep(.wd-navbar__title) { color: white; font-weight: 0; + font-size: 32rpx; } </style> diff --git a/eims-ui-mobile/src/pages/inspect/insp-st.vue b/eims-ui-mobile/src/pages/inspect/insp-st.vue index 2499379..748ab44 100644 --- a/eims-ui-mobile/src/pages/inspect/insp-st.vue +++ b/eims-ui-mobile/src/pages/inspect/insp-st.vue @@ -1,6 +1,7 @@ <route lang="json5" type="page"> { layout: 'default', + needLogin: true, style: { navigationBarTitleText: '鐐规姹囨��', }, @@ -54,7 +55,7 @@ <view class="text-color-gray text-xs mt-2 flex"> <text>鐘舵�侊細</text> <template v-if="item.recordCount === item.checkCount"> - <wd-icon class="icon-color-success" name="check-outline" size="40rpx"></wd-icon> + <wd-icon class="icon-color-success" name="check-outline" size="34rpx"></wd-icon> <text class="ml-1">宸插畬鎴�</text> </template> <template v-else> @@ -120,7 +121,6 @@ paging.value.reload() } onLoad(() => { - queryList() uni.$on('insp-st-refresh', reloadData) }) onUnload(() => { diff --git a/eims-ui-mobile/src/pages/maint/maint-order.vue b/eims-ui-mobile/src/pages/maint/maint-order.vue new file mode 100644 index 0000000..bcfcb64 --- /dev/null +++ b/eims-ui-mobile/src/pages/maint/maint-order.vue @@ -0,0 +1,388 @@ +<route lang="json5" type="page"> +{ + needLogin: true, + style: { + navigationBarTitleText: '淇濆吇宸ュ崟', + navigationStyle: 'custom', + navigationBarBackgroundColor: '#4D80F0', + }, +} +</route> + +<template> + <z-paging ref="paging" v-model="dataList" @query="queryList" show-refresher-update-time> + <template #top> + <wd-navbar + title="淇濆吇宸ュ崟" + left-arrow + @click-left="goBack" + right-text="鎻愪氦" + @click-right="handleClickRight" + custom-style="background: #4D80F0;" + safeAreaInsetTop + ></wd-navbar> + <wd-cell> + <template #title> + <text class="text-color-gray">璁惧</text> + </template> + </wd-cell> + <view class="h-[2px] w-full bg-base"></view> + <wd-card type="rectangle"> + <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">{{ maintSt.equName }}</view> + <view class="text-color-gray ml-2 text-mini">{{ maintSt.assetNo }}</view> + </view> + + <view class="flex items-center"> + <text class="text-color-gray text-mini">{{ maintSt.planTime }}</text> + </view> + </view> + </template> + <view class="flex h-[100rpx]" 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">宸ュ崟鎬绘暟: {{ maintSt.orderCount }}</text> + | + <text class="mx-3">宸插畬鎴�: {{ maintSt.wcCount }}</text> + </view> + <view class="text-color-gray text-xs 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"> + <text>鐘舵�侊細</text> + <template v-if="maintSt.orderCount === maintSt.wcCount"> + <wd-icon class="icon-color-success" name="check-outline" size="34rpx"></wd-icon> + <text class="ml-1">宸插畬鎴�</text> + </template> + <template v-else> + <wd-icon class="icon-color-base" name="detection" size="40rpx"></wd-icon> + <text class="ml-1">杩涜涓�</text> + </template> + </view> + </view> + </view> + </wd-card> + </template> + + <view class="bg-base"> + <view class="w-full h-[24rpx]"></view> + <wd-cell class="mb-[2px]"> + <template #title> + <text class="text-color-gray">淇濆吇椤�</text> + </template> + </wd-cell> + + <wd-card type="rectangle" v-for="(item, index) in dataList" :key="item.id"> + <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 w-[50%]"> + <wd-text :text="item.maintName" :lines="1"></wd-text> + </view> + <view class="text-color-gray ml-2 text-mini">{{ item.maintCode }}</view> + </view> + + <view class="flex items-center w-[20%] justify-end"> + <text class="text-color-gray text-mini"> + {{ item?.planTime }} + </text> + </view> + </view> + </template> + <view class="flex h-[140rpx]" 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.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> + </view> + <!--鎿嶄綔宸ユ垨缁翠慨宸ヨ鑹�--> + <template v-if="isOperatorOrRepair()"> + <wd-button + v-if="item.status === '0'" + size="small" + icon="edit-outline" + @click.stop="handleStartMaint(item)" + > + 寮�濮嬩繚鍏� + </wd-button> + <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> + </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" + auto-height + :maxlength="200" + show-word-limit + placeholder="璇疯緭鍏ョ壒璁颁簨椤�" + clearable + /> + </view> + </z-paging> +</template> +<script setup lang="ts"> +import type { MaintStVO } from '@/service/maint.d' +import { getMaintSt, getMaintStOrderList, updateMaintOrder } from '@/service/maint' +import { ref, reactive } from 'vue' +import { useToast, useMessage } from 'wot-design-uni' +import { isLeader, isOperatorOrRepair } from '@/utils/RoleUtils' +const message = useMessage() + +const paging = ref(null) +const dataList = ref([]) + +interface QueryParams { + pageNum: number + pageSize: number + maintCode: string + status?: string +} + +const maintSt = reactive<MaintStVO>({ + id: '', + equName: '', + assetNo: '', + planTime: '', + orderCount: null, + wcCount: null, + dbyCount: null, + byCount: null, + dyzCount: null, + specialNote: '', +}) +const queryList = (pageNum?: number, pageSize?: number) => { + const params: QueryParams = { + pageNum, + pageSize, + maintCode: maintCode.value, + } + + getMaintStOrderList(params) + .then((res: any) => { + // 璇峰嬁鍦ㄧ綉缁滆姹傚洖璋冧腑缁檇ataList璧嬪�硷紒锛佸彧闇�瑕佽皟鐢╟omplete灏卞彲浠ヤ簡 + paging.value.complete(res.rows) + }) + .catch((res) => { + // 濡傛灉璇锋眰澶辫触鍐檖aging.value.complete(false)锛屼細鑷姩灞曠ず閿欒椤甸潰 + // 娉ㄦ剰锛屾瘡娆¢兘闇�瑕佸湪catch涓啓杩欏彞璇濆緢楹荤儲锛寊-paging鎻愪緵浜嗘柟妗堝彲浠ュ叏灞�缁熶竴澶勭悊 + // 鍦ㄥ簳灞傜殑缃戠粶璇锋眰鎶涘嚭寮傚父鏃讹紝鍐檜ni.$emit('z-paging-error-emit');鍗冲彲 + paging.value.complete(false) + }) +} + +function itemClick(item) { + goToOrderDetail(item) +} + +function goToOrderDetail(item) { + uni.navigateTo({ + url: `/pages/maint/order-detail?id=${item.id}`, + }) +} + +function handleStartMaint(item) { + message + .confirm({ + msg: '纭畾寮�濮嬩繚鍏伙紵', + title: '鎻愮ず', + beforeConfirm: ({ resolve }) => { + // 纭寮�濮嬩慨鏀圭姸鎬佷负1-淇濆吇涓� + const data = Object.assign({}, item) + data.status = '1' + updateOrder(data, resolve) + }, + }) + .then(() => {}) + .catch((error) => { + console.log(error) + }) +} + +/** + * 鏇存柊淇濆吇宸ュ崟 + * @param item + * @param resolve + */ +function updateOrder(data: any, resolve: any) { + updateMaintOrder(data) + .then((res: any) => { + resolve(true) + if (res?.code === 200) { + reloadData() + } + }) + .catch((res) => { + console.error(res) + }) +} +function reloadData() { + paging.value.reload() +} +const goBack = () => { + uni.navigateBack() +} + +function handleClickRight() {} + +/** + * 鏌ヨ淇濆吇鏄庣粏闇�瑕佺殑code + */ +const maintCode = computed(() => `${maintSt.equId}_${maintSt.planTime}`) + +onLoad((options) => { + const itemString = decodeURIComponent(options.maintSt) + const item = JSON.parse(itemString) + Object.assign(maintSt, item) +}) +</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__footer) { + padding: 10rpx !important; +} + +.col-title-box { +} + +.bg-primary { + background: $uni-color-primary; +} + +:deep(.wd-navbar__text) { + font-size: 26rpx; + color: white; +} + +:deep(.wd-icon-arrow-left:before), +:deep(.wd-navbar__title) { + color: white; + font-weight: 0; + font-size: 32rpx; +} +</style> diff --git a/eims-ui-mobile/src/pages/maint/maint-st.vue b/eims-ui-mobile/src/pages/maint/maint-st.vue index 4104498..e267621 100644 --- a/eims-ui-mobile/src/pages/maint/maint-st.vue +++ b/eims-ui-mobile/src/pages/maint/maint-st.vue @@ -1,6 +1,7 @@ <route lang="json5" type="page"> { layout: 'default', + needLogin: true, style: { navigationBarTitleText: '淇濆吇姹囨��', }, @@ -23,13 +24,15 @@ <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">{{ item.equName }}</view> + <view class="ml-1 text-sm align-center w-[50%]"> + <wd-text :text="item.equName" :lines="1"></wd-text> + </view> <view class="text-color-gray ml-2 text-mini">{{ item.assetNo }}</view> </view> - <view class="flex items-center"> + <view class="flex items-center w-[20%] justify-end"> <text class="text-color-gray text-mini"> - {{ status === 'Day' ? item?.planTimeStr : item?.planTimeStr?.substring(0, 7) || '' }} + {{ item?.planTime }} </text> </view> </view> @@ -38,21 +41,21 @@ <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> + <text class="mr-3">宸ュ崟鎬绘暟: {{ item.orderCount }}</text> | - <text class="mx-3">宸茬偣妫�: {{ item.checkCount }}</text> - | - <text class="ml-3">鏈偣妫�: {{ item.unCheckCount }}</text> + <text class="mx-3">宸插畬鎴�: {{ item.wcCount }}</text> </view> <view class="text-color-gray text-xs mt-2 flex"> - <text class="mr-3">姝e父: {{ item.normalNum }}</text> + <text class="mr-3">寰呬繚鍏�: {{ item.dbyCount }}</text> | - <text class="mx-3">寮傚父: {{ item.abNormalNum }}</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"> <text>鐘舵�侊細</text> - <template v-if="item.recordCount === item.checkCount"> - <wd-icon class="icon-color-success" name="check-outline" size="40rpx"></wd-icon> + <template v-if="item.orderCount === item.wcCount"> + <wd-icon class="icon-color-success" name="check-outline" size="34rpx"></wd-icon> <text class="ml-1">宸插畬鎴�</text> </template> <template v-else> @@ -83,7 +86,7 @@ const equName = ref<string>('-1') const statusList = ref<Record<string, any>[]>([ - { label: '鍏ㄩ儴', value: '-1' }, + { label: '鎵�鏈夌姸鎬�', value: '-1' }, { label: '寰呬繚鍏�', value: '0' }, { label: '淇濆吇涓�', value: '1' }, { label: '寰呴獙璇�', value: '2' }, @@ -128,9 +131,9 @@ } function itemClick(item) { - const inspCode = `${item.equId}_${item.planTime}_${status.value}` + const itemString = encodeURIComponent(JSON.stringify(item)) uni.navigateTo({ - url: `/pages/inspect/insp-record?id=${item.id}&inspCode=${inspCode}&specialNote=${item.specialNote ?? ''}&equName=${item.equName ?? ''}&assetNo=${item.assetNo ?? ''}&planTimeStr=${item.planTimeStr ?? ''}`, + url: `/pages/maint/maint-order?maintSt=${itemString}`, }) } diff --git a/eims-ui-mobile/src/pages/maint/order-detail.vue b/eims-ui-mobile/src/pages/maint/order-detail.vue new file mode 100644 index 0000000..2539593 --- /dev/null +++ b/eims-ui-mobile/src/pages/maint/order-detail.vue @@ -0,0 +1,228 @@ +<route lang="json5" type="page"> +{ + needLogin: true, + style: { + navigationBarTitleText: '宸ュ崟鏄庣粏', + navigationStyle: 'custom', + navigationBarBackgroundColor: '#4D80F0', + }, +} +</route> +<template> + <view class="bg-base h-[100vh]"> + <wd-navbar + title="宸ュ崟鏄庣粏" + left-arrow + @click-left="goBack" + right-text="鎻愪氦" + @click-right="handleClickRight" + custom-style="background: #4D80F0;" + safeAreaInsetTop + ></wd-navbar> + + <wd-form ref="form" :model="order" :rules="rules"> + <wd-cell-group custom-class="group" title="璁惧淇℃伅" border> + <wd-cell title="璁惧鍚嶇О" title-width="200rpx" is-link> + <text>{{ order?.equName }}</text> + </wd-cell> + <wd-cell title="璧勪骇缂栧彿" title-width="200rpx" is-link> + <text>{{ order?.assetNo }}</text> + </wd-cell> + </wd-cell-group> + + <wd-cell-group custom-class="mt-2" title="淇濆吇淇℃伅" border> + <wd-cell title="淇濆吇鍗曞彿" title-width="200rpx" is-link> + <text>{{ order?.maintCode }}</text> + </wd-cell> + <wd-cell title="淇濆吇椤�" title-width="200rpx" is-link> + <text>{{ order?.maintName }}</text> + </wd-cell> + <wd-cell title="璁″垝淇濆吇鏃ユ湡" title-width="200rpx" is-link> + <text>{{ order?.planTime }}</text> + </wd-cell> + <wd-datetime-picker + label="淇濆吇寮�濮嬫椂闂�" + label-width="200rpx" + placeholder="璇烽�夋嫨鏃堕棿" + prop="startTime" + v-model="startTime" + @open="openStartTime" + @confirm="handleStartTime" + /> + <wd-datetime-picker + label="淇濆吇缁撴潫鏃堕棿" + label-width="200rpx" + placeholder="璇烽�夋嫨鏃堕棿" + prop="endTime" + v-model="endTime" + @open="openEndTime" + @confirm="handleEndTime" + /> + + <wd-textarea + label="宸ヤ綔鎻忚堪" + label-width="200rpx" + type="textarea" + v-model="order.maintDesc" + auto-height + :maxlength="200" + show-word-limit + placeholder="璇疯緭鍏ュ伐浣滄弿杩�" + clearable + /> + <wd-cell title="淇濆吇鍥剧墖" title-width="200rpx" prop="fileList"> + <wd-upload + :auto-upload="false" + :file-list="fileList" + @change="handleFileChange" + ></wd-upload> + </wd-cell> + <wd-textarea + label="澶囨敞" + label-width="200rpx" + type="textarea" + v-model="order.remark" + auto-height + :maxlength="200" + show-word-limit + placeholder="璇疯緭鍏ュ娉�" + clearable + /> + </wd-cell-group> + </wd-form> + </view> +</template> + +<script setup lang="ts"> +import { getMaintOrder, updateMaintOrder } from '@/service/maint' +import { formatDate } from '@/utils/DateUtils' +import { reactive } from 'vue' +import { FormRules } from 'wot-design-uni/components/wd-form/types' +import { useToast, useMessage } from 'wot-design-uni' +const message = useMessage() + +const fileList = ref<[]>() +const startTime = ref<number>(0) +const endTime = ref<number>(0) + +interface MaintOrder { + id: string + equName: string + maintCode: string + maintName: string + planTime: string + startTime: string + endTime?: string + maintDesc: string + remark: string +} + +const order = reactive<MaintOrder>({ + id: '', + equName: '', + maintCode: '', + maintName: '', + planTime: '', + startTime: '', + endTime: '', + maintDesc: '', + remark: '', +}) + +const rules: FormRules = { + startTime: [ + { + required: true, + message: '璇烽�夋嫨淇濆吇寮�濮嬫椂闂�', + }, + ], + endTime: [ + { + required: true, + message: '璇烽�夋嫨淇濆吇缁撴潫鏃堕棿', + }, + ], + maintDesc: [ + { + required: true, + message: '璇疯緭鍏ュ伐浣滄弿杩�', + }, + ], +} +function openStartTime() { + if (startTime.value === 0) { + startTime.value = Date.now() + } +} +function openEndTime() { + if (endTime.value === 0) { + endTime.value = Date.now() + } +} + +function handleStartTime(value) { + order.startTime = formatDate(new Date(value.value)) +} +function handleEndTime(value) { + order.endTime = formatDate(new Date(value.value)) +} + +function handleFileChange({ fileList }) {} + +function initMaintOrder(id: any) { + getMaintOrder(id) + .then((res: any) => { + Object.assign(order, res) + startTime.value = new Date(order.startTime).getTime() + endTime.value = new Date(order.endTime).getTime() + }) + .catch((res) => {}) +} + +function updateOrder(resolve: any) { + updateMaintOrder(order) + .then((res: any) => { + resolve(true) + }) + .catch((res) => { + console.error(res) + }) +} + +const goBack = () => { + uni.navigateBack() +} + +function handleClickRight() { + message + .confirm({ + msg: '纭畾鎻愪氦锛�', + title: '鎻愮ず', + beforeConfirm: ({ resolve }) => { + updateOrder(resolve) + }, + }) + .then(() => {}) + .catch((error) => { + console.log(error) + }) +} + +onLoad((options) => { + initMaintOrder(options.id) +}) +</script> + +<style scoped lang="scss"> +:deep(.wd-navbar__text) { + font-size: 26rpx; + color: white; +} + +:deep(.wd-icon-arrow-left:before), +:deep(.wd-navbar__title) { + color: white; + font-weight: bold !important; + font-size: 32rpx; +} +</style> diff --git a/eims-ui-mobile/src/pages/my/index.vue b/eims-ui-mobile/src/pages/my/index.vue index 169627b..2c2a4ca 100644 --- a/eims-ui-mobile/src/pages/my/index.vue +++ b/eims-ui-mobile/src/pages/my/index.vue @@ -1,6 +1,7 @@ <route lang="json5" type="page"> { layout: 'tabbar', + needLogin: true, style: { navigationBarTitleText: '鎴戠殑', }, diff --git a/eims-ui-mobile/src/pages/spare/index.vue b/eims-ui-mobile/src/pages/spare/index.vue index 54478e6..c1f8574 100644 --- a/eims-ui-mobile/src/pages/spare/index.vue +++ b/eims-ui-mobile/src/pages/spare/index.vue @@ -1,6 +1,7 @@ <route lang="json5" type="page"> { layout: 'tabbar', + needLogin: true, style: { navigationBarTitleText: 'spare', }, diff --git a/eims-ui-mobile/src/service/maint.d.ts b/eims-ui-mobile/src/service/maint.d.ts index 92e3994..5571883 100644 --- a/eims-ui-mobile/src/service/maint.d.ts +++ b/eims-ui-mobile/src/service/maint.d.ts @@ -7,38 +7,146 @@ /** * */ - title: string; + title?: string; /** * */ - equId: number | string; - status: string; + equId?: number | string; + equName?: string; + assetNo?: string; + status?: string; /** * */ - planTime: string; + planTime?: string; /** * 淇濆吇浜� */ - maintUser: number; + maintUser?: number; + orderCount?: number, + wcCount?: number, + dbyCount?: number, + byCount?: number, + dyzCount?: number, /** * 楠岃瘉浜� */ - verifyUser: number; - verifyTime: string; + verifyUser?: number; + verifyTime?: string; /** * 鐗硅浜嬮」 */ - specialNote: string; + specialNote?: string; /** * 澶囨敞 */ - remark: string; + remark?: string; } + +export interface MaintOrderVO { + /** + * + */ + id: number | string; + + /** + * + */ + equId?: number | string; + equName?: string; + assetNo?: string; + + /** + * 璁″垝琛ㄥ啑浣�-淇濆吇绫诲瀷锛堝瓧鍏革級 + */ + maintType?: string; + + /** + * 宸ヤ綔鎻忚堪 + */ + maintDesc?: string; + + /** + * 璁″垝琛ㄥ啑浣�-淇濆吇鍛ㄦ湡 + */ + maintCycle?: number; + + /** + * 璁″垝琛ㄥ啑浣�-淇濆吇鍛ㄦ湡鍗曚綅锛堝瓧鍏革級 + */ + maintCycleUnit?: string; + + /** + * 璁″垝琛ㄥ啑浣�- 淇濆吇瑙勫垯锛堝瓧鍏革級淇濆吇鏃堕棿璁$畻锛�1-鎸夊懆鏈� 2-鎸変笂娆′繚鍏绘椂闂� + */ + maintRule?: string; + + /** + * 璁″垝琛ㄥ啑浣�-淇濆吇浜� + */ + maintUser?: number; + maintUserName?: string; + + /** + * 璁″垝琛ㄥ啑浣�-淇濆吇閮ㄩ棬 + */ + maintDept?: number; + + /** + * 淇濆吇鍗曞彿 + */ + maintCode?: string; + maintName?: string; + + /** + * + */ + status?: string; + + verifyUser?: number; + /** + * 楠岃瘉浜� + */ + verifyUserName?: string; + + /** + * 淇濆吇璁″垝鏃堕棿 + */ + planTime?: number | string; + + /** + * 淇濆吇寮�濮嬫椂闂� + */ + startTime: any; + + /** + * 淇濆吇缁撴潫鏃堕棿 + */ + endTime: any; + + /** + * 璁″垝id + */ + planId?: number | string; + + /** + * 鍒涘缓鏃堕棿 + */ + createTime?: string; + + /** + * 澶囨敞 + */ + remark?: string; + +} + + + diff --git a/eims-ui-mobile/src/service/maint.ts b/eims-ui-mobile/src/service/maint.ts index 42197c2..4d1580b 100644 --- a/eims-ui-mobile/src/service/maint.ts +++ b/eims-ui-mobile/src/service/maint.ts @@ -1,5 +1,14 @@ import { http } from '@/utils/http' -import type { MaintStVO } from './maint.d' +import type { MaintStVO, MaintOrderVO } from './maint.d' +type ID = number | string + +/** + * 鏍规嵁id鏌ヨ姹囨�� + * @param id + */ +export const getMaintSt = (id: ID) => { + return http.get<MaintStVO>(`/eims/maintSt/${id}`) +} /** * 淇濆吇姹囨�诲垪琛� @@ -7,3 +16,26 @@ export const getMaintStList = (params: any) => { return http.get<MaintStVO[]>('/eims/maintSt/list', params) } + +/** + * 鏍规嵁id鏌ヨ宸ュ崟 + * @param id + */ +export const getMaintOrder = (id: ID) => { + return http.get<MaintOrderVO>(`/eims/maintOrder/${id}`) +} + +/** + * 淇濆吇姹囨�诲垪琛ㄤ笅淇濆吇宸ュ崟鍒楄〃 + */ +export const getMaintStOrderList = (params: any) => { + return http.get<MaintOrderVO[]>('/eims/maintOrder/detailList', params) +} + +/** + * 鏇存柊淇濆吇宸ュ崟 + * @param data + */ +export const updateMaintOrder = (data: any) => { + return http.put<void>('/eims/maintOrder', data) +} diff --git a/eims-ui-mobile/src/static/ico/ico-platform.png b/eims-ui-mobile/src/static/ico/ico-platform.png new file mode 100644 index 0000000..2e574b9 --- /dev/null +++ b/eims-ui-mobile/src/static/ico/ico-platform.png Binary files differ diff --git a/eims-ui-mobile/src/style/index.scss b/eims-ui-mobile/src/style/index.scss index ad6d70e..032124f 100644 --- a/eims-ui-mobile/src/style/index.scss +++ b/eims-ui-mobile/src/style/index.scss @@ -36,6 +36,13 @@ color: $uni-color-success; } +.icon-color-warning { + color: $uni-color-warning; +} +.icon-color-purple { + color: #824eed; +} + .bg-base { background: $uni-bg-color-grey; } diff --git a/eims-ui-mobile/src/types/uni-pages.d.ts b/eims-ui-mobile/src/types/uni-pages.d.ts index fefb929..23e19a1 100644 --- a/eims-ui-mobile/src/types/uni-pages.d.ts +++ b/eims-ui-mobile/src/types/uni-pages.d.ts @@ -11,7 +11,9 @@ "/pages/inspect/insp-record" | "/pages/inspect/insp-st" | "/pages/login/index" | + "/pages/maint/maint-order" | "/pages/maint/maint-st" | + "/pages/maint/order-detail" | "/pages/my/index" | "/pages/spare/index"; } diff --git a/eims-ui-mobile/src/utils/DateUtils.ts b/eims-ui-mobile/src/utils/DateUtils.ts new file mode 100644 index 0000000..84e9fb5 --- /dev/null +++ b/eims-ui-mobile/src/utils/DateUtils.ts @@ -0,0 +1,5 @@ +import dayjs from 'dayjs' + +export function formatDate(inputDate: Date) { + return dayjs(inputDate).format('YYYY-MM-DD HH:mm:ss') +} diff --git a/eims-ui-mobile/src/utils/RoleUtils.ts b/eims-ui-mobile/src/utils/RoleUtils.ts new file mode 100644 index 0000000..c1e77d4 --- /dev/null +++ b/eims-ui-mobile/src/utils/RoleUtils.ts @@ -0,0 +1,41 @@ +import { useUserStore } from '@/store' +// import { ROLE_OPERATOR, ROLE_REPAIR, ROLE_LEADER, ROLE_LINE, ROLE_SUPER_ADMIN } from '@/utils/constants' + +/** + * 瓒呯骇绠$悊鍛� + */ +export const ROLE_SUPER_ADMIN = 'superadmin' +/** + * 棰嗗 + */ +export const ROLE_LEADER = 'leader' +/** + * 鎿嶄綔鍛� + */ +export const ROLE_OPERATOR = 'operator' +/** + * 绾块暱 + */ +export const ROLE_LINE = 'line' +/** + * 缁翠慨鍛� + */ +export const ROLE_REPAIR = 'repair' + +/** + * 鐧诲綍瑙掕壊鏄搷浣滃伐鎴栫淮淇伐 + */ +export const isOperatorOrRepair = () => { + const roles = useUserStore()?.userInfo?.roles || [] + return roles.includes(ROLE_OPERATOR) || roles.includes(ROLE_REPAIR) +} + +/** + * 鐧诲綍瑙掕壊鏄搷浣滃伐鎴栫淮淇伐 + */ +export const isLeader = () => { + const roles = useUserStore()?.userInfo?.roles || [] + return ( + roles.includes(ROLE_LINE) || roles.includes(ROLE_SUPER_ADMIN) || roles.includes(ROLE_LEADER) + ) +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintOrderServiceImpl.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintOrderServiceImpl.java index 4b23e57..4f6bf77 100644 --- a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintOrderServiceImpl.java +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintOrderServiceImpl.java @@ -21,7 +21,9 @@ 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.mapper.EimsEquMapper; import org.dromara.eims.mapper.EimsMaintPlanMapper; import org.dromara.system.domain.SysDept; import org.dromara.system.domain.vo.SysDeptVo; @@ -49,6 +51,7 @@ private final EimsMaintOrderMapper baseMapper; private final EimsMaintPlanMapper planMapper; private final SysDeptMapper sysDeptMapper; + private final EimsEquMapper equMapper; /** * 鏌ヨ淇濆吇宸ュ崟 @@ -58,7 +61,13 @@ */ @Override public EimsMaintOrderVo queryById(Long id){ - return baseMapper.selectVoById(id); + EimsMaintOrderVo orderVo = baseMapper.selectVoById(id); + EimsEquVo equVo = equMapper.selectVoById(orderVo.getEquId()); + if(equVo!=null){ + orderVo.setEquName(equVo.getEquName()); + orderVo.setAssetNo(equVo.getAssetNo()); + } + return orderVo; } /** -- Gitblit v1.9.3