| | |
| | | { |
| | | "path": "pages/inspect/insp-record", |
| | | "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" |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | { |
| | |
| | | { |
| | | "path": "pages/maint/maint-order", |
| | | "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" |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | { |
| | |
| | | { |
| | | "path": "pages/maint/order-detail", |
| | | "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 lang="json5"> |
| | | { |
| | | 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> |
| | | <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> |
| | | </view> |
| | | </template> |
| | | <view class="flex h-[100rpx]" items-center> |
| | | <view class="flex h-[140rpx]" items-center> |
| | | <image class="slot-img text-center" src="/static/images/camera.png" /> |
| | | <view class="flex-1"> |
| | | <view class="text-color-gray text-xs mt-1 flex"> |
| | |
| | | <wd-icon class="icon-color-base" name="detection" size="40rpx"></wd-icon> |
| | | <text class="ml-1">进行中</text> |
| | | </template> |
| | | </view> |
| | | <view class="text-color-gray text-xs mt-2 flex"> |
| | | 创建时间: {{inspSt.createTime}} |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | equName: string |
| | | assetNo: string |
| | | planTimeStr?: string |
| | | createTime?: string |
| | | status: string |
| | | inspUser: number | string |
| | | specialNote: string |
| | |
| | | equName: '', |
| | | assetNo: '', |
| | | planTimeStr: '', |
| | | createTime: '', |
| | | status: '', |
| | | inspUser: '', |
| | | specialNote: '', |
| | |
| | | const goBack = () => { |
| | | uni.navigateBack() |
| | | } |
| | | function handleClickRight() { |
| | | handleConfirm() |
| | | } |
| | | onNavigationBarButtonTap((e) => { |
| | | if (e.index === 0) { |
| | | handleConfirm() |
| | | } |
| | | }) |
| | | |
| | | const toggleCollapse = () => { |
| | | isAllExpanded.value = !isAllExpanded.value |
| | |
| | | updateInspRecordBatch(params) |
| | | .then((res: any) => { |
| | | updateInspSt(resolve) |
| | | toast.success("操作成功") |
| | | }) |
| | | .catch((res) => { |
| | | console.error(res) |
| | |
| | | inspSt.equName = options.equName |
| | | inspSt.assetNo = options.assetNo |
| | | inspSt.planTimeStr = options.planTimeStr |
| | | inspSt.createTime = options.createTime |
| | | inspSt.specialNote = options?.specialNote |
| | | inspSt.inspUser = userStore?.userInfo?.userId |
| | | }) |
| | |
| | | </view> |
| | | </view> |
| | | </template> |
| | | <view class="flex h-[100rpx]" items-center> |
| | | <view class="flex h-[140rpx]" items-center> |
| | | <image class="slot-img text-center" src="/static/images/camera.png" /> |
| | | <view class="flex-1"> |
| | | <view class="text-color-gray text-xs mt-1 flex"> |
| | |
| | | <wd-icon class="icon-color-base" name="detection" size="40rpx"></wd-icon> |
| | | <text class="ml-1">进行中</text> |
| | | </template> |
| | | </view> |
| | | <view class="text-color-gray text-xs mt-2 flex"> |
| | | 创建时间: {{item.createTime}} |
| | | </view> |
| | | </view> |
| | | <wd-button size="small" icon="edit-outline" @click.stop="itemClick(item)">明细</wd-button> |
| | |
| | | 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 ?? ''}`, |
| | | url: `/pages/inspect/insp-record?id=${item.id}&createTime=${item.createTime}&inspCode=${inspCode}&specialNote=${item.specialNote ?? ''}&equName=${item.equName ?? ''}&assetNo=${item.assetNo ?? ''}&planTimeStr=${item.planTimeStr ?? ''}`, |
| | | }) |
| | | } |
| | | |
| | |
| | | <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> |
| | | <z-paging ref="paging" v-model="dataList" @query="queryList" show-refresher-update-time> |
| | | <z-paging |
| | | ref="paging" |
| | | v-model="dataList" |
| | | @query="queryList" |
| | | :auto="false" |
| | | 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> |
| | |
| | | </view> |
| | | </view> |
| | | </template> |
| | | <view class="flex h-[100rpx]" items-center> |
| | | <view class="flex h-[140rpx]" items-center> |
| | | <image class="slot-img text-center" src="/static/images/camera.png" /> |
| | | <view class="flex-1"> |
| | | <view class="text-color-gray text-xs mt-1 flex"> |
| | |
| | | </view> |
| | | <view class="text-color-gray text-xs mt-2 flex"> |
| | | <text>状态:</text> |
| | | <template v-if="maintSt.orderCount === maintSt.wcCount"> |
| | | <template v-if="maintSt.status === '1'"> |
| | | <wd-icon class="icon-color-success" name="check-outline" size="34rpx"></wd-icon> |
| | | <text class="ml-1">已完成</text> |
| | | </template> |
| | |
| | | <wd-icon class="icon-color-base" name="detection" size="40rpx"></wd-icon> |
| | | <text class="ml-1">进行中</text> |
| | | </template> |
| | | </view> |
| | | |
| | | <view class="text-color-gray text-xs mt-2 flex"> |
| | | 创建时间: {{ maintSt.createTime }} |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | </view> |
| | | <!--操作工或维修工角色--> |
| | | <template v-if="isOperatorOrRepair()"> |
| | | <wd-button |
| | | v-if="item.status === '0'" |
| | | size="small" |
| | | icon="edit-outline" |
| | | @click.stop="handleStartMaint(item)" |
| | | > |
| | | 开始保养 |
| | | </wd-button> |
| | | <view class="flex flex-col justify-between" v-if="item.status === '0'"> |
| | | <wd-button |
| | | size="small" |
| | | icon="edit-outline" |
| | | @click.stop="handleStartMaint(item)" |
| | | > |
| | | 开始保养 |
| | | </wd-button> |
| | | |
| | | <wd-button |
| | | class="mt-3" |
| | | size="small" |
| | | icon="edit-outline" |
| | | @click.stop="handleMaintFinish(item)" |
| | | > |
| | | 一键保养 |
| | | </wd-button> |
| | | </view> |
| | | <wd-button |
| | | v-if="item.status === '1'" |
| | | size="small" |
| | |
| | | |
| | | <!--管理员角色--> |
| | | <template v-else-if="isLeader()"> |
| | | <wd-button |
| | | v-if="item.status === '0'" |
| | | size="small" |
| | | icon="warn-bold" |
| | | disabled |
| | | > |
| | | <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 v-if="item.status === '1'" size="small" icon="warn-bold" disabled> |
| | | 保养中 |
| | | </wd-button> |
| | | |
| | |
| | | </template> |
| | | <script setup lang="ts"> |
| | | import type { MaintStVO } from '@/service/maint.d' |
| | | import { getMaintSt, getMaintStOrderList, updateMaintOrder } from '@/service/maint' |
| | | import { getMaintSt, getMaintStOrderList, updateMaintOrder, updateMaintSt } from '@/service/maint' |
| | | import { ref, reactive } from 'vue' |
| | | import { useToast, useMessage } from 'wot-design-uni' |
| | | import { isLeader, isOperatorOrRepair } from '@/utils/RoleUtils' |
| | | import { formatDate } from '@/utils/DateUtils' |
| | | const message = useMessage() |
| | | const toast = useToast() |
| | | |
| | | const paging = ref(null) |
| | | const dataList = ref([]) |
| | | const maintStId = ref('') |
| | | |
| | | interface QueryParams { |
| | | pageNum: number |
| | |
| | | equName: '', |
| | | assetNo: '', |
| | | planTime: '', |
| | | createTime: '', |
| | | orderCount: null, |
| | | wcCount: null, |
| | | dbyCount: null, |
| | |
| | | pageSize, |
| | | maintCode: maintCode.value, |
| | | } |
| | | |
| | | getMaintStOrderList(params) |
| | | .then((res: any) => { |
| | | // 请勿在网络请求回调中给dataList赋值!!只需要调用complete就可以了 |
| | |
| | | // 注意,每次都需要在catch中写这句话很麻烦,z-paging提供了方案可以全局统一处理 |
| | | // 在底层的网络请求抛出异常时,写uni.$emit('z-paging-error-emit');即可 |
| | | paging.value.complete(false) |
| | | }) |
| | | } |
| | | function initMaintSt(id: any) { |
| | | getMaintSt(id) |
| | | .then((res: any) => { |
| | | Object.assign(maintSt, res) |
| | | paging.value.reload() |
| | | }) |
| | | .catch((res) => { |
| | | console.error(res) |
| | | toast.error(res?.data?.msg || '请求失败') |
| | | }) |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * 开始保养 |
| | | * @param item |
| | | */ |
| | | function handleStartMaint(item) { |
| | | // 确认开始修改状态为1-保养中 |
| | | const data = Object.assign({}, item) |
| | | data.status = '1' |
| | | 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 |
| | | */ |
| | | function handleMaintFinish(item) { |
| | | // 一键保养 |
| | | const data = Object.assign({}, item) |
| | | data.status = '2' |
| | | data.startTime = formatDate(new Date()) |
| | | data.endTime = formatDate(new Date()) |
| | | message |
| | | .confirm({ |
| | | msg: '确定使用一键保养?', |
| | | title: '提示', |
| | | beforeConfirm: ({ resolve }) => { |
| | | updateOrder(data, resolve) |
| | | }, |
| | | }) |
| | |
| | | * @param resolve |
| | | */ |
| | | function updateOrder(data: any, resolve: any) { |
| | | |
| | | updateMaintOrder(data) |
| | | .then((res: any) => { |
| | | resolve(true) |
| | | if (res?.code === 200) { |
| | | reloadData() |
| | | // 保养状态才需要跳转 |
| | | if(data?.status === '1'){ |
| | | goToOrderDetail(data) |
| | | } |
| | | } |
| | | }) |
| | | .catch((res) => { |
| | | console.error(res) |
| | | }) |
| | | } |
| | | function reloadData() { |
| | | paging.value.reload() |
| | | } |
| | | const goBack = () => { |
| | | uni.navigateBack() |
| | | |
| | | function handleUpdateMaintSt() { |
| | | if (maintSt.orderCount !== maintSt.wcCount) { |
| | | toast.info('请先完成所有保养项!') |
| | | return false |
| | | } |
| | | |
| | | const data: any = Object.assign( |
| | | {}, |
| | | { |
| | | id: maintSt.id, |
| | | orderCount: maintSt.orderCount, |
| | | wcCount: maintSt.wcCount, |
| | | status: maintSt.status, |
| | | specialNote: maintSt.specialNote, |
| | | }, |
| | | ) |
| | | if (data.orderCount === data.wcCount) { |
| | | data.status = '1' |
| | | } |
| | | message |
| | | .confirm({ |
| | | msg: '确定更新工单汇总数据?', |
| | | title: '提示', |
| | | beforeConfirm: ({ resolve }) => { |
| | | updateMaintSt(data) |
| | | .then((res: any) => { |
| | | resolve(true) |
| | | if (res?.code === 200) { |
| | | reloadData() |
| | | toastSucces() |
| | | } |
| | | }) |
| | | .catch((res) => { |
| | | console.error(res) |
| | | }) |
| | | }, |
| | | }) |
| | | .then(() => {}) |
| | | .catch((error) => { |
| | | console.log(error) |
| | | }) |
| | | } |
| | | |
| | | function handleClickRight() {} |
| | | function toastSucces() { |
| | | toast.success('操作成功') |
| | | } |
| | | |
| | | function reloadData() { |
| | | initMaintSt(maintStId.value) |
| | | } |
| | | onNavigationBarButtonTap((e) => { |
| | | if (e.index === 0) { |
| | | handleUpdateMaintSt() |
| | | } |
| | | }) |
| | | |
| | | onLoad(() => { |
| | | uni.$on('maint-order-refresh', reloadData) |
| | | }) |
| | | onUnload(() => { |
| | | uni.$off('maint-order-refresh', reloadData) |
| | | }) |
| | | |
| | | /** |
| | | * 查询保养明细需要的code |
| | |
| | | const maintCode = computed(() => `${maintSt.equId}_${maintSt.planTime}`) |
| | | |
| | | onLoad((options) => { |
| | | const itemString = decodeURIComponent(options.maintSt) |
| | | const item = JSON.parse(itemString) |
| | | Object.assign(maintSt, item) |
| | | maintStId.value = options.id |
| | | reloadData() |
| | | }) |
| | | </script> |
| | | |
| | |
| | | </view> |
| | | </view> |
| | | </template> |
| | | <view class="flex h-[100rpx]" items-center> |
| | | <view class="flex h-[140rpx]" items-center> |
| | | <image class="slot-img text-center" src="/static/images/camera.png" /> |
| | | <view class="flex-1"> |
| | | <view class="text-color-gray text-xs mt-1 flex"> |
| | |
| | | </view> |
| | | <view class="text-color-gray text-xs mt-2 flex"> |
| | | <text>状态:</text> |
| | | <template v-if="item.orderCount === item.wcCount"> |
| | | <template v-if="item.status=== '1'"> |
| | | <wd-icon class="icon-color-success" name="check-outline" size="34rpx"></wd-icon> |
| | | <text class="ml-1">已完成</text> |
| | | </template> |
| | |
| | | <wd-icon class="icon-color-base" name="detection" size="40rpx"></wd-icon> |
| | | <text class="ml-1">进行中</text> |
| | | </template> |
| | | </view> |
| | | <view class="text-color-gray text-xs mt-2 flex"> |
| | | 创建时间: {{item.createTime}} |
| | | </view> |
| | | </view> |
| | | <wd-button size="small" icon="edit-outline" @click.stop="itemClick(item)">明细</wd-button> |
| | |
| | | } |
| | | |
| | | function itemClick(item) { |
| | | const itemString = encodeURIComponent(JSON.stringify(item)) |
| | | uni.navigateTo({ |
| | | url: `/pages/maint/maint-order?maintSt=${itemString}`, |
| | | url: `/pages/maint/maint-order?id=${item.id}`, |
| | | }) |
| | | } |
| | | |
| | |
| | | uni.$on('maint-st-refresh', reloadData) |
| | | }) |
| | | onUnload(() => { |
| | | uni.$off('maint-st-refres', reloadData) |
| | | uni.$off('maint-st-refresh', reloadData) |
| | | }) |
| | | </script> |
| | | |
| | |
| | | <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> |
| | |
| | | <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="工作描述" |
| | |
| | | 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 |
| | |
| | | const order = reactive<MaintOrder>({ |
| | | id: '', |
| | | equName: '', |
| | | assetNo: '', |
| | | status: '', |
| | | maintCode: '', |
| | | maintName: '', |
| | | planTime: '', |
| | |
| | | }, |
| | | ], |
| | | } |
| | | 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 }) {} |
| | | |
| | |
| | | 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(() => {}) |
| | |
| | | }) |
| | | } |
| | | |
| | | 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> |
| | |
| | | equName?: string; |
| | | assetNo?: string; |
| | | status?: string; |
| | | createTime?: string; |
| | | |
| | | /** |
| | | * |
| | |
| | | return http.get<MaintStVO>(`/eims/maintSt/${id}`) |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 更新工单汇总 |
| | | * @param data |
| | | */ |
| | | export const updateMaintSt = (data: any) => { |
| | | return http.put<void>('/eims/maintSt', data) |
| | | } |
| | | |
| | | /** |
| | | * 保养汇总列表 |
| | | */ |
| | |
| | | /** |
| | | * |
| | | */ |
| | | @NotNull(message = "设备id不能为空", groups = { AddGroup.class, EditGroup.class }) |
| | | private Long equId; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 计划表冗余-保养人 |
| | | */ |
| | | @NotNull(message = "计划表冗余-保养人不能为空", groups = { AddGroup.class, EditGroup.class }) |
| | | private Long maintUser; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 计划表冗余-保养部门 |
| | | */ |
| | | @NotNull(message = "计划表冗余-保养部门不能为空", groups = { AddGroup.class, EditGroup.class }) |
| | | private Long maintDept; |
| | | |
| | | /** |
| | | * 保养单号 |
| | | */ |
| | | @NotBlank(message = "保养单号不能为空", groups = { AddGroup.class, EditGroup.class }) |
| | | private String maintCode; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * |
| | | */ |
| | | @NotBlank(message = "状态不能为空", groups = { AddGroup.class, EditGroup.class }) |
| | | private String status; |
| | | |
| | | /** |
| | | * 保养计划时间 |
| | | */ |
| | | @NotNull(message = "保养计划时间不能为空", groups = { AddGroup.class, EditGroup.class }) |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date planTime; |
| | | |
| | |
| | | /** |
| | | * |
| | | */ |
| | | @NotBlank(message = "不能为空", groups = { AddGroup.class, EditGroup.class }) |
| | | private String title; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @NotBlank(message = "不能为空", groups = { AddGroup.class, EditGroup.class }) |
| | | private Long equId; |
| | | private String equName; |
| | | private String assetNo; |
| | | /** |
| | | * |
| | | */ |
| | | @NotNull(message = "不能为空", groups = { AddGroup.class, EditGroup.class }) |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date planTime; |
| | | |
| | |
| | | |
| | | import java.util.Date; |
| | | |
| | | import org.dromara.common.mybatis.core.domain.BaseEntity; |
| | | import org.dromara.common.translation.annotation.Translation; |
| | | import org.dromara.common.translation.constant.TransConstant; |
| | | import org.dromara.eims.domain.EimsInspectSt; |
| | |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | @AutoMapper(target = EimsInspectSt.class) |
| | | public class EimsInspectStVo implements Serializable { |
| | | public class EimsInspectStVo extends BaseEntity implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | */ |
| | | @Override |
| | | public EimsInspectStVo queryById(Long id){ |
| | | return baseMapper.selectVoById(id); |
| | | EimsInspectStVo stVo = baseMapper.selectVoById(id); |
| | | return stVo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * |
| | | * @param stVo |
| | | * @param type Day-日视图 Month-月视图 |
| | | */ |
| | | private void fillStDataSingle(EimsInspectStVo stVo,String type) { |
| | | |
| | | 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()); |
| | | |
| | | // 日视图查询范围 |
| | | 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 |
| | | Map<String, Long> cMap = recordList.stream() |
| | | .filter(order -> List.of("0", "1").contains(order.getStatus())) |
| | | .collect(Collectors.groupingBy(EimsInspectRecordVo::getStatus, Collectors.counting())); |
| | | // 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::getInspResult, Collectors.counting())); |
| | | |
| | | stVo.setRecordCount(recordList.size()); |
| | | stVo.setUnCheckCount(cMap.getOrDefault("0", 0L).intValue()); |
| | | stVo.setCheckCount(cMap.getOrDefault("1", 0L).intValue()); |
| | | |
| | | stVo.setNormalNum(rMap.getOrDefault("1", 0L).intValue()); |
| | | stVo.setAbNormalNum(rMap.getOrDefault("2", 0L).intValue()); |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public EimsMaintStVo queryById(Long id) { |
| | | return baseMapper.selectVoById(id); |
| | | EimsMaintStVo stVo = baseMapper.selectVoById(id); |
| | | if(stVo!=null){ |
| | | fillStDataSingle(stVo); |
| | | } |
| | | return stVo; |
| | | } |
| | | private void fillStDataSingle(EimsMaintStVo stVo) { |
| | | |
| | | //1.填充设备 |
| | | EimsEqu eimsEqu = equMapper.selectById(stVo.getEquId()); |
| | | stVo.setAssetNo(eimsEqu.getAssetNo()); |
| | | //2.统计数据 |
| | | LambdaQueryWrapper<EimsMaintOrder> orderLqw = Wrappers.lambdaQuery(); |
| | | orderLqw.eq(EimsMaintOrder::getEquId, stVo.getEquId()); |
| | | LocalDate planTime = stVo.getPlanTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | LocalDate startOfMonth = planTime.with(TemporalAdjusters.firstDayOfMonth()); |
| | | LocalDate endOfMonth = planTime.with(TemporalAdjusters.lastDayOfMonth()); |
| | | orderLqw.between(EimsMaintOrder::getPlanTime, startOfMonth, endOfMonth); |
| | | // 执行查询 |
| | | List<EimsMaintOrderVo> orderList = orderMapper.selectVoList(orderLqw); |
| | | // TODO 根据字典maint_order_status |
| | | Map<String, Long> cMap = orderList.stream() |
| | | .filter(order -> List.of("0", "1", "2", "3").contains(order.getStatus())) |
| | | .collect(Collectors.groupingBy(EimsMaintOrderVo::getStatus, Collectors.counting())); |
| | | stVo.setOrderCount(orderList.size()); |
| | | stVo.setDbyCount(cMap.getOrDefault("0", 0L).intValue()); |
| | | stVo.setByCount(cMap.getOrDefault("1", 0L).intValue()); |
| | | stVo.setDyzCount(cMap.getOrDefault("2", 0L).intValue()); |
| | | stVo.setWcCount(cMap.getOrDefault("3", 0L).intValue()); |
| | | |
| | | |
| | | } |
| | | |
| | | /** |