From 89a5fedfe041ebacb2d81ecae1023b206cd3f353 Mon Sep 17 00:00:00 2001 From: baoshiwei <baoshiwei@shlanbao.cn> Date: 星期四, 24 四月 2025 09:10:37 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/main' --- eims-ui-mobile/src/service/menu.d.ts | 36 eims-ui-mobile/src/interceptors/request.ts | 8 eims-ui-mobile/src/service/equ.d.ts | 124 ++ eims-ui-mobile/src/static/menu/menu4.png | 0 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintOrderServiceImpl.java | 11 eims-ui-mobile/src/static/menu/menu5.png | 0 eims-ui-mobile/src/static/ico/ico-platform.png | 0 eims-ui-mobile/src/store/user.ts | 11 eims-ui-mobile/src/components/fg-tabbar/fg-tabbar.vue | 2 eims-ui-mobile/src/pages/inspect/insp-st.vue | 160 ++ eims-ui-mobile/src/static/menu/menu3.png | 0 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsInspectRecordServiceImpl.java | 17 eims-ui-mobile/src/utils/DateUtils.ts | 5 eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsInspectRecordMapper.xml | 2 eims-ui-mobile/pages.config.ts | 6 eims-ui-mobile/src/utils/http.ts | 50 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsInspectSt.java | 4 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/EimsInspectRecordController.java | 10 eims-ui-mobile/src/pages/inspect/insp-record.vue | 336 ++++++ eims-ui-mobile/src/store/index.ts | 2 eims-ui-mobile/src/style/index.scss | 37 eims-ui-mobile/src/service/maint.d.ts | 152 ++ eims-ui-mobile/src/static/menu/menu2.png | 0 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IEimsInspectRecordService.java | 2 eims-ui-mobile/src/service/equ.ts | 9 eims-ui-mobile/src/service/maint.ts | 41 eims-ui-mobile/src/static/menu/menu1.png | 0 eims-ui-mobile/src/static/images/pic4.jpeg | 0 eims-ui-mobile/src/static/images/camera.png | 0 eims-ui-mobile/src/pages/maint/order-detail.vue | 228 ++++ eims-ui-mobile/src/static/images/pic3.png | 0 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/InspectRecordBo.java | 13 eims-ui-mobile/src/pages/maint/maint-st.vue | 181 +++ eims-ui-mobile/src/static/menu/menu0.png | 0 eims-ui-mobile/src/pages/equ/index.vue | 1 eims-ui-mobile/src/uni.scss | 2 eims-ui/apps/web-antd/src/views/eims/insp-st/index.vue | 13 eims-ui-mobile/env/.env | 8 eims-ui/apps/web-antd/src/views/eims/spare-inoutdt/index.vue | 11 eims-ui-mobile/src/service/menu.ts | 6 eims-ui-mobile/src/static/images/pic1.png | 0 eims-ui-mobile/src/pages/inspect/insp-add.vue | 222 ++++ eims-ui-mobile/src/service/inspect.ts | 40 eims-ui-mobile/src/pages/login/index.vue | 144 ++ eims-ui-mobile/src/env.d.ts | 1 eims-ui-mobile/src/static/images/menu1.png | 0 eims-ui-mobile/src/pages/maint/maint-order.vue | 388 +++++++ eims-ui-mobile/src/service/inspect.d.ts | 150 ++ eims-ui-mobile/src/pages/spare/index.vue | 1 eims-ui-mobile/src/utils/RoleUtils.ts | 41 eims-ui-mobile/.eslintrc-auto-import.json | 17 eims-ui-mobile/src/types/uni-pages.d.ts | 7 eims-ui-mobile/src/store/access.ts | 79 + eims-ui-mobile/src/service/login.d.ts | 78 + eims-ui-mobile/src/service/login.ts | 24 eims-ui-mobile/src/types/auto-import.d.ts | 2 eims-ui-mobile/vite.config.ts | 1 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsInspectStServiceImpl.java | 39 eims-ui-mobile/src/pages/my/index.vue | 1 eims-ui/apps/web-antd/src/views/eims/insp-st/data.tsx | 19 eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsInspectStMapper.xml | 2 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsInspectStVo.java | 5 eims-ui-mobile/src/store/system-config.ts | 37 eims-ui-mobile/src/static/images/pic2.jpg | 0 eims-ui-mobile/src/static/ico/ico-ok.png | 0 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/mapper/EimsInspectRecordMapper.java | 1 eims-ui-mobile/src/pages.json | 76 + eims-ui-mobile/src/pages/equ/equ-list.vue | 150 ++ eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsInspectStBo.java | 7 eims-ui-mobile/src/pages/home/index.vue | 215 +++ eims-ui-mobile/src/interceptors/route.ts | 6 71 files changed, 3,149 insertions(+), 92 deletions(-) diff --git a/eims-ui-mobile/.eslintrc-auto-import.json b/eims-ui-mobile/.eslintrc-auto-import.json index 27df73d..ca20d5b 100644 --- a/eims-ui-mobile/.eslintrc-auto-import.json +++ b/eims-ui-mobile/.eslintrc-auto-import.json @@ -3,11 +3,14 @@ "Component": true, "ComponentPublicInstance": true, "ComputedRef": true, + "DirectiveBinding": true, "EffectScope": true, "ExtractDefaultPropTypes": true, "ExtractPropTypes": true, "ExtractPublicPropTypes": true, "InjectionKey": true, + "MaybeRef": true, + "MaybeRefOrGetter": true, "PropType": true, "Ref": true, "VNode": true, @@ -65,6 +68,7 @@ "onUnload": true, "onUnmounted": true, "onUpdated": true, + "onWatcherCleanup": true, "provide": true, "reactive": true, "readonly": true, @@ -82,20 +86,15 @@ "useAttrs": true, "useCssModule": true, "useCssVars": true, + "useId": true, + "useModel": true, "useRequest": true, "useSlots": true, + "useTemplateRef": true, "useUpload": true, - "useUpload2": true, "watch": true, "watchEffect": true, "watchPostEffect": true, - "watchSyncEffect": true, - "DirectiveBinding": true, - "MaybeRef": true, - "MaybeRefOrGetter": true, - "onWatcherCleanup": true, - "useId": true, - "useModel": true, - "useTemplateRef": true + "watchSyncEffect": true } } diff --git a/eims-ui-mobile/env/.env b/eims-ui-mobile/env/.env index 1d4b444..ba2fa4c 100644 --- a/eims-ui-mobile/env/.env +++ b/eims-ui-mobile/env/.env @@ -7,8 +7,8 @@ # h5閮ㄧ讲缃戠珯鐨刡ase锛岄厤缃埌 manifest.config.ts 閲岀殑 h5.router.base VITE_APP_PUBLIC_BASE=/ -VITE_SERVER_BASEURL = 'https://ukw0y1.laf.run' -VITE_UPLOAD_BASEURL = 'https://ukw0y1.laf.run/upload' +VITE_SERVER_BASEURL = 'http://192.168.12.33:8080' +VITE_UPLOAD_BASEURL = 'http://192.168.12.33:8080/resource/oss/upload' # 鏈変簺鍚屽鍙兘闇�瑕佸湪寰俊灏忕▼搴忛噷闈㈡牴鎹� develop銆乼rial銆乺elease 鍒嗗埆璁剧疆涓婁紶鍦板潃锛屽弬鑰冧唬鐮佸涓嬨�� # 涓嬮潰鐨勫彉閲忓鏋滄病鏈夎缃紝浼氶粯璁や娇鐢� VITE_SERVER_BASEURL or VITE_UPLOAD_BASEURL @@ -23,3 +23,7 @@ # h5鏄惁闇�瑕侀厤缃唬鐞� VITE_APP_PROXY=false VITE_APP_PROXY_PREFIX = '/api' + + +# 鍚庣鍙傛暟閰嶇疆 +VITE_APP_CLIENT_ID = '428a8310cd442757ae699df5d894f051' diff --git a/eims-ui-mobile/pages.config.ts b/eims-ui-mobile/pages.config.ts index 50eab64..c46f09f 100644 --- a/eims-ui-mobile/pages.config.ts +++ b/eims-ui-mobile/pages.config.ts @@ -4,8 +4,8 @@ globalStyle: { navigationStyle: 'default', navigationBarTitleText: '鍏板疂璁惧绠$悊', - navigationBarBackgroundColor: '#f8f8f8', - navigationBarTextStyle: 'black', + navigationBarBackgroundColor: '#4D80F0', + navigationBarTextStyle: 'white', backgroundColor: '#FFFFFF', }, easycom: { @@ -20,7 +20,7 @@ tabBar: { custom: true, color: '#999999', - selectedColor: '#007aff', + selectedColor: '#4D80F0', borderStyle: 'black', height: '50px', fontSize: '10px', diff --git a/eims-ui-mobile/src/components/fg-tabbar/fg-tabbar.vue b/eims-ui-mobile/src/components/fg-tabbar/fg-tabbar.vue index e8d12de..72675c5 100644 --- a/eims-ui-mobile/src/components/fg-tabbar/fg-tabbar.vue +++ b/eims-ui-mobile/src/components/fg-tabbar/fg-tabbar.vue @@ -6,7 +6,7 @@ safeAreaInsetBottom placeholder @change="selectTabBar" - active-color="#007aff" + active-color="#4D80F0" inactive-color="#7d7e80" > <block v-for="(item, idx) in tabbarList" :key="item.path"> diff --git a/eims-ui-mobile/src/env.d.ts b/eims-ui-mobile/src/env.d.ts index daea211..6d405bf 100644 --- a/eims-ui-mobile/src/env.d.ts +++ b/eims-ui-mobile/src/env.d.ts @@ -23,6 +23,7 @@ readonly VITE_UPLOAD_BASEURL: string /** 鏄惁娓呴櫎console */ readonly VITE_DELETE_CONSOLE: string + readonly VITE_APP_CLIENT_ID: string // 鏇村鐜鍙橀噺... } diff --git a/eims-ui-mobile/src/interceptors/request.ts b/eims-ui-mobile/src/interceptors/request.ts index 1f84b31..5ea4b62 100644 --- a/eims-ui-mobile/src/interceptors/request.ts +++ b/eims-ui-mobile/src/interceptors/request.ts @@ -1,8 +1,9 @@ /* eslint-disable no-param-reassign */ import qs from 'qs' -import { useUserStore } from '@/store' +import { useAccessStore } from '@/store' import { platform } from '@/utils/platform' import { getEnvBaseUrl } from '@/utils' +const clientId = import.meta.env.VITE_APP_CLIENT_ID export type CustomRequestOptions = UniApp.RequestOptions & { query?: Record<string, any> @@ -50,10 +51,11 @@ ...options.header, } // 3. 娣诲姞 token 璇锋眰澶存爣璇� - const userStore = useUserStore() - const { token } = userStore.userInfo as unknown as IUserInfo + const accessStore = useAccessStore() + const token = accessStore.accessInfo.access_token if (token) { options.header.Authorization = `Bearer ${token}` + options.header.clientid = clientId } }, } diff --git a/eims-ui-mobile/src/interceptors/route.ts b/eims-ui-mobile/src/interceptors/route.ts index ddd6c98..fe5bc2f 100644 --- a/eims-ui-mobile/src/interceptors/route.ts +++ b/eims-ui-mobile/src/interceptors/route.ts @@ -4,15 +4,15 @@ * 鍙互璁剧疆璺敱鐧藉悕鍗曪紝鎴栬�呴粦鍚嶅崟锛岀湅涓氬姟闇�瑕侀�夊摢涓�涓� * 鎴戣繖閲屽簲涓哄ぇ閮ㄥ垎閮藉彲浠ラ殢渚胯繘鍏ワ紝鎵�浠ヤ娇鐢ㄩ粦鍚嶅崟 */ -import { useUserStore } from '@/store' +import { useUserStore, useAccessStore } from '@/store' import { needLoginPages as _needLoginPages, getNeedLoginPages } from '@/utils' // TODO Check const loginRoute = '/pages/login/index' const isLogined = () => { - const userStore = useUserStore() - return userStore.isLogined + const accessStore = useAccessStore() + return accessStore.isLogined } const isDev = import.meta.env.DEV diff --git a/eims-ui-mobile/src/pages.json b/eims-ui-mobile/src/pages.json index d346a4b..3e3d43f 100644 --- a/eims-ui-mobile/src/pages.json +++ b/eims-ui-mobile/src/pages.json @@ -2,8 +2,8 @@ "globalStyle": { "navigationStyle": "default", "navigationBarTitleText": "鍏板疂璁惧绠$悊", - "navigationBarBackgroundColor": "#f8f8f8", - "navigationBarTextStyle": "black", + "navigationBarBackgroundColor": "#4D80F0", + "navigationBarTextStyle": "white", "backgroundColor": "#FFFFFF" }, "easycom": { @@ -16,7 +16,7 @@ "tabBar": { "custom": true, "color": "#999999", - "selectedColor": "#007aff", + "selectedColor": "#4D80F0", "borderStyle": "black", "height": "50px", "fontSize": "10px", @@ -60,16 +60,52 @@ "type": "home", "layout": "tabbar", "style": { - "navigationStyle": "custom", "navigationBarTitleText": "棣栭〉" + } + }, + { + "path": "pages/equ/equ-list", + "type": "page", + "layout": "default", + "needLogin": true, + "style": { + "navigationBarTitleText": "璁惧鍒楄〃" } }, { "path": "pages/equ/index", "type": "page", "layout": "tabbar", + "needLogin": true, "style": { "navigationBarTitleText": "鍏充簬" + } + }, + { + "path": "pages/inspect/insp-add", + "type": "page", + "layout": "default", + "style": { + "navigationBarTitleText": "璁惧鐐规" + } + }, + { + "path": "pages/inspect/insp-record", + "type": "page", + "needLogin": true, + "style": { + "navigationBarTitleText": "鐐规璁板綍", + "navigationStyle": "custom", + "navigationBarBackgroundColor": "#4D80F0" + } + }, + { + "path": "pages/inspect/insp-st", + "type": "page", + "layout": "default", + "needLogin": true, + "style": { + "navigationBarTitleText": "鐐规姹囨��" } }, { @@ -77,14 +113,43 @@ "type": "page", "layout": "default", "style": { - "navigationStyle": "custom", "navigationBarTitleText": "鐧诲綍" + } + }, + { + "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": "鎴戠殑" } @@ -93,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 new file mode 100644 index 0000000..0e6ff84 --- /dev/null +++ b/eims-ui-mobile/src/pages/equ/equ-list.vue @@ -0,0 +1,150 @@ +<route lang="json5" type="page"> +{ + layout: 'default', + needLogin: true, + style: { + navigationBarTitleText: '璁惧鍒楄〃', + }, +} +</route> +<template> + <z-paging ref="paging" v-model="dataList" @query="queryList" show-refresher-update-time> + <template #top> + <wd-drop-menu> + <wd-drop-menu-item v-model="equTypeId" :options="typeList" @change="handleEquType" /> + <wd-drop-menu-item v-model="status" :options="statusList" @change="handleEquStatu" /> + </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-baseline"> + <view class="flex items-center menu-title-box"> + <view class="menu-indicator"></view> + <text class="ml-1 text-xs">{{ item.assetNo }}</text> + </view> + + <view> + <text class="icon-color-base">璇︽儏</text> + <wd-icon name="arrow-right" custom-class="icon-color-base"></wd-icon> + </view> + </view> + </template> + <view class="flex h-[80rpx]" @click.stop="itemClick(item)"> + <image class="slot-img text-center" src="/static/images/camera.png" /> + <view> + <view class="text-color-base"> + {{ item.equName }} + <text class="text-color-gray ml-2 text-mini">{{ item.modelNo }}</text> + </view> + <view class="text-color-gray text-xs mt-1"> + {{ item.location }} | {{ item.madeIn }} + </view> + </view> + </view> + </wd-card> + </view> + </z-paging> +</template> + +<script setup lang="ts"> +import { onMounted, getCurrentInstance, ref } from 'vue' + +import { getEquList } from '@/service/equ' + +// 璁惧绫诲瀷 +const equTypeId = ref<number>(0) +// 璁惧鐘舵�� +const status = ref<number>(0) + +const isSelectEqu = ref(false) + +const typeList = ref<Record<string, any>[]>([{ label: '鎵�鏈夎澶�', value: 0 }]) +const statusList = ref<Record<string, any>[]>([{ label: '鎵�鏈夌姸鎬�', value: 0 }]) +function handleEquType({ value }) { + console.log(value) +} +function handleEquStatu({ value }) { + console.log(value) +} + +const paging = ref(null) +const dataList = ref([]) + +const queryList = (pageNum?: number, pageSize?: number) => { + // 杩欓噷鐨刾ageNo鍜宲ageSize浼氳嚜鍔ㄨ绠楀ソ锛岀洿鎺ヤ紶缁欐湇鍔″櫒鍗冲彲 + // 杩欓噷鐨勮姹傚彧鏄紨绀猴紝璇锋浛鎹㈡垚鑷繁鐨勯」鐩殑缃戠粶璇锋眰锛屽苟鍦ㄧ綉缁滆姹傚洖璋冧腑閫氳繃paging.value.complete(璇锋眰鍥炴潵鐨勬暟缁�)灏嗚姹傜粨鏋滀紶缁檢-paging + getEquList({ pageNum, pageSize }) + .then((res: any) => { + // 璇峰嬁鍦ㄧ綉缁滆姹傚洖璋冧腑缁檇ataList璧嬪�硷紒锛佸彧闇�瑕佽皟鐢╟omplete灏卞彲浠ヤ簡 + console.log(res) + paging.value.complete(res.rows) + }) + .catch((res) => { + // 濡傛灉璇锋眰澶辫触鍐檖aging.value.complete(false)锛屼細鑷姩灞曠ず閿欒椤甸潰 + // 娉ㄦ剰锛屾瘡娆¢兘闇�瑕佸湪catch涓啓杩欏彞璇濆緢楹荤儲锛寊-paging鎻愪緵浜嗘柟妗堝彲浠ュ叏灞�缁熶竴澶勭悊 + // 鍦ㄥ簳灞傜殑缃戠粶璇锋眰鎶涘嚭寮傚父鏃讹紝鍐檜ni.$emit('z-paging-error-emit');鍗冲彲 + paging.value.complete(false) + }) +} + +/** + * 璁惧鏉$洰鐐瑰嚮浜嬩欢 + * @param item + */ +function itemClick(item: any) { + if (isSelectEqu.value) { + emitSelectEqu(item) + uni.navigateBack() + } +} + +/** + * 閫夋嫨璁惧鍥炶皟 + * @param equ + */ +function emitSelectEqu(equ: any) { + eventChannel.value.emit('selectEqu', { + data: equ, + }) +} + + +const eventChannel = ref<any>() +onMounted(() => { + const instance: any = getCurrentInstance().proxy + const event = instance.getOpenerEventChannel() + eventChannel.value = event + event.on('handleSelectEqu', function (data) { + isSelectEqu.value = true + console.log('handleSelectEqu', data) + }) +}) +</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; +} +</style> diff --git a/eims-ui-mobile/src/pages/equ/index.vue b/eims-ui-mobile/src/pages/equ/index.vue index 8981478..bda1221 100644 --- a/eims-ui-mobile/src/pages/equ/index.vue +++ b/eims-ui-mobile/src/pages/equ/index.vue @@ -1,6 +1,7 @@ <route lang="json5"> { layout: 'tabbar', + needLogin: true, style: { navigationBarTitleText: '鍏充簬', }, diff --git a/eims-ui-mobile/src/pages/home/index.vue b/eims-ui-mobile/src/pages/home/index.vue index 2c10cbb..3351c06 100644 --- a/eims-ui-mobile/src/pages/home/index.vue +++ b/eims-ui-mobile/src/pages/home/index.vue @@ -3,37 +3,118 @@ { layout: 'tabbar', style: { - navigationStyle: 'custom', navigationBarTitleText: '棣栭〉', }, } </route> <template> <view - class="bg-white overflow-hidden pt-2 px-4" - :style="{ marginTop: safeAreaInsets?.top + 'px' }" + class="bg-base overflow-hidden" + :style="{ + marginTop: safeAreaInsets?.top + 'px', + }" > - <view class="mt-12"> - <image src="/static/logo.svg" alt="" class="w-28 h-28 block mx-auto" /> - </view> - <view class="text-center text-4xl main-title-color mt-4">unibest</view> - <view class="text-center text-2xl mt-2 mb-8">鏈�濂界敤鐨� uniapp 寮�鍙戞ā鏉�</view> + <view class="bg-white h-[80rpx] px-2 flex items-center justify-between"> + <view class="flex items-center" @click="handleUserInfo"> + <wd-icon name="user" size="40rpx" class="icon-color-base"></wd-icon> + <text class="ml-1 text-color-base">寮犱笁</text> + </view> - <view class="text-justify max-w-100 m-auto text-4 indent mb-2">{{ description }}</view> - <view class="text-center mt-8"> - 褰撳墠骞冲彴鏄細 - <text class="text-green-500">{{ PLATFORM.platform }}</text> + <view class="flex items-center"> + <wd-icon name="notification" size="40rpx" class="icon-color-base mr-3"></wd-icon> + <wd-icon name="tips" size="40rpx" class="icon-color-base mr-3"></wd-icon> + <wd-icon name="app" size="40rpx" class="icon-color-base"></wd-icon> + </view> </view> - <view class="text-center mt-4"> - 妯℃澘鍒嗘敮鏄細 - <text class="text-green-500">tabbar</text> + + <view class="bg-white py-2 px-2"> + <wd-img class="w-full h-[260rpx]" src="/static/images/pic4.jpeg" /> + </view> + <view class="bg-noti flex flex-row"> + <wd-notice-bar + text="杩欐槸涓�鏉℃秷鎭彁绀轰俊鎭紝杩欐槸涓�鏉℃秷鎭彁绀轰俊鎭紝杩欐槸涓�鏉℃秷鎭彁绀轰俊鎭�" + prefix="clock" + type="info" + :scrollable="false" + custom-class="flex-1 overflow-hidden" + /> + <wd-button type="text" class="w-[120rpx]">鏌ョ湅</wd-button> + </view> + + <view class="bg-white"> + <wd-card type="rectangle"> + <template #title> + <view class="flex items-center menu-title-box"> + <view class="menu-indicator"></view> + <view class="ml-1 text-xs">鏁版嵁鎬昏</view> + </view> + </template> + <view class="flex flex-row justify-around"> + <view class="flex flex-col justify-center"> + <text class="text-lg text-center">0</text> + <text class="text-color-gray">璁惧鎬绘暟</text> + </view> + <view class="flex flex-col justify-center"> + <text class="text-lg text-center">0</text> + <text class="text-color-gray">鏁呴殰璁惧鏁�</text> + </view> + <view class="flex flex-col justify-center"> + <text class="text-lg text-center">0</text> + <text class="text-color-gray">鏈慨澶嶆晠闅�</text> + </view> + </view> + </wd-card> + </view> + + <view class="bg-white mt-2"> + <wd-card type="rectangle"> + <template #title> + <view class="flex items-center menu-title-box"> + <view class="menu-indicator"></view> + <view class="ml-1 text-xs">璁惧绠$悊</view> + </view> + </template> + <wd-grid :column="4"> + <wd-grid-item + use-slot + class="flex justify-center items-center" + v-for="(item, index) in equMenu" + @click.stop="goItemPage(item.path)" + > + <image class="slot-img text-center" :src="item.icon" /> + <text>{{ item.name }}</text> + </wd-grid-item> + </wd-grid> + </wd-card> + </view> + + <view class="bg-white mt-2"> + <wd-card type="rectangle"> + <template #title> + <view class="flex items-center menu-title-box"> + <view class="menu-indicator"></view> + <view class="ml-1 text-xs">璁惧鐐规</view> + </view> + </template> + <wd-grid :column="4"> + <wd-grid-item + use-slot + class="flex justify-center items-center" + v-for="(item, index) in inspectMenu" + :key="item.id" + @click.stop="goItemPage(item.path)" + > + <image class="slot-img text-center" :src="item.icon" /> + <text>{{ item.name }}</text> + </wd-grid-item> + </wd-grid> + </wd-card> </view> </view> </template> <script lang="ts" setup> -import { TestEnum } from '@/typings' -import PLATFORM from '@/utils/platform' +import { getAllMenusApi } from '@/service/menu' defineOptions({ name: 'Home', @@ -41,19 +122,105 @@ // 鑾峰彇灞忓箷杈圭晫鍒板畨鍏ㄥ尯鍩熻窛绂� const { safeAreaInsets } = uni.getSystemInfoSync() -const author = ref('鑿查附') -const description = ref( - 'unibest 鏄竴涓泦鎴愪簡澶氱宸ュ叿鍜屾妧鏈殑 uniapp 寮�鍙戞ā鏉匡紝鐢� uniapp + Vue3 + Ts + Vite4 + UnoCss + UniUI + VSCode 鏋勫缓锛屾ā鏉垮叿鏈変唬鐮佹彁绀恒�佽嚜鍔ㄦ牸寮忓寲銆佺粺涓�閰嶇疆銆佷唬鐮佺墖娈电瓑鍔熻兘锛屽苟鍐呯疆浜嗚澶氬父鐢ㄧ殑鍩烘湰缁勪欢鍜屽熀鏈姛鑳斤紝璁╀綘缂栧啓 uniapp 鎷ユ湁 best 浣撻獙銆�', -) -// 娴嬭瘯 uni API 鑷姩寮曞叆 + +const getAllMenus = async () => { + const menuList = await getAllMenusApi() + console.error(menuList) +} + +const goItemPage = (path: string) => { + const url = `/${path}` + uni.navigateTo({ + url, + }) +} + onLoad(() => { - console.log(author) - console.log(TestEnum.A) + // getAllMenus() }) + +const equMenu = reactive([ + { + id: 1, + name: '璁惧绠$悊', + icon: '/static/menu/menu1.png', + path: 'pages/equ/equ-list', + } +]) + +const inspectMenu = reactive([ + /* { + id: 0, + name: '璁惧鐐规', + icon: '/static/menu/menu0.png', + path: 'pages/inspect/insp-add', + }, */ + { + id: 1, + name: '鐐规姹囨��', + icon: '/static/menu/menu2.png', + path: 'pages/inspect/insp-st', + }, + { + id: 2, + name: '淇濆吇姹囨��', + icon: '/static/menu/menu1.png', + path: 'pages/maint/maint-st', + }, + { + id: 3, + name: '鐐规璁板綍', + icon: '/static/menu/menu3.png', + path: 'pages/inspect/insp-record', + }, + { + id: 4, + name: '鐐规璁″垝', + icon: '/static/menu/menu4.png', + path: 'pages/inspect/insp-add', + }, +]) + +function handleUserInfo() { + getAllMenus() +} </script> <style lang="scss" scoped> .main-title-color { color: $uni-color-primary; } + +.bg-noti { + background: #f4f9ff; +} + +:deep(.wd-card) { + margin-bottom: 0; +} + +:deep(.wd-card__footer) { + padding: 0 !important; +} + +:deep(.wd-card__footer)::after { + height: 0 !important; +} + +.menu-title-box { + height: 30rpx; +} + +.menu-indicator { + width: 6rpx; + height: 24rpx; + border-radius: 10rpx; + background-color: $uni-color-primary; +} + +.slot-img { + width: 72rpx; + height: 72rpx; + margin-left: 4rpx; +} </style> diff --git a/eims-ui-mobile/src/pages/inspect/insp-add.vue b/eims-ui-mobile/src/pages/inspect/insp-add.vue new file mode 100644 index 0000000..7d513b3 --- /dev/null +++ b/eims-ui-mobile/src/pages/inspect/insp-add.vue @@ -0,0 +1,222 @@ +<route lang="json5" type="page"> +{ + layout: 'default', + style: { + navigationBarTitleText: '璁惧鐐规', + }, +} +</route> + +<template> + <view class="bg-base"> + <wd-form ref="form" :model="model" :rules="rules"> + <wd-cell-group custom-class="group" title="璁惧淇℃伅" border> + <wd-input + @click.stop="handleSelectEqu" + label="璁惧鍚嶇О" + label-width="200rpx" + prop="equId" + readonly + required + suffix-icon="arrow-right" + clearable + v-model="model.equId" + placeholder="璇烽�夋嫨璁惧" + @clicksuffixicon="handleSelectEqu" + /> + <!-- <wd-picker + label="璁惧鍚嶇О" + placeholder="璇烽�夎澶�" + label-width="200rpx" + prop="equId" + v-model="model.equId" + :columns="equList" + />--> + </wd-cell-group> + + <wd-cell-group custom-class="mt-2" title="鐐规淇℃伅" border> + <wd-picker + label="鐐规椤�" + placeholder="璇烽�夌偣妫�椤�" + label-width="200rpx" + prop="equId" + v-model="model.inspName" + :columns="equList" + /> + + <wd-input + label="鐐规缂栧彿" + placeholder="璇风敓鎴愮偣妫�缂栧彿" + label-width="200rpx" + v-model="model.inspCode" + prop="inspCode" + > + <template #suffix> + <wd-button size="small" @click.stop="handleInspCode">鐢熸垚</wd-button> + </template> + </wd-input> + + <wd-textarea + label="鐐规鎻忚堪" + label-width="200rpx" + type="textarea" + v-model="model.inspDesc" + auto-height + :maxlength="200" + show-word-limit + placeholder="璇疯緭鍏ョ偣妫�鎻忚堪" + clearable + prop="inspDesc" + /> + <wd-cell title="鐐规鍥剧墖" title-width="200rpx" prop="fileList"> + <wd-upload + :auto-upload="false" + :file-list="model.fileList" + :action="VITE_UPLOAD_BASEURL" + @change="handleFileChange" + ></wd-upload> + </wd-cell> + + <wd-calendar + label="璁″垝鏃ユ湡" + label-width="200rpx" + placeholder="璇烽�夋嫨鏃ユ湡" + prop="planTime" + v-model="model.planTime" + /> + <wd-datetime-picker + label="鐐规鏃堕棿" + label-width="200rpx" + placeholder="璇烽�夋嫨鏃堕棿" + prop="inspTime" + v-model="model.inspTime" + /> + </wd-cell-group> + + <view class="footer"> + <wd-button type="primary" size="large" @click="handleSubmit" block>鎻愪氦</wd-button> + </view> + </wd-form> + </view> +</template> +<script setup lang="ts"> +import { reactive, ref } from 'vue' +import { FormRules } from 'wot-design-uni/components/wd-form/types' +import { getEnvBaseUploadUrl } from '@/utils' + +const VITE_UPLOAD_BASEURL = `${getEnvBaseUploadUrl()}` + +const form = ref() +const model = reactive<{ + equId: string + inspName: string + inspCode: string + inspDesc: string + planTime: null | number + inspTime: number | string + fileList: [] +}>({ + equId: '', + inspName: '', + inspCode: '', + inspDesc: '', + planTime: null, + inspTime: '', + fileList: [], +}) +const rules: FormRules = { + equId: [ + { + required: true, + message: '璇烽�夋嫨璁惧', + }, + ], + inspName: [ + { + required: true, + message: '璇烽�夋嫨鐐规椤�', + }, + ], + inspCode: [ + { + required: true, + message: '璇疯緭鍏ョ偣妫�缂栫爜', + }, + ], + inspDesc: [ + { + required: true, + message: '璇疯緭鍏ョ偣妫�鎻忚堪', + }, + ], + fileList: [ + { + required: false, + message: '', + }, + ], +} + +const equList = ref<any[]>([ + { + value: '1', + label: '1#骞茬嚗鏈�', + }, + { + value: '2', + label: '1#骞茬嚗鏈�', + }, +]) + +/** + * 閫夋嫨璁惧 + */ +function handleSelectEqu() { + uni.navigateTo({ + url: '/pages/equ/equ-list', + events: { + // 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹� + selectEqu: function (data) { + console.log(data) + }, + }, + success: function (res) { + // 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹� + res.eventChannel.emit('handleSelectEqu', { data: '鐐规椤甸潰閫夋嫨璁惧' }) + }, + }) +} + +/** + * 鐢熸垚鐐规缂栧彿 + */ +function handleInspCode() { + console.error('鐢熸垚鐐规缂栫爜') +} + +/** + * 涓婁紶鐐规鍥剧墖 + * @param fileList + */ +function handleFileChange({ fileList }) { + model.fileList = fileList +} + +function handleSubmit() { + form.value + .validate() + .then(({ valid, errors }) => { + console.log(valid) + console.log(errors) + }) + .catch((error) => { + console.log(error, 'error') + }) +} +</script> +<style scoped lang="scss"> +.footer { + background: white; + padding: 60rpx 42rpx; +} +</style> diff --git a/eims-ui-mobile/src/pages/inspect/insp-record.vue b/eims-ui-mobile/src/pages/inspect/insp-record.vue new file mode 100644 index 0000000..620f323 --- /dev/null +++ b/eims-ui-mobile/src/pages/inspect/insp-record.vue @@ -0,0 +1,336 @@ +<route lang="json5"> +{ + 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-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">{{ inspSt.equName }}</view> + <view class="text-color-gray ml-2 text-mini">{{ inspSt.assetNo }}</view> + </view> + + <view class="flex items-center"> + <text class="text-color-gray text-mini">{{ inspSt.planTimeStr }}</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">鐐规鎬绘暟: {{ 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"> + <text class="mr-3">姝e父: {{ normalNum }}</text> + | + <text class="mx-3">寮傚父: {{ abNormalNum }}</text> + </view> + <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="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> + <template #title> + <text class="text-color-gray">鐐规椤�</text> + </template> + <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"> + <template #title="{ expanded, disabled, isFirst }"> + <view class="flex justify-between"> + <view class="flex justify-center items-center"> + <text class="text-sm">{{ item.inspName }}</text> + </view> + + <view class="flex items-center"> + <wd-radio-group + v-model="item.inspResult" + inline + shape="dot" + @change="inspResultClick(item)" + > + <wd-radio value="1">姝e父</wd-radio> + <wd-radio value="2">寮傚父</wd-radio> + </wd-radio-group> + <wd-icon + v-if="expanded" + name="arrow-up" + size="30rpx" + class="icon-color-gray" + ></wd-icon> + <wd-icon v-else name="arrow-down" size="30rpx" class="icon-color-gray"></wd-icon> + </view> + </view> + </template> + <view class="text-color-gray text-xs 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-[1rpx] bg-base"></view> + <wd-textarea + label="鐗硅浜嬮」" + label-width="200rpx" + type="textarea" + v-model="inspSt.specialNote" + auto-height + :maxlength="200" + show-word-limit + placeholder="璇疯緭鍏ョ壒璁颁簨椤�" + clearable + /> + </view> + </z-paging> +</template> + +<script setup lang="ts"> +import { ref } from 'vue' +import { useUserStore, useAccessStore, useSystemConfigStore } from '@/store' +import { getInspStRecordList, updateInspectSt, updateInspRecordBatch } from '@/service/inspect' +import { useToast, useMessage } from 'wot-design-uni' +import type { CollapseInstance } from 'wot-design-uni/components/wd-collapse/types' +const message = useMessage() +const toast = useToast() + +const collapseRef = ref<CollapseInstance>() +const isAllExpanded = ref(false) + +// 瀹氫箟鎺ュ彛 +interface QueryParams { + pageNum: number + pageSize: number + inspCode: string + status?: string +} + +interface InspSt { + id: string + inspCode: string + equName: string + assetNo: string + planTimeStr?: string + status: string + inspUser: number | string + specialNote: string +} + +const dataChange = ref(false) + +const userStore = useUserStore() + +const collSelects = ref<string[]>([]) + +// 鐐规姹囨�绘暟鎹�(涓婁釜椤甸潰浼犲��) +const inspSt = reactive<InspSt>({ + id: '', + inspCode: '', + equName: '', + assetNo: '', + planTimeStr: '', + status: '', + inspUser: '', + specialNote: '', +}) + +const paging = ref(null) +const dataList = ref([]) + +const queryList = (pageNum?: number, pageSize?: number) => { + // 杩欓噷鐨刾ageNo鍜宲ageSize浼氳嚜鍔ㄨ绠楀ソ锛岀洿鎺ヤ紶缁欐湇鍔″櫒鍗冲彲 + // 杩欓噷鐨勮姹傚彧鏄紨绀猴紝璇锋浛鎹㈡垚鑷繁鐨勯」鐩殑缃戠粶璇锋眰锛屽苟鍦ㄧ綉缁滆姹傚洖璋冧腑閫氳繃paging.value.complete(璇锋眰鍥炴潵鐨勬暟缁�)灏嗚姹傜粨鏋滀紶缁檢-paging + const params: QueryParams = { + pageNum, + pageSize, + inspCode: inspSt.inspCode, + } + + getInspStRecordList(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 inspResultClick(item: any) { + // userStore?.userInfo?.userId +} + +const goBack = () => { + uni.navigateBack() +} +function handleClickRight() { + handleConfirm() +} + +const toggleCollapse = () => { + isAllExpanded.value = !isAllExpanded.value + collapseRef.value.toggleAll(isAllExpanded.value) +} + +function handleConfirm() { + if (!dataChange.value) { + message.alert('璇锋搷浣滃悗鎻愪氦!') + return false + } + message + .confirm({ + msg: '纭畾鎻愪氦锛�', + title: '鎻愮ず', + beforeConfirm: ({ resolve }) => { + updateData(resolve) + }, + }) + .then(() => {}) + .catch((error) => { + console.log(error) + }) +} + +function updateData(resolve: any) { + const params = { + inspRecordList: dataList.value, + } + // 鏇存柊鐐规璁板綍 + updateInspRecordBatch(params) + .then((res: any) => { + updateInspSt(resolve) + }) + .catch((res) => { + console.error(res) + }) +} +function updateInspSt(resolve: any) { + // 鏇存柊鐐规姹囨�� + inspSt.status = '1' + updateInspectSt(inspSt) + .then((res: any) => { + paging.value.reload() + uni.$emit('insp-st-refresh') + resolve(true) + }) + .catch((res) => { + console.error(res) + }) +} + +/** + * 鐐规璁板綍鏉$洰鐐瑰嚮浜嬩欢 + * @param item + */ +function itemClick(item: any) {} + +watch( + () => [...dataList.value], // 浣跨敤鎵╁睍杩愮畻绗﹀垱寤烘柊鏁扮粍浠ヨЕ鍙戠洃鍚� + (newVal, oldVal) => { + if (oldVal.length > 0) { + dataChange.value = true + } + }, + { deep: true }, +) +onLoad((options) => { + inspSt.id = options.id + inspSt.inspCode = options.inspCode + inspSt.equName = options.equName + inspSt.assetNo = options.assetNo + inspSt.planTimeStr = options.planTimeStr + inspSt.specialNote = options?.specialNote + inspSt.inspUser = userStore?.userInfo?.userId +}) + +const dataCount = computed(() => dataList.value.length) +const checkCount = computed(() => dataList.value.filter((item) => item.status === '1').length) +const normalNum = computed(() => dataList.value.filter((item) => item.inspResult === '1').length) +const abNormalNum = computed(() => dataList.value.filter((item) => item.inspResult === '2').length) +</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/inspect/insp-st.vue b/eims-ui-mobile/src/pages/inspect/insp-st.vue new file mode 100644 index 0000000..748ab44 --- /dev/null +++ b/eims-ui-mobile/src/pages/inspect/insp-st.vue @@ -0,0 +1,160 @@ +<route lang="json5" type="page"> +{ + layout: 'default', + needLogin: true, + style: { + navigationBarTitleText: '鐐规姹囨��', + }, +} +</route> + +<template> + <z-paging ref="paging" v-model="dataList" @query="queryList" show-refresher-update-time> + <template #top> + <wd-drop-menu> + <wd-drop-menu-item v-model="viewMode" :options="viewModeList" @change="handleViewMode" /> + <wd-drop-menu-item v-model="equName" :options="equList" @change="handleEquName" /> + </wd-drop-menu> + <wd-divider></wd-divider> + </template> + <view class="bg-base"> + <view class="w-full h-[24rpx]"></view> + <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">{{ item.equName }}</view> + <view class="text-color-gray ml-2 text-mini">{{ item.assetNo }}</view> + </view> + + <view class="flex items-center"> + <text class="text-color-gray text-mini"> + {{ + viewMode === 'Day' ? item.planTimeStr : item?.planTimeStr?.substring(0, 7) || '' + }} + </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">鐐规鎬绘暟: {{ 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"> + <text class="mr-3">姝e父: {{ item.normalNum }}</text> + | + <text class="mx-3">寮傚父: {{ item.abNormalNum }}</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="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> + <wd-button size="small" icon="edit-outline" @click.stop="itemClick(item)">鏄庣粏</wd-button> + </view> + </wd-card> + </view> + </z-paging> +</template> + +<script setup lang="ts"> +import { ref } from 'vue' +import { getInspStList } from '@/service/inspect' +import { onShow } from '@dcloudio/uni-app' + +const viewMode = ref<string>('Day') +const equName = ref<string>('鎵�鏈夎澶�') + +const viewModeList = ref<Record<string, any>[]>([ + { label: '鏃ヨ鍥�', value: 'Day' }, + { label: '鏈堣鍥�', value: 'Month' }, +]) +const equList = ref<Record<string, any>[]>([{ label: '鎵�鏈夎澶�', value: '鎵�鏈夎澶�' }]) +function handleViewMode({ value }) { + reloadData() +} +function handleEquName({ value }) { + console.log(value) +} + +const paging = ref(null) +const dataList = ref([]) + +const queryList = (pageNum?: number, pageSize?: number) => { + // 杩欓噷鐨刾ageNo鍜宲ageSize浼氳嚜鍔ㄨ绠楀ソ锛岀洿鎺ヤ紶缁欐湇鍔″櫒鍗冲彲 + // 杩欓噷鐨勮姹傚彧鏄紨绀猴紝璇锋浛鎹㈡垚鑷繁鐨勯」鐩殑缃戠粶璇锋眰锛屽苟鍦ㄧ綉缁滆姹傚洖璋冧腑閫氳繃paging.value.complete(璇锋眰鍥炴潵鐨勬暟缁�)灏嗚姹傜粨鏋滀紶缁檢-paging + getInspStList({ pageNum, pageSize, viewMode: viewMode.value }) + .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) { + const inspCode = `${item.equId}_${item.planTime}_${viewMode.value}` + uni.navigateTo({ + url: `/pages/inspect/insp-record?id=${item.id}&inspCode=${inspCode}&specialNote=${item.specialNote ?? ''}&equName=${item.equName ?? ''}&assetNo=${item.assetNo ?? ''}&planTimeStr=${item.planTimeStr ?? ''}`, + }) +} + +function reloadData() { + paging.value.reload() +} +onLoad(() => { + uni.$on('insp-st-refresh', reloadData) +}) +onUnload(() => { + uni.$off('insp-st-refres', reloadData) +}) +</script> + +<style scoped lang="scss"> +.menu-title-box { +} + +.slot-img { + width: 72rpx; + height: 72rpx; + margin-right: 24rpx; +} +.statu-img { + width: 60rpx; + height: 40rpx; +} +.text-mini { + font-size: 22rpx; +} + +.menu-indicator { + width: 6rpx; + height: 26rpx; + border-radius: 10rpx; + background-color: $uni-color-primary; +} +:deep(.wd-card__footer) { + padding: 10rpx !important; +} +:deep(.wd-card__title-content) { + padding: 24rpx 0 !important; +} +</style> diff --git a/eims-ui-mobile/src/pages/login/index.vue b/eims-ui-mobile/src/pages/login/index.vue index 17c5a1d..bc68841 100644 --- a/eims-ui-mobile/src/pages/login/index.vue +++ b/eims-ui-mobile/src/pages/login/index.vue @@ -2,19 +2,153 @@ { layout: 'default', style: { - navigationStyle: 'custom', navigationBarTitleText: '鐧诲綍', }, } </route> -<script setup lang="ts"> - -</script> <template> + <wd-img class="w-full h-[260rpx]" src="/static/images/pic2.jpg" /> + <wd-form ref="form" :model="model" class="mt-2"> + <wd-cell-group border> + <wd-input + label="鐢ㄦ埛鍚�" + label-width="200rpx" + prop="username" + clearable + v-model="model.username" + placeholder="璇疯緭鍏ョ敤鎴峰悕" + :rules="[{ required: true, message: '璇峰~鍐欑敤鎴峰悕' }]" + /> + <wd-input + label="瀵嗙爜" + label-width="200rpx" + prop="password" + show-password + clearable + v-model="model.password" + placeholder="璇疯緭鍏ュ瘑鐮�" + :rules="[{ required: true, message: '璇峰~鍐欏瘑鐮�' }]" + /> + </wd-cell-group> + <view class="footer"> + <view> + <wd-checkbox v-model="rember" @change="handleChange"> + <text class="rember-text">璁颁綇瀵嗙爜</text> + </wd-checkbox> + </view> + <wd-button class="mt-6" type="primary" size="large" @click="handleSubmit" block> + 鎻愪氦 + </wd-button> + <view class="copyright-info"> + <text> + 涓婃捣鍏板疂浼犳劅绉戞妧鑲′唤鏈夐檺鍏徃 + </text> + + </view> + </view> + </wd-form> </template> -<style scoped lang="scss"> +<script setup lang="ts"> +import { currRoute } from '@/utils' +import { useUserStore, useAccessStore, useSystemConfigStore } from '@/store' +import { useToast } from 'wot-design-uni' +import { login, getUserInfo } from '@/service/login' +import type { UserInfo } from '@/service/login.d' +import { TestEnum } from '@/typings' +const userStore = useUserStore() +const accessStore = useAccessStore() +const configStore = useSystemConfigStore() +const { success: showSuccess } = useToast() +const model = reactive<{ + username: string + password: string +}>({ + username: '', + password: '', +}) +const rember = ref<boolean>(false) + +function handleChange({ value }) { + console.log(value) +} + +const form = ref() +function handleSubmit() { + form.value + .validate() + .then(({ valid, errors }) => { + if (valid) { + toLogin() + } + }) + .catch((error) => { + console.log(error, 'error') + }) +} + +onLoad(() => { + const { remberPassword, username, password } = configStore.systemConfigInfo + if (remberPassword) { + rember.value = true + model.username = username + model.password = password + } +}) + +const toLogin = async () => { + // 璁颁綇瀵嗙爜 + if (rember.value) { + configStore.setConfigInfo({ ...model, ...{ remberPassword: true } }) + } + + const res = await login(model) + accessStore.setAccessInfo(res as any) + const backUserInfo: any = await getUserInfo() + /** + * 鐧诲綍瓒呮椂鐨勬儏鍐� + */ + if (!backUserInfo) { + throw new Error('鑾峰彇鐢ㄦ埛淇℃伅澶辫触.') + } + const { permissions = [], roles = [], user } = backUserInfo + /** + * 浠庡悗鍙皍ser -> vben user杞崲 + */ + const userInfo: UserInfo = { + avatar: user.avatar ?? '', + permissions, + realName: user.nickName, + roles, + userId: user.userId, + deptId: user.deptId, + username: user.userName, + } + userStore.setUserInfo(userInfo) + const { query } = currRoute() + uni.switchTab({ url: query.redirect }) +} +</script> + +<style scoped lang="scss"> +.footer { + padding: 24rpx; +} +.rember-text { + font-size: 24rpx; + color: $uni-text-color-grey; +} + +.copyright-info { + position: absolute; + bottom: 20rpx; + width: 100%; + display: flex; + justify-content: center; + color: $uni-text-color-disable; + font-size: 24rpx; +} </style> 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 new file mode 100644 index 0000000..e267621 --- /dev/null +++ b/eims-ui-mobile/src/pages/maint/maint-st.vue @@ -0,0 +1,181 @@ +<route lang="json5" type="page"> +{ + layout: 'default', + needLogin: true, + style: { + navigationBarTitleText: '淇濆吇姹囨��', + }, +} +</route> + +<template> + <z-paging ref="paging" v-model="dataList" @query="queryList" show-refresher-update-time> + <template #top> + <wd-drop-menu> + <wd-drop-menu-item v-model="equName" :options="equList" @change="handleEquName" /> + <wd-drop-menu-item v-model="status" :options="statusList" @change="handleStatus" /> + </wd-drop-menu> + <wd-divider></wd-divider> + </template> + <view class="bg-base"> + <view class="w-full h-[24rpx]"></view> + <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.equName" :lines="1"></wd-text> + </view> + <view class="text-color-gray ml-2 text-mini">{{ item.assetNo }}</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-[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">宸ュ崟鎬绘暟: {{ item.orderCount }}</text> + | + <text class="mx-3">宸插畬鎴�: {{ item.wcCount }}</text> + </view> + <view class="text-color-gray text-xs 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"> + <text>鐘舵�侊細</text> + <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> + <wd-icon class="icon-color-base" name="detection" size="40rpx"></wd-icon> + <text class="ml-1">杩涜涓�</text> + </template> + </view> + </view> + <wd-button size="small" icon="edit-outline" @click.stop="itemClick(item)">鏄庣粏</wd-button> + </view> + </wd-card> + </view> + </z-paging> +</template> + +<script setup lang="ts"> +import { ref } from 'vue' +import { getMaintStList } from '@/service/maint' + +interface QueryParams { + pageNum: number + pageSize: number + equName?: string + status?: string +} + +const status = ref<string>('-1') +const equName = ref<string>('-1') + +const statusList = ref<Record<string, any>[]>([ + { label: '鎵�鏈夌姸鎬�', value: '-1' }, + { label: '寰呬繚鍏�', value: '0' }, + { label: '淇濆吇涓�', value: '1' }, + { label: '寰呴獙璇�', value: '2' }, + { label: '宸插畬鎴�', value: '3' }, +]) +const equList = ref<Record<string, any>[]>([{ label: '鎵�鏈夎澶�', value: '-1' }]) +function handleStatus({ value }) {} +function handleEquName({ value }) { + console.log(value) +} + +const paging = ref(null) +const dataList = ref([]) + +const queryList = (pageNum?: number, pageSize?: number) => { + // 杩欓噷鐨刾ageNo鍜宲ageSize浼氳嚜鍔ㄨ绠楀ソ锛岀洿鎺ヤ紶缁欐湇鍔″櫒鍗冲彲 + // 杩欓噷鐨勮姹傚彧鏄紨绀猴紝璇锋浛鎹㈡垚鑷繁鐨勯」鐩殑缃戠粶璇锋眰锛屽苟鍦ㄧ綉缁滆姹傚洖璋冧腑閫氳繃paging.value.complete(璇锋眰鍥炴潵鐨勬暟缁�)灏嗚姹傜粨鏋滀紶缁檢-paging + const params: QueryParams = { + pageNum, + pageSize, + equName: equName.value, + status: status.value, + } + if (equName.value === '-1') { + delete params.equName + } + if (status.value === '-1') { + delete params.status + } + + getMaintStList(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) { + const itemString = encodeURIComponent(JSON.stringify(item)) + uni.navigateTo({ + url: `/pages/maint/maint-order?maintSt=${itemString}`, + }) +} + +function reloadData() { + paging.value.reload() +} +onLoad(() => { + queryList() + uni.$on('maint-st-refresh', reloadData) +}) +onUnload(() => { + uni.$off('maint-st-refres', reloadData) +}) +</script> + +<style scoped lang="scss"> +.menu-title-box { +} + +.slot-img { + width: 72rpx; + height: 72rpx; + margin-right: 24rpx; +} +.statu-img { + width: 60rpx; + height: 40rpx; +} +.text-mini { + font-size: 22rpx; +} + +.menu-indicator { + width: 6rpx; + height: 26rpx; + border-radius: 10rpx; + background-color: $uni-color-primary; +} +:deep(.wd-card__footer) { + padding: 10rpx !important; +} +:deep(.wd-card__title-content) { + padding: 24rpx 0 !important; +} +</style> 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/equ.d.ts b/eims-ui-mobile/src/service/equ.d.ts new file mode 100644 index 0000000..7807f19 --- /dev/null +++ b/eims-ui-mobile/src/service/equ.d.ts @@ -0,0 +1,124 @@ +export interface EquVO { + /** + * + */ + equId: number | string; + + /** + * 璧勪骇缂栧彿 + */ + assetNo: string; + /** + * 璁惧缂栫爜 + */ + equCode: string; + + /** + * 璁惧鍚嶇О + + */ + equName: string; + /** + * 璁惧绫诲瀷 + + */ + equTypeName: string; + + /** + * 鍨嬪彿 + */ + modelNo: string; + + /** + * 鍒堕�犲晢 + */ + madeIn: string; + + /** + * 棰濆害鍔熺巼 + */ + ratedPower: number; + + /** + * 閾墝淇℃伅 + */ + plateInfo: string; + + /** + * 閲囪喘鏃ユ湡 + */ + purchaseDate: string; + + /** + * 鐘舵�� + */ + status: string; + + /** + * 鎵�鍦ㄥ満鎵� + */ + location: string; + + /** + * 浣跨敤閮ㄩ棬锛堝叧鑱攊d锛� + */ + deptUsed: number; + /** + * 浣跨敤閮ㄩ棬鍚嶇О + */ + deptName: number; + + /** + * 璐d换浜�(鍏宠仈id) + */ + respPerson: number; + /** + * 璐d换浜� + */ + respPersonName: string; + + /** + * 鑱旂郴鐢佃瘽 + */ + contactPhone: string; + + /** + * 姝e紡浣跨敤鏃ユ湡 + */ + deployDate: string; + + /** + * 寮�濮嬭瘯鐢ㄦ棩鏈� + */ + trialDate: string; + + /** + * 璁″垝楠屾敹鏃ユ湡 + */ + planAcceptDate: string; + + /** + * 瀹為檯楠屾敹鏃ユ湡 + */ + actualAcceptDate: string; + + /** + * 瀵煎叆鐘舵�侊紙瀛楀吀锛� + */ + importStatus: number; + + /** + * 鐩樼偣鏍囧織 + */ + inventoryFlag: number; + + /** + * 涓婃鐩樼偣鏃ユ湡 + */ + inventoryDate: string; + + /** + * 浣跨敤骞撮檺 + */ + serviceLife: number; +} diff --git a/eims-ui-mobile/src/service/equ.ts b/eims-ui-mobile/src/service/equ.ts new file mode 100644 index 0000000..429e521 --- /dev/null +++ b/eims-ui-mobile/src/service/equ.ts @@ -0,0 +1,9 @@ +import { http } from '@/utils/http' +import type { EquVO } from './equ.d' + +/** + * 璁惧鍒楄〃 + */ +export const getEquList = (params: any) => { + return http.get<EquVO[]>('/eims/equ/list', params) +} diff --git a/eims-ui-mobile/src/service/inspect.d.ts b/eims-ui-mobile/src/service/inspect.d.ts new file mode 100644 index 0000000..69b0430 --- /dev/null +++ b/eims-ui-mobile/src/service/inspect.d.ts @@ -0,0 +1,150 @@ +/** + * 鐐规姹囨�� + */ +export interface InspectStVO { + /** + * + */ + id: number | string; + + /** + * + */ + title: string; + + /** + * + */ + equId: number | string; + status: string; + + /** + * + */ + planTime: string; + + /** + * 淇濆吇浜� + */ + maintUser: number; + + /** + * 楠岃瘉浜� + */ + verifyUser: number; + verifyTime: string; + + /** + * 鐗硅浜嬮」 + */ + specialNote: string; + + /** + * 澶囨敞 + */ + remark: string; +} + + +/** + * 鐐规璁板綍 + */ +export interface InspectRecordVO { + /** + * id + */ + id: string | number; + + /** + * 璁惧di + */ + equId: string | number; + /** + * 璁惧鍚嶇О + + */ + equName: string; + /** + * 璧勪骇缂栧彿 + + */ + assteNo: string; + + /** + * 鐐规鍚嶇О + */ + inspName: string; + + /** + * 鐐规鎻忚堪 + */ + inspDesc: string; + + /** + * 鐘舵�� + */ + status: string; + + /** + * 鐐规缂栫爜 + */ + inspCode: string; + + /** + * 鍊艰褰曟柟寮忥紙瀛楀吀锛� + */ + recordMode: string; + + /** + * 鍙傝�冨�� + */ + referenceValue: string; + + /** + * 涓婇檺 + */ + upperLimit: string; + + /** + * 涓嬮檺 + */ + lowLimit: string; + + /** + * 妫�鏌ュ�� + */ + checkValue: string; + + /** + * 鐐规缁撴灉锛堝瓧鍏革級 + */ + inspResult: string; + + /** + * 鐐规鏃堕棿 + */ + inspTime: string; + + /** + * 璁″垝鐐规鏃ユ湡 + */ + planTime: string; + + /** + * 楠岃瘉浜� + */ + verifyUser: number; + + /** + * 璁″垝id + */ + planId: string | number; + + /** + * 澶囨敞 + */ + remark: string; + +} + + diff --git a/eims-ui-mobile/src/service/inspect.ts b/eims-ui-mobile/src/service/inspect.ts new file mode 100644 index 0000000..adf4fa6 --- /dev/null +++ b/eims-ui-mobile/src/service/inspect.ts @@ -0,0 +1,40 @@ +import { http } from '@/utils/http' +import type { InspectStVO, InspectRecordVO } from './inspect.d' + +/** + * 鐐规姹囨�诲垪琛� + */ +export const getInspStList = (params: any) => { + return http.get<InspectStVO[]>('/eims/inspectSt/list', params) +} + +/** + * 鐐规姹囨�诲垪琛ㄤ笅鐐规璁板綍鍒楄〃 + */ +export const getInspStRecordList = (params: any) => { + return http.get<InspectRecordVO[]>('/eims/inspRecord/stList', params) +} + +/** + * 鏇存柊鐐规璁板綍 + * @param data + */ +export const updateInspRecord = (data: any) => { + return http.put<void>('/eims/inspRecord', data) +} + +/** + * 鎵归噺鏇存柊鐐规璁板綍 + * @param data + */ +export const updateInspRecordBatch = (data: any) => { + return http.put<void>('/eims/inspRecord/editBatch', data) +} + +/** + * 鏇存柊鐐规姹囨�� + * @param data + */ +export const updateInspectSt = (data: any) => { + return http.put<void>('/eims/inspectSt', data) +} diff --git a/eims-ui-mobile/src/service/login.d.ts b/eims-ui-mobile/src/service/login.d.ts new file mode 100644 index 0000000..1b73077 --- /dev/null +++ b/eims-ui-mobile/src/service/login.d.ts @@ -0,0 +1,78 @@ +export interface LoginParams { + username: string; + password: string; + clientId?: string; + tenantId?: string; + grantType?: string; +} + + +export interface User { + avatar: string; + createTime: string; + deptId: number; + deptName: string; + email: string; + loginDate: string; + loginIp: string; + nickName: string; + phonenumber: string; + remark: string; + roles: Role[]; + sex: string; + status: string; + tenantId: string; + userId: number; + userName: string; + userType: string; +} + + +export interface UserInfoResp { + permissions: string[]; + roles: string[]; + user: User; +} + + + +interface BasicUserInfo { + /** + * 澶村儚 + */ + avatar: string; + /** + * 閮ㄩ棬id + */ + deptId: number; + /** + * 鐢ㄦ埛鏉冮檺 + */ + permissions: string[]; + /** + * 鐢ㄦ埛鏄电О + */ + realName: string; + /** + * 鐢ㄦ埛瑙掕壊 + */ + roles: string[]; + /** + * 鐢ㄦ埛id + */ + userId: number | string; + + /** + * 鐢ㄦ埛鍚� + */ + username: string; +} + + +/** 鐢ㄦ埛淇℃伅 */ +interface UserInfo extends BasicUserInfo { + /** + * 鎷撳睍浣跨敤 + */ + [key: string]: any; +} diff --git a/eims-ui-mobile/src/service/login.ts b/eims-ui-mobile/src/service/login.ts new file mode 100644 index 0000000..330a514 --- /dev/null +++ b/eims-ui-mobile/src/service/login.ts @@ -0,0 +1,24 @@ +import { http } from '@/utils/http' +import type { LoginParams, UserInfoResp } from './login.d' +const clientId = import.meta.env.VITE_APP_CLIENT_ID + +const DEFAULT_TENANT_ID = '000000' +const GRANT_TYPE = 'password' + +/** get 璇锋眰 */ +export const login = (params: LoginParams) => { + const { username, password } = params + // 鏋勯�犳柊鐨勮姹傚弬鏁帮紝閬垮厤鐩存帴淇敼鍘熷瀵硅薄 + const requestData = { + username, + password, + clientId, + tenantId: DEFAULT_TENANT_ID, + grantType: GRANT_TYPE, + } + return http.post<any>('/auth/login', requestData) +} + +export const getUserInfo = () => { + return http.get<null | UserInfoResp>('/system/user/getInfo') +} diff --git a/eims-ui-mobile/src/service/maint.d.ts b/eims-ui-mobile/src/service/maint.d.ts new file mode 100644 index 0000000..5571883 --- /dev/null +++ b/eims-ui-mobile/src/service/maint.d.ts @@ -0,0 +1,152 @@ +export interface MaintStVO { + /** + * + */ + id: number | string; + + /** + * + */ + title?: string; + + /** + * + */ + equId?: number | string; + equName?: string; + assetNo?: string; + status?: string; + + /** + * + */ + planTime?: string; + + /** + * 淇濆吇浜� + */ + maintUser?: number; + orderCount?: number, + wcCount?: number, + dbyCount?: number, + byCount?: number, + dyzCount?: number, + + /** + * 楠岃瘉浜� + */ + verifyUser?: number; + verifyTime?: string; + + /** + * 鐗硅浜嬮」 + */ + specialNote?: 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 new file mode 100644 index 0000000..4d1580b --- /dev/null +++ b/eims-ui-mobile/src/service/maint.ts @@ -0,0 +1,41 @@ +import { http } from '@/utils/http' +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}`) +} + +/** + * 淇濆吇姹囨�诲垪琛� + */ +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/service/menu.d.ts b/eims-ui-mobile/src/service/menu.d.ts new file mode 100644 index 0000000..05683d4 --- /dev/null +++ b/eims-ui-mobile/src/service/menu.d.ts @@ -0,0 +1,36 @@ +/** + * @description: 鑿滃崟meta + * @param title 鑿滃崟鍚� + * @param icon 鑿滃崟鍥炬爣 + * @param noCache 鏄惁涓嶇紦瀛� + * @param link 澶栭摼閾炬帴 + */ +export interface MenuMeta { + icon: string; + link?: string; + noCache: boolean; + title: string; +} + +/** + * @description: 鑿滃崟 + * @param name 鑿滃崟鍚� + * @param path 鑿滃崟璺緞 + * @param hidden 鏄惁闅愯棌 + * @param component 缁勪欢鍚嶇О Laout + * @param alwaysShow 鎬绘槸鏄剧ず + * @param query 璺敱鍙傛暟(json褰㈠紡) + * @param meta 璺敱淇℃伅 + * @param children 瀛愯矾鐢变俊鎭� + */ +export interface Menu { + alwaysShow?: boolean; + children: Menu[]; + component: string; + hidden: boolean; + meta: MenuMeta; + name: string; + path: string; + query?: string; + redirect?: string; +} diff --git a/eims-ui-mobile/src/service/menu.ts b/eims-ui-mobile/src/service/menu.ts new file mode 100644 index 0000000..852a126 --- /dev/null +++ b/eims-ui-mobile/src/service/menu.ts @@ -0,0 +1,6 @@ +import { http } from '@/utils/http' +import type { Menu } from './menu.d' + +export const getAllMenusApi = () => { + return http.get<Menu>('/system/menu/getRouters') +} diff --git a/eims-ui-mobile/src/static/ico/ico-ok.png b/eims-ui-mobile/src/static/ico/ico-ok.png new file mode 100644 index 0000000..8e4eddb --- /dev/null +++ b/eims-ui-mobile/src/static/ico/ico-ok.png Binary files differ 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/static/images/camera.png b/eims-ui-mobile/src/static/images/camera.png new file mode 100644 index 0000000..cbe7fa2 --- /dev/null +++ b/eims-ui-mobile/src/static/images/camera.png Binary files differ diff --git a/eims-ui-mobile/src/static/images/menu1.png b/eims-ui-mobile/src/static/images/menu1.png new file mode 100644 index 0000000..6f2fa77 --- /dev/null +++ b/eims-ui-mobile/src/static/images/menu1.png Binary files differ diff --git a/eims-ui-mobile/src/static/images/pic1.png b/eims-ui-mobile/src/static/images/pic1.png new file mode 100644 index 0000000..90f69dd --- /dev/null +++ b/eims-ui-mobile/src/static/images/pic1.png Binary files differ diff --git a/eims-ui-mobile/src/static/images/pic2.jpg b/eims-ui-mobile/src/static/images/pic2.jpg new file mode 100644 index 0000000..f4134d9 --- /dev/null +++ b/eims-ui-mobile/src/static/images/pic2.jpg Binary files differ diff --git a/eims-ui-mobile/src/static/images/pic3.png b/eims-ui-mobile/src/static/images/pic3.png new file mode 100644 index 0000000..a15b54f --- /dev/null +++ b/eims-ui-mobile/src/static/images/pic3.png Binary files differ diff --git a/eims-ui-mobile/src/static/images/pic4.jpeg b/eims-ui-mobile/src/static/images/pic4.jpeg new file mode 100644 index 0000000..439d18e --- /dev/null +++ b/eims-ui-mobile/src/static/images/pic4.jpeg Binary files differ diff --git a/eims-ui-mobile/src/static/menu/menu0.png b/eims-ui-mobile/src/static/menu/menu0.png new file mode 100644 index 0000000..9e978e4 --- /dev/null +++ b/eims-ui-mobile/src/static/menu/menu0.png Binary files differ diff --git a/eims-ui-mobile/src/static/menu/menu1.png b/eims-ui-mobile/src/static/menu/menu1.png new file mode 100644 index 0000000..733c5b6 --- /dev/null +++ b/eims-ui-mobile/src/static/menu/menu1.png Binary files differ diff --git a/eims-ui-mobile/src/static/menu/menu2.png b/eims-ui-mobile/src/static/menu/menu2.png new file mode 100644 index 0000000..c9948fe --- /dev/null +++ b/eims-ui-mobile/src/static/menu/menu2.png Binary files differ diff --git a/eims-ui-mobile/src/static/menu/menu3.png b/eims-ui-mobile/src/static/menu/menu3.png new file mode 100644 index 0000000..b9eb77d --- /dev/null +++ b/eims-ui-mobile/src/static/menu/menu3.png Binary files differ diff --git a/eims-ui-mobile/src/static/menu/menu4.png b/eims-ui-mobile/src/static/menu/menu4.png new file mode 100644 index 0000000..9cf1e31 --- /dev/null +++ b/eims-ui-mobile/src/static/menu/menu4.png Binary files differ diff --git a/eims-ui-mobile/src/static/menu/menu5.png b/eims-ui-mobile/src/static/menu/menu5.png new file mode 100644 index 0000000..9dbf0f6 --- /dev/null +++ b/eims-ui-mobile/src/static/menu/menu5.png Binary files differ diff --git a/eims-ui-mobile/src/store/access.ts b/eims-ui-mobile/src/store/access.ts new file mode 100644 index 0000000..1f0a631 --- /dev/null +++ b/eims-ui-mobile/src/store/access.ts @@ -0,0 +1,79 @@ +import { defineStore } from 'pinia' +import { ref } from 'vue' + +type AccessToken = null | string +const initState = { + access_codes: [], + access_menus: [], + access_routes: [], + access_token: null, + is_access_checked: false, + login_expired: false, + refresh_token: null, +} + +interface AccessInfo { + /** + * 鏉冮檺鐮� + */ + access_codes: string[] + /** + * 鍙闂殑鑿滃崟鍒楄〃 + */ + access_menus: string[] + /** + * 鍙闂殑璺敱鍒楄〃 + */ + access_routes: string[] + /** + * 鐧诲綍 accessToken + */ + access_token: AccessToken + /** + * 鏄惁宸茬粡妫�鏌ヨ繃鏉冮檺 + */ + is_access_checked: boolean + /** + * 鐧诲綍鏄惁杩囨湡 + */ + login_expired: boolean + /** + * 鐧诲綍 accessToken + */ + refresh_token: AccessToken +} + +export const useAccessStore = defineStore( + 'accessInfo', + () => { + const accessInfo = ref<AccessInfo>({ ...initState }) + + const setAccessInfo = (val: AccessInfo) => { + accessInfo.value = val + } + const setAccessToken = (val: AccessToken) => { + accessInfo.value.access_token = val + } + + const clearAccessInfo = () => { + accessInfo.value = { ...initState } + } + // 涓�鑸病鏈塺eset闇�姹傦紝涓嶉渶瑕佺殑鍙互鍒犻櫎 + const reset = () => { + accessInfo.value = { ...initState } + } + const isLogined = computed(() => !!accessInfo.value.access_token) + + return { + accessInfo, + setAccessInfo, + setAccessToken, + clearAccessInfo, + isLogined, + reset, + } + }, + { + persist: true, + }, +) diff --git a/eims-ui-mobile/src/store/index.ts b/eims-ui-mobile/src/store/index.ts index 74b1b2f..c3bf4d9 100644 --- a/eims-ui-mobile/src/store/index.ts +++ b/eims-ui-mobile/src/store/index.ts @@ -15,3 +15,5 @@ // 妯″潡缁熶竴瀵煎嚭 export * from './user' +export * from './access' +export * from './system-config' diff --git a/eims-ui-mobile/src/store/system-config.ts b/eims-ui-mobile/src/store/system-config.ts new file mode 100644 index 0000000..024183f --- /dev/null +++ b/eims-ui-mobile/src/store/system-config.ts @@ -0,0 +1,37 @@ +import { defineStore } from 'pinia' +import { ref } from 'vue' + +const initState = { + remberPassword: false, + username: '', + password: '', +} + +export const useSystemConfigStore = defineStore( + 'systemConfig', + () => { + const systemConfigInfo = ref<any>({ ...initState }) + + const setConfigInfo = (val: any) => { + systemConfigInfo.value = val + } + + const clearConfigInfo = () => { + systemConfigInfo.value = { ...initState } + } + // 涓�鑸病鏈塺eset闇�姹傦紝涓嶉渶瑕佺殑鍙互鍒犻櫎 + const reset = () => { + systemConfigInfo.value = { ...initState } + } + + return { + systemConfigInfo, + setConfigInfo, + clearConfigInfo, + reset, + } + }, + { + persist: true, + }, +) diff --git a/eims-ui-mobile/src/store/user.ts b/eims-ui-mobile/src/store/user.ts index 82bd873..73058d3 100644 --- a/eims-ui-mobile/src/store/user.ts +++ b/eims-ui-mobile/src/store/user.ts @@ -1,14 +1,15 @@ import { defineStore } from 'pinia' import { ref } from 'vue' +import type { UserInfoResp, UserInfo } from '@/service/login.d' -const initState = { nickname: '', avatar: '' } +const initState = null export const useUserStore = defineStore( - 'user', + 'userInfo', () => { - const userInfo = ref<IUserInfo>({ ...initState }) + const userInfo = ref<UserInfo>({ ...initState }) - const setUserInfo = (val: IUserInfo) => { + const setUserInfo = (val: UserInfo) => { userInfo.value = val } @@ -19,13 +20,11 @@ const reset = () => { userInfo.value = { ...initState } } - const isLogined = computed(() => !!userInfo.value.token) return { userInfo, setUserInfo, clearUserInfo, - isLogined, reset, } }, diff --git a/eims-ui-mobile/src/style/index.scss b/eims-ui-mobile/src/style/index.scss index 86184d9..032124f 100644 --- a/eims-ui-mobile/src/style/index.scss +++ b/eims-ui-mobile/src/style/index.scss @@ -16,3 +16,40 @@ // 淇敼鎸夐挳鑳屾櫙鑹� // --wot-button-primary-bg-color: green; } + +// base鏂囧瓧棰滆壊 +.text-color-base { + color: $uni-text-color; +} +.text-color-gray { + color: $uni-text-color-grey; +} + +// 鍥炬爣棰滆壊 +.icon-color-base { + color: $uni-color-primary; +} +.icon-color-gray { + color: $uni-text-color-grey; +} +.icon-color-success { + color: $uni-color-success; +} + +.icon-color-warning { + color: $uni-color-warning; +} +.icon-color-purple { + color: #824eed; +} + +.bg-base { + background: $uni-bg-color-grey; +} + +.bg-primary { + background: $uni-color-primary; +} + + + diff --git a/eims-ui-mobile/src/types/auto-import.d.ts b/eims-ui-mobile/src/types/auto-import.d.ts index 117a03d..5dedc7d 100644 --- a/eims-ui-mobile/src/types/auto-import.d.ts +++ b/eims-ui-mobile/src/types/auto-import.d.ts @@ -79,12 +79,10 @@ const useCssVars: typeof import('vue')['useCssVars'] const useId: typeof import('vue')['useId'] const useModel: typeof import('vue')['useModel'] - const useNavbarWeixin: (typeof import('../hooks/useNavbarWeixin'))['default'] const useRequest: typeof import('../hooks/useRequest')['default'] const useSlots: typeof import('vue')['useSlots'] const useTemplateRef: typeof import('vue')['useTemplateRef'] const useUpload: typeof import('../hooks/useUpload')['default'] - const useUpload2: typeof import('../hooks/useUpload2')['default'] const watch: typeof import('vue')['watch'] const watchEffect: typeof import('vue')['watchEffect'] const watchPostEffect: typeof import('vue')['watchPostEffect'] diff --git a/eims-ui-mobile/src/types/uni-pages.d.ts b/eims-ui-mobile/src/types/uni-pages.d.ts index 4e88f42..23e19a1 100644 --- a/eims-ui-mobile/src/types/uni-pages.d.ts +++ b/eims-ui-mobile/src/types/uni-pages.d.ts @@ -5,8 +5,15 @@ interface NavigateToOptions { url: "/pages/home/index" | + "/pages/equ/equ-list" | "/pages/equ/index" | + "/pages/inspect/insp-add" | + "/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/uni.scss b/eims-ui-mobile/src/uni.scss index 21b9e5f..0607edc 100644 --- a/eims-ui-mobile/src/uni.scss +++ b/eims-ui-mobile/src/uni.scss @@ -16,7 +16,7 @@ /* 棰滆壊鍙橀噺 */ /* 琛屼负鐩稿叧棰滆壊 */ -$uni-color-primary: #007aff; +$uni-color-primary: #4D80F0; $uni-color-success: #4cd964; $uni-color-warning: #f0ad4e; $uni-color-error: #dd524d; 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-ui-mobile/src/utils/http.ts b/eims-ui-mobile/src/utils/http.ts index 4e3f38c..7314ccd 100644 --- a/eims-ui-mobile/src/utils/http.ts +++ b/eims-ui-mobile/src/utils/http.ts @@ -1,6 +1,10 @@ import { CustomRequestOptions } from '@/interceptors/request' +import { useUserStore, useAccessStore } from '@/store' export const http = <T>(options: CustomRequestOptions) => { + uni.showLoading({ + title: '鍔犺浇涓�', + }) // 1. 杩斿洖 Promise 瀵硅薄 return new Promise<IResData<T>>((resolve, reject) => { uni.request({ @@ -11,14 +15,39 @@ // #endif // 鍝嶅簲鎴愬姛 success(res) { + uni.hideLoading() // 鐘舵�佺爜 2xx锛屽弬鑰� axios 鐨勮璁� if (res.statusCode >= 200 && res.statusCode < 300) { // 2.1 鎻愬彇鏍稿績鏁版嵁 res.data - resolve(res.data as IResData<T>) + if ((res.data as IResData<T>).code === 200) { + resolve(((res.data as IResData<T>).data || res.data) as IResData<T>) + } else if ((res.data as IResData<T>).code === 401) { + uni.showToast({ + icon: 'none', + title: '鐧诲綍瓒呮椂锛岃閲嶆柊鐧诲綍锛�', + }) + // 401閿欒 -> 娓呯悊鐢ㄦ埛淇℃伅锛岃烦杞埌鐧诲綍椤� + useAccessStore().clearAccessInfo() + useUserStore().clearUserInfo() + const loginRoute = '/pages/login/index' + // 閲嶆柊鐧诲綍鍚庤繑鍥為〉闈� + const url = '/pages/home/index' + const redirectRoute = `${loginRoute}?redirect=${encodeURIComponent(url)}` + uni.navigateTo({ url: redirectRoute }) + reject(res) + } else { + // 鍏朵粬閿欒 -> 鏍规嵁鍚庣閿欒淇℃伅杞绘彁绀� + uni.showToast({ + icon: 'none', + title: (res.data as IResData<T>).msg || '璇锋眰閿欒', + }) + reject(res) + } } else if (res.statusCode === 401) { // 401閿欒 -> 娓呯悊鐢ㄦ埛淇℃伅锛岃烦杞埌鐧诲綍椤� - // userStore.clearUserInfo() - // uni.navigateTo({ url: '/pages/login/login' }) + useAccessStore().clearAccessInfo() + useUserStore().clearUserInfo() + uni.navigateTo({ url: '/pages/login/index' }) reject(res) } else { // 鍏朵粬閿欒 -> 鏍规嵁鍚庣閿欒淇℃伅杞绘彁绀� @@ -37,6 +66,7 @@ title: '缃戠粶閿欒锛屾崲涓綉缁滆瘯璇�', }) reject(err) + uni.hideLoading() }, }) }) @@ -76,5 +106,19 @@ }) } +export const httpPut = <T>( + url: string, + data?: Record<string, any>, + query?: Record<string, any>, +) => { + return http<T>({ + url, + query, + data, + method: 'PUT', + }) +} + http.get = httpGet http.post = httpPost +http.put = httpPut diff --git a/eims-ui-mobile/vite.config.ts b/eims-ui-mobile/vite.config.ts index f0fec23..0f44391 100644 --- a/eims-ui-mobile/vite.config.ts +++ b/eims-ui-mobile/vite.config.ts @@ -43,6 +43,7 @@ VITE_SHOW_SOURCEMAP, VITE_APP_PROXY, VITE_APP_PROXY_PREFIX, + VITE_APP_CLIENT_ID, } = env console.log('鐜鍙橀噺 env -> ', env) diff --git a/eims-ui/apps/web-antd/src/views/eims/insp-st/data.tsx b/eims-ui/apps/web-antd/src/views/eims/insp-st/data.tsx index 7fd40eb..fee6672 100644 --- a/eims-ui/apps/web-antd/src/views/eims/insp-st/data.tsx +++ b/eims-ui/apps/web-antd/src/views/eims/insp-st/data.tsx @@ -46,7 +46,24 @@ { title: '淇濆吇鏃堕棿', field: 'planTimeStr', - minWidth: 200 + minWidth: 200, + slots: { + default: ({ row }) => { + // 鍒ゆ柇鏄惁闇�瑕佹樉绀烘椂闂� + if (!row.type) return ''; + + // 鑾峰彇鍘熷鏃堕棿瀛楃涓� + const fullDate = row.planTimeStr; + + // 鏍规嵁鏉′欢鍐冲畾鏄剧ず鏍煎紡 + // 绀轰緥鏉′欢锛氬鏋� status 鏄煇涓壒瀹氬�硷紙渚嬪 'monthly'锛夛紝鍒欐樉绀� YYYY-MM + if (row.type === 'Month') { + return fullDate.slice(0, 7); // 鎴彇鍓� 7 涓瓧绗︼紝寰楀埌 YYYY-MM + } + // 榛樿鏄剧ず瀹屾暣鏃ユ湡 YYYY-MM-DD + return fullDate; + } + } }, { title: '鐘舵��', diff --git a/eims-ui/apps/web-antd/src/views/eims/insp-st/index.vue b/eims-ui/apps/web-antd/src/views/eims/insp-st/index.vue index 0319a0b..9f7a6cf 100644 --- a/eims-ui/apps/web-antd/src/views/eims/insp-st/index.vue +++ b/eims-ui/apps/web-antd/src/views/eims/insp-st/index.vue @@ -255,16 +255,17 @@ const monBtn = ref<any>('primary'); function queryData(type: ViewMode) { + // TODO 鏃ヨ鍥惧拰鏈堣鍥惧悗绔凡缁熶竴鏂规硶 鍓嶇鍙垹闄ゆ棩瑙嗗浘澶氫綑閰嶇疆 if (type === ViewMode.Day) { dayBtn.value = 'primary'; monBtn.value = 'default'; curViewMode.value = ViewMode.Day; - tableApi.setGridOptions(gridOptions2); + // tableApi.setGridOptions(gridOptions2); } else if (type === ViewMode.Month) { dayBtn.value = 'default'; monBtn.value = 'primary'; curViewMode.value = ViewMode.Month; - tableApi.setGridOptions(gridOptions); + // tableApi.setGridOptions(gridOptions); } tableApi.query(); } @@ -273,7 +274,7 @@ <template> <Page :auto-content-height="true"> <div class="flex h-full gap-[8px] flex-col"> - <BasicTable class="h-2/3" table-title="鐐规璁板綍鍒楄〃"> + <BasicTable class="h-2/3" table-title="鐐规姹囨�诲垪琛�"> <template #toolbar-tools> <Space> <Button :type="dayBtn" @click.stop="queryData(ViewMode.Day)">鏃ヨ鍥�</Button> @@ -300,8 +301,7 @@ <ghost-button v-access:code="['eims:inspectSt:edit']" @click.stop="handleEdit(row)"> {{ $t('pages.common.edit') }} </ghost-button> - <Popconfirm :get-popup-container="getVxePopupContainer" placement="left" title="纭鍒犻櫎锛�" - @confirm="handleDelete(row)"> + <Popconfirm :get-popup-container="getVxePopupContainer" placement="left" title="纭鍒犻櫎锛�" @confirm="handleDelete(row)"> <ghost-button danger v-access:code="['eims:inspectSt:remove']" @click.stop=""> {{ $t('pages.common.delete') }} </ghost-button> @@ -309,8 +309,7 @@ </Space> </template> </BasicTable> - <BasisSubTable :columns="recordCol" :list-api="listInspStRecord" :req-value="recordId" class="h-1/3" - req-key="inspCode" title="鐐规璁板綍" /> + <BasisSubTable :columns="recordCol" :list-api="listInspStRecord" :req-value="recordId" class="h-1/3" req-key="inspCode" title="鐐规璁板綍" /> </div> <InspStDrawer @reload="tableApi.query()" /> </Page> diff --git a/eims-ui/apps/web-antd/src/views/eims/spare-inoutdt/index.vue b/eims-ui/apps/web-antd/src/views/eims/spare-inoutdt/index.vue new file mode 100644 index 0000000..85af715 --- /dev/null +++ b/eims-ui/apps/web-antd/src/views/eims/spare-inoutdt/index.vue @@ -0,0 +1,11 @@ +<script setup lang="ts"> + +</script> + +<template> + +</template> + +<style scoped> + +</style> diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/EimsInspectRecordController.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/EimsInspectRecordController.java index 11f84f6..106896e 100644 --- a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/EimsInspectRecordController.java +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/EimsInspectRecordController.java @@ -15,6 +15,7 @@ import org.dromara.common.core.utils.DateUtils; import org.dromara.common.core.utils.StringUtils; import org.dromara.eims.domain.bo.EimsMaintOrderBo; +import org.dromara.eims.domain.bo.InspectRecordBo; import org.dromara.eims.domain.vo.EimsMaintOrderVo; import org.springframework.web.bind.annotation.*; import org.springframework.validation.annotation.Validated; @@ -80,6 +81,7 @@ Map<String, Object> params = bo.getParams(); params.put("beginPlanTime",startOfMonth); params.put("endPlanTime",endOfMonth); + params.put("type","Month"); } return eimsInspectRecordService.queryPageListCustom(bo, pageQuery); } @@ -130,6 +132,14 @@ return toAjax(eimsInspectRecordService.updateByBo(bo)); } + @SaCheckPermission("eims:inspectRecord:edit") + @Log(title = "鐐规璁板綍-鎵归噺淇敼", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping("editBatch") + public R<Void> editBatch(@Validated(EditGroup.class) @RequestBody InspectRecordBo bo) { + return toAjax(eimsInspectRecordService.updateBatchByBo(bo)); + } + /** * 鍒犻櫎鐐规璁板綍 * diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsInspectSt.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsInspectSt.java index a0a0c3b..aa8a890 100644 --- a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsInspectSt.java +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsInspectSt.java @@ -28,6 +28,10 @@ */ @TableId(value = "id") private Long id; + /** + * 姹囨�荤被鍨� Day-鏃ユ眹鎬� Month-鏈堟眹鎬� + */ + private String type; /** * 鏍囬 diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsInspectStBo.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsInspectStBo.java index 82d3ea9..fefd0ef 100644 --- a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsInspectStBo.java +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsInspectStBo.java @@ -28,17 +28,19 @@ */ @NotNull(message = "涓嶈兘涓虹┖", groups = { EditGroup.class }) private Long id; + /** + * 姹囨�荤被鍨� Day-鏃ユ眹鎬� Month-鏈堟眹鎬� + */ + private String type; /** * 鏍囬 */ - @NotBlank(message = "鏍囬涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) private String title; /** * 璁惧id */ - @NotNull(message = "璁惧id涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) private Long equId; private String equName; private String assetNo; @@ -46,7 +48,6 @@ /** * 璁″垝鏃堕棿 */ - @NotNull(message = "璁″垝鏃堕棿涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) private Date planTime; /** diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/InspectRecordBo.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/InspectRecordBo.java new file mode 100644 index 0000000..4e74891 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/InspectRecordBo.java @@ -0,0 +1,13 @@ +package org.dromara.eims.domain.bo; + +import lombok.Data; + +import java.util.List; + +@Data +public class InspectRecordBo { + /** + * 绉诲姩绔壒閲忔洿鏂� + */ + private List<EimsInspectRecordBo> inspRecordList; +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsInspectStVo.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsInspectStVo.java index 021d71b..8dee5d2 100644 --- a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsInspectStVo.java +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsInspectStVo.java @@ -41,7 +41,10 @@ */ @ExcelProperty(value = "鏍囬") private String title; - + /** + * 姹囨�荤被鍨� Day-鏃ユ眹鎬� Month-鏈堟眹鎬� + */ + private String type; /** * 璁惧id */ diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/mapper/EimsInspectRecordMapper.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/mapper/EimsInspectRecordMapper.java index a71d578..4d0c20b 100644 --- a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/mapper/EimsInspectRecordMapper.java +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/mapper/EimsInspectRecordMapper.java @@ -18,6 +18,7 @@ */ public interface EimsInspectRecordMapper extends BaseMapperPlus<EimsInspectRecord, EimsInspectRecordVo> { Page<EimsInspectRecordVo> selectInspRecordList(@Param("page") Page<EimsInspectRecordVo> page, @Param(Constants.WRAPPER) Wrapper<EimsInspectRecord> queryWrapper); + // TODO 鏃ヨ鍥惧拰鏈堣鍥剧粺涓�鎺ュ彛锛屽緟鍒犻櫎 Page<EimsInspectStVo> selectInspRecordDayList(@Param("page") Page<EimsInspectStVo> page, @Param(Constants.WRAPPER) Wrapper<EimsInspectSt> queryWrapper); } diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IEimsInspectRecordService.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IEimsInspectRecordService.java index ebd61d3..4afedb1 100644 --- a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IEimsInspectRecordService.java +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IEimsInspectRecordService.java @@ -1,6 +1,7 @@ package org.dromara.eims.service; import org.dromara.eims.domain.bo.EimsInspectStBo; +import org.dromara.eims.domain.bo.InspectRecordBo; import org.dromara.eims.domain.vo.EimsInspectRecordVo; import org.dromara.eims.domain.bo.EimsInspectRecordBo; import org.dromara.common.mybatis.core.page.TableDataInfo; @@ -58,6 +59,7 @@ * @return 鏄惁淇敼鎴愬姛 */ Boolean updateByBo(EimsInspectRecordBo bo); + Boolean updateBatchByBo(InspectRecordBo bo); /** * 鏍¢獙骞舵壒閲忓垹闄ょ偣妫�璁板綍淇℃伅 diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsInspectRecordServiceImpl.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsInspectRecordServiceImpl.java index 96596a8..0daa24b 100644 --- a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsInspectRecordServiceImpl.java +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsInspectRecordServiceImpl.java @@ -2,6 +2,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import lombok.SneakyThrows; +import org.dromara.common.core.constant.DictConstants; +import org.dromara.common.core.domain.model.LoginUser; import org.dromara.common.core.utils.DateUtils; import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.StringUtils; @@ -11,10 +13,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import lombok.RequiredArgsConstructor; +import org.dromara.common.satoken.utils.LoginHelper; import org.dromara.eims.domain.EimsInspectPlan; import org.dromara.eims.domain.EimsInspectSt; import org.dromara.eims.domain.EimsMaintPlan; import org.dromara.eims.domain.bo.EimsInspectStBo; +import org.dromara.eims.domain.bo.InspectRecordBo; import org.dromara.eims.domain.vo.EimsInspectStVo; import org.dromara.eims.domain.vo.EimsMaintOrderVo; import org.dromara.eims.mapper.EimsInspectPlanMapper; @@ -238,6 +242,19 @@ return baseMapper.updateById(update) > 0; } + @Override + public Boolean updateBatchByBo(InspectRecordBo bo) { + LoginUser loginUser = LoginHelper.getLoginUser(); + List<EimsInspectRecord> inspRecordList = MapstructUtils.convert(bo.getInspRecordList(), EimsInspectRecord.class); + inspRecordList.forEach(item->{ + // 鏇存柊涓哄凡鐐规 + item.setStatus(DictConstants.EIMS_INSPECT_STATUS_DETAIL.Y); + item.setInspTime(new Date()); + item.setInspUser(loginUser.getUserId()); + }); + return baseMapper.updateBatchById(inspRecordList); + } + /** * 淇濆瓨鍓嶇殑鏁版嵁鏍¢獙 */ 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 dc31019..6db24c0 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 @@ -21,6 +21,8 @@ import org.dromara.eims.service.IEimsInspectStService; import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; import java.time.ZoneId; import java.time.temporal.TemporalAdjusters; import java.util.*; @@ -59,23 +61,29 @@ */ @Override public TableDataInfo<EimsInspectStVo> queryPageList(EimsInspectStBo bo, PageQuery pageQuery) { + bo.setType(bo.getViewMode()); // 鏈堣鍥� - if(bo.getViewMode().equals("Month")){ +// if(bo.getViewMode().equals("Month")){ QueryWrapper<EimsInspectSt> qw = buildWrapper(bo); Page<EimsInspectStVo> result = baseMapper.selectInspStList(pageQuery.build(), qw); // 濉厖鏁版嵁 - fillStData(result); + fillStData(result,bo.getViewMode()); return TableDataInfo.build(result); // 鏃ヨ鍥� - }else if(bo.getViewMode().equals("Day")){ - Page<EimsInspectStVo> result = recordMapper.selectInspRecordDayList(pageQuery.build(), buildGroupWrapper(bo)); - return TableDataInfo.build(result); - } +// }else if(bo.getViewMode().equals("Day")){ +// Page<EimsInspectStVo> result = recordMapper.selectInspRecordDayList(pageQuery.build(), buildGroupWrapper(bo)); +// return TableDataInfo.build(result); +// } - return null; +// return null; } - private void fillStData(Page<EimsInspectStVo> result) { + /** + * + * @param result + * @param type Day-鏃ヨ鍥� Month-鏈堣鍥� + */ + private void fillStData(Page<EimsInspectStVo> result,String type) { List<EimsInspectStVo> records = result.getRecords(); for (int i = 0; i < records.size(); i++) { EimsInspectStVo stVo = records.get(i); @@ -84,9 +92,19 @@ LambdaQueryWrapper<EimsInspectRecord> recordLqw = Wrappers.lambdaQuery(); recordLqw.eq(EimsInspectRecord::getEquId, stVo.getEquId()); LocalDate planTime = stVo.getPlanTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + // 鏈堣鍥炬煡璇㈣寖鍥� LocalDate startOfMonth = planTime.with(TemporalAdjusters.firstDayOfMonth()); LocalDate endOfMonth = planTime.with(TemporalAdjusters.lastDayOfMonth()); - recordLqw.between(EimsInspectRecord::getPlanTime, startOfMonth, endOfMonth); + + // 鏃ヨ鍥炬煡璇㈣寖鍥� + if(type.equals("Day")){ + recordLqw.between(EimsInspectRecord::getPlanTime, planTime, planTime); + }else { + // 鏈堣鍥炬煡璇㈣寖鍥� + recordLqw.between(EimsInspectRecord::getPlanTime, startOfMonth, endOfMonth); + } + + // 鎵ц鏌ヨ List<EimsInspectRecordVo> recordList = recordMapper.selectVoList(recordLqw); // TODO 鏍规嵁瀛楀吀eims_inspect_status @@ -96,7 +114,7 @@ // TODO 鏍规嵁瀛楀吀eims_inspect_result Map<String, Long> rMap = recordList.stream() .filter(order ->order.getInspResult()!=null && List.of("1", "2").contains(order.getInspResult())) - .collect(Collectors.groupingBy(EimsInspectRecordVo::getStatus, Collectors.counting())); + .collect(Collectors.groupingBy(EimsInspectRecordVo::getInspResult, Collectors.counting())); stVo.setRecordCount(recordList.size()); stVo.setUnCheckCount(cMap.getOrDefault("0", 0L).intValue()); @@ -157,6 +175,7 @@ qw.like(StringUtils.isNotBlank(bo.getTitle()), "st.title", bo.getTitle()); qw.like(StringUtils.isNotBlank(bo.getEquName()), "equ.equ_name", bo.getEquName()); qw.like(StringUtils.isNotBlank(bo.getAssetNo()), "equ.asset_no", bo.getAssetNo()); + qw.eq( "st.type", bo.getType()); qw.between(params.get("beginPlanTime") != null && params.get("endPlanTime") != null, "st.plan_time", params.get("beginPlanTime"), params.get("endPlanTime")); qw.eq(bo.getInspUser() != null, "st.maint_user", bo.getInspUser()); 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 d7cf570..b01acb4 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; } /** diff --git a/eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsInspectRecordMapper.xml b/eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsInspectRecordMapper.xml index bf14d6a..b37e221 100644 --- a/eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsInspectRecordMapper.xml +++ b/eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsInspectRecordMapper.xml @@ -21,7 +21,7 @@ ${ew.getCustomSqlSegment} </select> - + <!--TODO 鏃ヨ鍥惧拰鏈堣鍥剧粺涓�鎺ュ彛锛屽緟鍒犻櫎--> <select id="selectInspRecordDayList" resultMap="EimsInspectStVoResult"> SELECT MAX(ir.id) id, diff --git a/eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsInspectStMapper.xml b/eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsInspectStMapper.xml index b9540eb..ec07300 100644 --- a/eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsInspectStMapper.xml +++ b/eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsInspectStMapper.xml @@ -6,7 +6,7 @@ <resultMap type="org.dromara.eims.domain.vo.EimsInspectStVo" id="MaintInspStVoResult"> </resultMap> <select id="selectInspStList" resultMap="MaintInspStVoResult"> - SELECT st.*,equ.equ_name equName,equ.asset_no assetNo, DATE_FORMAT(st.plan_time, '%Y-%m') as planTimeStr FROM eims_inspect_st st + SELECT st.*,equ.equ_name equName,equ.asset_no assetNo, DATE_FORMAT(st.plan_time, '%Y-%m-%d') as planTimeStr FROM eims_inspect_st st LEFT JOIN eims_equ equ on st.equ_id = equ.equ_id ${ew.getCustomSqlSegment} </select> -- Gitblit v1.9.3