| | |
| | | { |
| | | layout: 'default', |
| | | needLogin: true, |
| | | style: { |
| | | navigationBarTitleText: '设备维修', |
| | | 'app-plus': { |
| | | titleNView: { |
| | | buttons: [ |
| | | { |
| | | text: '接单', |
| | | fontSize: '14px', |
| | | color: '#FFFFFF', |
| | | }, |
| | | { |
| | | text: '', |
| | | fontSize: '24px', |
| | | color: '#FFFFFF', |
| | | }, |
| | | ], |
| | | }, |
| | | }, |
| | | }, |
| | | style: { navigationBarTitleText: '设备维修', navigationStyle: 'custom' }, |
| | | } |
| | | </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 |
| | | > |
| | | <template #right> |
| | | <text v-if="isOperatorOrRepair()" class="text-white">接单</text> |
| | | </template> |
| | | </wd-navbar> |
| | | <wd-drop-menu> |
| | | <wd-drop-menu-item |
| | | v-model="resTypeId" |
| | |
| | | value-key="dictValue" |
| | | :options="resTypeList" |
| | | @change="handleResType" |
| | | /> |
| | | <wd-drop-menu-item |
| | | v-model="filterDate" |
| | | :options="filterDateList" |
| | | @change="handleFilterDate" |
| | | /> |
| | | <wd-drop-menu-item |
| | | v-model="status" |
| | |
| | | <view class="flex justify-between items-center"> |
| | | <view class="flex items-center menu-title-box"> |
| | | <view class="menu-indicator"></view> |
| | | <text class="ml-1 text-xs">{{ item.resCode }}</text> |
| | | <text class="ml-1 text-sm">{{ item.resCode }}</text> |
| | | <text class="text-color-gray ml-2 text-mini">接单:{{ item.createTime }}</text> |
| | | </view> |
| | | |
| | |
| | | </view> |
| | | </view> |
| | | </template> |
| | | <view class="flex h-[240rpx] items-center" @click.stop="itemClick(item)"> |
| | | <view class="flex h-[240rpx] items-center"> |
| | | <image |
| | | v-if="item.reqType === '1'" |
| | | class="slot-img text-center" |
| | |
| | | </view> |
| | | |
| | | <view class="text-color-gray mt-1 text-mini"> |
| | | <text>开始时间: {{ item.startTime }}</text> |
| | | <text>维修开始: {{ item.startTime }}</text> |
| | | </view> |
| | | <view class="text-color-gray mt-1 text-mini"> |
| | | <text>完成时间: {{ item.endTime }}</text> |
| | | <text>维修结束: {{ item.endTime }}</text> |
| | | </view> |
| | | <view class="text-color-gray mt-1 text-mini"> |
| | | <text>维修人: {{ item.resUserName }}</text> |
| | |
| | | </view> |
| | | </view> |
| | | <view> |
| | | <wd-button v-if="item.status === '1'" size="small" icon="edit-outline">开始维修</wd-button> |
| | | <wd-button v-if="item.status === '2'" size="small" icon="edit-outline">维修中</wd-button> |
| | | <wd-button v-if="item.status === '3'" size="small" icon="edit-outline">已完成</wd-button> |
| | | <!--操作工或维修工角色--> |
| | | <template v-if="isOperatorOrRepair()"> |
| | | <wd-button |
| | | v-if="item.status === '1'" |
| | | size="small" |
| | | icon="edit-outline" |
| | | @click.stop="handleStartRepair(item)" |
| | | > |
| | | 开始维修 |
| | | </wd-button> |
| | | <wd-button |
| | | v-else-if="item.status === '2'" |
| | | size="small" |
| | | icon="edit-outline" |
| | | @click.stop="itemClick(item)" |
| | | > |
| | | 维修中 |
| | | </wd-button> |
| | | <view class="h-full flex flex-col" v-else-if="item.status === '3'"> |
| | | <wd-button size="small" icon="warn-bold" @click.stop="itemClick(item)"> |
| | | 详情 |
| | | </wd-button> |
| | | <wd-button |
| | | class="mt-4" |
| | | size="small" |
| | | icon="edit-outline" |
| | | @click.stop="goToFeedBack(item)" |
| | | > |
| | | 查看评价 |
| | | </wd-button> |
| | | </view> |
| | | </template> |
| | | |
| | | <!--管理员角色--> |
| | | <template v-else-if="isLeader()"> |
| | | <wd-button |
| | | v-if="item.status === '1'" |
| | | size="small" |
| | | icon="warn-bold" |
| | | disabled |
| | | @click.stop="itemClick(item)" |
| | | > |
| | | 待维修 |
| | | </wd-button> |
| | | <wd-button |
| | | v-else-if="item.status === '2'" |
| | | size="small" |
| | | icon="warn-bold" |
| | | disabled |
| | | @click.stop="itemClick(item)" |
| | | > |
| | | 维修中 |
| | | </wd-button> |
| | | <view class="h-full flex flex-col" v-else-if="item.status === '3'"> |
| | | <wd-button size="small" icon="warn-bold" @click.stop="itemClick(item)"> |
| | | 详情 |
| | | </wd-button> |
| | | <wd-button |
| | | class="mt-4" |
| | | size="small" |
| | | icon="edit-outline" |
| | | @click.stop="goToFeedBack(item)" |
| | | > |
| | | {{ item.fbId == null ? '写评价' : '查看评价' }} |
| | | </wd-button> |
| | | </view> |
| | | </template> |
| | | </view> |
| | | </view> |
| | | </wd-card> |
| | |
| | | <script setup lang="ts"> |
| | | import { onMounted, getCurrentInstance, ref } from 'vue' |
| | | import { useToast, useMessage } from 'wot-design-uni' |
| | | import { getRepairResList, addRepairRes } from '@/service/repair' |
| | | import { getRepairResList, addRepairRes, updateRepairRes } from '@/service/repair' |
| | | import { DICT_REPAIR_RES_STATUS, DICT_REPAIR_REQ_TYPE, getDictInfo } from '@/service/dict' |
| | | import { isLeader, isOperatorOrRepair } from '@/utils/RoleUtils' |
| | | import { useUserStore } from '@/store' |
| | | import { formatDate } from '@/utils/DateUtils' |
| | | import dayjs from "dayjs"; |
| | | const userStore = useUserStore() |
| | | |
| | | const message = useMessage() |
| | | const toast = useToast() |
| | | |
| | | /** |
| | | * 其他页面传过来的数据 |
| | | * assetNo: 资产编号 |
| | | * from: 是否是扫码进来的,如果是扫码进来,只能查询固定设备的数据 |
| | | */ |
| | | interface PageParams { |
| | | assetNo?: string |
| | | from?: string |
| | | } |
| | | |
| | | // 页面参数,上个页面传递过来的参数 |
| | | const option = reactive<PageParams>({ |
| | | assetNo: '', |
| | | from: '', |
| | | }) |
| | | |
| | | // 维修单类型 |
| | | const resTypeId = ref<number>(0) |
| | | const resTypeId = ref<number>(-1) |
| | | // 维修单处理状态 |
| | | const status = ref<number>(0) |
| | | const status = ref<number>(-1) |
| | | |
| | | const isSelectRes = ref(false) |
| | | const filterDate = ref<string>('2') |
| | | |
| | | const resTypeList = ref<any>([{ dictLabel: '所有类型', dictValue: 0 }]) |
| | | const statusList = ref<any>([{ dictLabel: '所有状态', dictValue: 0 }]) |
| | | const filterDateList = ref<Record<string, any>[]>([ |
| | | { label: '所有数据', value: '0' }, |
| | | { label: '当天数据', value: '1' }, |
| | | { label: '当月数据', value: '2' }, |
| | | ]) |
| | | const resTypeList = ref<any>([{ dictLabel: '所有类型', dictValue: -1 }]) |
| | | const statusList = ref<any>([{ dictLabel: '所有状态', dictValue: -1 }]) |
| | | function handleResType({ value }) { |
| | | reloadData() |
| | | } |
| | | function handleResStatu({ value }) { |
| | | reloadData() |
| | | } |
| | | function handleFilterDate({ value }) { |
| | | reloadData() |
| | | } |
| | | |
| | |
| | | const dataList = ref([]) |
| | | |
| | | const queryList = (pageNum?: number, pageSize?: number) => { |
| | | const parmams = { |
| | | const queryParams: any = { |
| | | pageNum, |
| | | pageSize, |
| | | reqType: resTypeId.value, |
| | | status: status.value, |
| | | } |
| | | if (resTypeId.value === 0) { |
| | | delete parmams.reqType |
| | | if (resTypeId.value === -1) { |
| | | delete queryParams.reqType |
| | | } |
| | | if (status.value === 0) { |
| | | delete parmams.status |
| | | if (status.value === -1) { |
| | | delete queryParams.status |
| | | } |
| | | getRepairResList(parmams) |
| | | |
| | | if (filterDate.value === '1') { |
| | | // 获取当前日期 |
| | | const now = dayjs() |
| | | queryParams.params = { |
| | | beginReqTime: now.startOf('day').format('YYYY-MM-DD 00:00:00'), |
| | | endReqTime: now.endOf('day').format('YYYY-MM-DD 23:59:59'), |
| | | } |
| | | } else if (filterDate.value === '2') { |
| | | const now = dayjs() |
| | | queryParams.params = { |
| | | beginReqTime: now.startOf('month').format('YYYY-MM-DD 00:00:00'), |
| | | endReqTime: now.endOf('month').format('YYYY-MM-DD 23:59:59'), |
| | | } |
| | | } else { |
| | | delete queryParams.params |
| | | } |
| | | // 如果是从扫码页面过来,只能查询固定设备的数据 |
| | | if (option?.from === 'scan') { |
| | | queryParams.assetNo = option.assetNo |
| | | } |
| | | getRepairResList(queryParams) |
| | | .then((res: any) => { |
| | | paging.value.completeByTotal(res.rows, res.total) |
| | | }) |
| | |
| | | * 条目点击事件 |
| | | * @param item |
| | | */ |
| | | function itemClick(item: any) {} |
| | | function itemClick(item: any) { |
| | | goToDetail(item) |
| | | } |
| | | |
| | | onNavigationBarButtonTap((e) => { |
| | | if (e.index === 0) { |
| | | /** |
| | | * 开始维修 |
| | | * @param item |
| | | */ |
| | | function handleStartRepair(item: any) { |
| | | // 确认开始修改状态为2-维修中 |
| | | const data = Object.assign({}, item) |
| | | // 确认开始修改状态为2-维修中 |
| | | data.status = '2' |
| | | // 设置开始维修时间 |
| | | data.startTime = formatDate(new Date()) |
| | | message |
| | | .confirm({ |
| | | msg: '确定开始维修?', |
| | | title: '提示', |
| | | beforeConfirm: ({ resolve }) => { |
| | | updateRepair(data, resolve) |
| | | }, |
| | | }) |
| | | .then(() => {}) |
| | | .catch((error) => { |
| | | console.log(error) |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * 更新维修工单 |
| | | * @param data |
| | | * @param resolve |
| | | */ |
| | | function updateRepair(data: any, resolve: any) { |
| | | updateRepairRes(data) |
| | | .then((res: any) => { |
| | | resolve(true) |
| | | if (res?.code === 200) { |
| | | reloadData() |
| | | // 维修中状态才需要跳转 |
| | | if (data?.status === '2') { |
| | | goToDetail(data) |
| | | } |
| | | } |
| | | }) |
| | | .catch((res) => { |
| | | console.error(res) |
| | | }) |
| | | } |
| | | |
| | | function goToDetail(item) { |
| | | uni.navigateTo({ |
| | | url: `/pages/repair/res-detail?id=${item.id}`, |
| | | }) |
| | | } |
| | | |
| | | function goToFeedBack(item) { |
| | | uni.navigateTo({ |
| | | url: `/pages/repair/repair-fb?id=${item.id}`, |
| | | }) |
| | | } |
| | | const goBack = () => { |
| | | uni.navigateBack() |
| | | } |
| | | function handleClickRight() { |
| | | if (isLeader()) { |
| | | toast.info('请登录维修工账号接单') |
| | | } else if (isOperatorOrRepair()) { |
| | | handleSelectReq() |
| | | } |
| | | }) |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 选择报修单 |
| | |
| | | statusList.value.push(...sList) |
| | | } |
| | | onLoad((options) => { |
| | | Object.assign(option, options) |
| | | initData() |
| | | uni.$on('res-list-refresh', reloadData) |
| | | }) |
| | | onUnload(() => { |
| | | uni.$off('res-list-refresh', reloadData) |
| | | }) |
| | | </script> |
| | | |