From f0610c371668b042d36d7772cb04b49a2afc69ea Mon Sep 17 00:00:00 2001 From: zhuguifei <zhuguifei@zhuguifeideiMac.local> Date: 星期四, 24 四月 2025 14:51:56 +0800 Subject: [PATCH] 完成移动端保养 --- eims-ui-mobile/src/pages/maint/order-detail.vue | 191 ++++++++++++++++++++++++++++++----------------- 1 files changed, 120 insertions(+), 71 deletions(-) diff --git a/eims-ui-mobile/src/pages/maint/order-detail.vue b/eims-ui-mobile/src/pages/maint/order-detail.vue index 2539593..9823cd4 100644 --- a/eims-ui-mobile/src/pages/maint/order-detail.vue +++ b/eims-ui-mobile/src/pages/maint/order-detail.vue @@ -1,25 +1,30 @@ <route lang="json5" type="page"> { + layout: 'default', needLogin: true, style: { navigationBarTitleText: '宸ュ崟鏄庣粏', - navigationStyle: 'custom', - navigationBarBackgroundColor: '#4D80F0', + 'app-plus': { + titleNView: { + buttons: [ + { + text: '鎻愪氦', + fontSize: '14px', + color: '#FFFFFF', + }, + { + text: '', + fontSize: '24px', + color: '#FFFFFF', + }, + ], + }, + }, }, } </route> <template> - <view class="bg-base h-[100vh]"> - <wd-navbar - title="宸ュ崟鏄庣粏" - left-arrow - @click-left="goBack" - right-text="鎻愪氦" - @click-right="handleClickRight" - custom-style="background: #4D80F0;" - safeAreaInsetTop - ></wd-navbar> - + <view class="bg-base container" safeAreaInsetTopBottom> <wd-form ref="form" :model="order" :rules="rules"> <wd-cell-group custom-class="group" title="璁惧淇℃伅" border> <wd-cell title="璁惧鍚嶇О" title-width="200rpx" is-link> @@ -40,24 +45,12 @@ <wd-cell title="璁″垝淇濆吇鏃ユ湡" title-width="200rpx" is-link> <text>{{ order?.planTime }}</text> </wd-cell> - <wd-datetime-picker - label="淇濆吇寮�濮嬫椂闂�" - label-width="200rpx" - placeholder="璇烽�夋嫨鏃堕棿" - prop="startTime" - v-model="startTime" - @open="openStartTime" - @confirm="handleStartTime" - /> - <wd-datetime-picker - label="淇濆吇缁撴潫鏃堕棿" - label-width="200rpx" - placeholder="璇烽�夋嫨鏃堕棿" - prop="endTime" - v-model="endTime" - @open="openEndTime" - @confirm="handleEndTime" - /> + <wd-cell title="淇濆吇寮�濮嬫椂闂�" title-width="200rpx" is-link> + <text>{{ order?.startTime }}</text> + </wd-cell> + <wd-cell title="淇濆吇瀹屾垚鏃堕棿" title-width="200rpx" is-link> + <text>{{ order?.endTime }}</text> + </wd-cell> <wd-textarea label="宸ヤ綔鎻忚堪" @@ -89,25 +82,54 @@ clearable /> </wd-cell-group> + <view class="h-[2px] w-full bg-base"></view> + <!--鏄惁鏄剧ず绠$悊鍛橀獙璇佹寜閽� (宸ュ崟鐘舵�佷负2-寰呴獙璇� 涓旂櫥褰曚汉role-leader绠$悊鍛樿鑹�)--> + <wd-cell + title="楠岃瘉閫氳繃(绠$悊鍛�)" + title-width="200px" + v-if="order.status === '2' && isLeader()" + > + <view style="text-align: right"> + <wd-switch v-model="isVerify" /> + </view> + </wd-cell> + + <!--鏄惁鏄剧ず鎿嶄綔宸ヤ繚鍏诲畬鎴� (宸ュ崟鐘舵�佷负1-淇濆吇涓� 涓旂櫥褰曚汉role-鎿嶄綔宸ヨ鑹�)--> + <wd-cell + title="淇濆吇瀹屾垚(鎿嶄綔宸�)" + title-width="200px" + v-if="order.status === '1' && isOperatorOrRepair()" + > + <view style="text-align: right"> + <wd-switch v-model="isFinish" /> + </view> + </wd-cell> </wd-form> + <view class="h-[100rpx]"></view> </view> </template> <script setup lang="ts"> import { getMaintOrder, updateMaintOrder } from '@/service/maint' -import { formatDate } from '@/utils/DateUtils' -import { reactive } from 'vue' +import { reactive, onMounted } from 'vue' import { FormRules } from 'wot-design-uni/components/wd-form/types' import { useToast, useMessage } from 'wot-design-uni' +import { isLeader, isOperatorOrRepair } from '@/utils/RoleUtils' +const toast = useToast() const message = useMessage() const fileList = ref<[]>() -const startTime = ref<number>(0) -const endTime = ref<number>(0) + +// 绠$悊鍛橀獙鏄惁閫氳繃 +const isVerify = ref(false) +// 鎿嶄綔宸ヤ繚鍏绘槸瀹屾垚 +const isFinish = ref(false) interface MaintOrder { id: string equName: string + assetNo: string + status: string maintCode: string maintName: string planTime: string @@ -120,6 +142,8 @@ const order = reactive<MaintOrder>({ id: '', equName: '', + assetNo: '', + status: '', maintCode: '', maintName: '', planTime: '', @@ -149,23 +173,6 @@ }, ], } -function openStartTime() { - if (startTime.value === 0) { - startTime.value = Date.now() - } -} -function openEndTime() { - if (endTime.value === 0) { - endTime.value = Date.now() - } -} - -function handleStartTime(value) { - order.startTime = formatDate(new Date(value.value)) -} -function handleEndTime(value) { - order.endTime = formatDate(new Date(value.value)) -} function handleFileChange({ fileList }) {} @@ -173,33 +180,32 @@ getMaintOrder(id) .then((res: any) => { Object.assign(order, res) - startTime.value = new Date(order.startTime).getTime() - endTime.value = new Date(order.endTime).getTime() }) .catch((res) => {}) } -function updateOrder(resolve: any) { - updateMaintOrder(order) +function updateOrder(data: any, resolve: any) { + updateMaintOrder(data) .then((res: any) => { resolve(true) + toastSucces() + uni.$emit('maint-order-refresh') }) .catch((res) => { console.error(res) }) } - -const goBack = () => { - uni.navigateBack() +function toastSucces() { + toast.success('鎿嶄綔鎴愬姛') } -function handleClickRight() { +function handleClickRight(data: any) { message .confirm({ msg: '纭畾鎻愪氦锛�', title: '鎻愮ず', beforeConfirm: ({ resolve }) => { - updateOrder(resolve) + updateOrder(data, resolve) }, }) .then(() => {}) @@ -208,21 +214,64 @@ }) } +onNavigationBarButtonTap((e) => { + if (e.index === 0) { + // 绠$悊鍛樿鑹� 涓斿緟楠岃瘉鐘舵�� + if (isLeader()) { + switch (order.status) { + case '0': + case '1': + toast.warning('褰撳墠宸ュ崟绛夊緟鎿嶄綔宸ヤ繚鍏荤姸鎬侊紝涓嶅彲鎿嶄綔') + break + case '2': + // 鍕鹃�夐獙璇侊紝鍙彁浜� + if (isVerify.value) { + // 淇敼宸ュ崟鐘舵�佷负宸插畬鎴� + const data: any = Object.assign({}, { id: order.id, status: order.status }) + data.status = '3' + handleClickRight(data) + } else { + toast.warning('璇烽�夋嫨鏄惁楠岃瘉閫氳繃') + } + break + case '3': + toast.warning('褰撳墠宸ュ崟瀹屾垚鐘舵�侊紝涓嶅彲鎿嶄綔') + break + } + } else if (isOperatorOrRepair()) { + switch (order.status) { + case '0': + break + case '1': + { + const data = Object.assign({}, order) + // 鍕鹃�夊伐鍗曞畬鎴愶紝鏀瑰彉鐘舵�� + if (isFinish.value) { + // 淇敼宸ュ崟鐘舵�佷负寰呴獙璇� + data.status = '2' + } + handleClickRight(data) + } + break + case '2': + toast.warning('褰撳墠宸ュ崟绛夊緟绠$悊楠岃瘉鐘舵�侊紝涓嶅彲鎿嶄綔') + break + case '3': + toast.warning('褰撳墠宸ュ崟瀹屾垚鐘舵�侊紝涓嶅彲鎿嶄綔') + break + } + } + } +}) + +onMounted(() => {}) onLoad((options) => { initMaintOrder(options.id) }) </script> <style scoped lang="scss"> -:deep(.wd-navbar__text) { - font-size: 26rpx; - color: white; -} - -:deep(.wd-icon-arrow-left:before), -:deep(.wd-navbar__title) { - color: white; - font-weight: bold !important; - font-size: 32rpx; +.container { + height: 100vh; } </style> -- Gitblit v1.9.3