| | |
| | | </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)" |
| | | v-if="item.fbId === null" |
| | | > |
| | | 写评价 |
| | | </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)" |
| | | v-if="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' |
| | | const userStore = useUserStore() |
| | | |
| | | const message = useMessage() |
| | |
| | | * 条目点击事件 |
| | | * @param item |
| | | */ |
| | | function itemClick(item: any) {} |
| | | function itemClick(item: any) { |
| | | goToDetail(item) |
| | | } |
| | | |
| | | /** |
| | | * 开始维修 |
| | | * @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/feedback?id=${item.id}`, |
| | | }) |
| | | } |
| | | |
| | | onNavigationBarButtonTap((e) => { |
| | | if (e.index === 0) { |
| | | handleSelectReq() |
| | | if (isLeader()) { |
| | | toast.info('请登录维修工账号接单') |
| | | } else if (isOperatorOrRepair()) { |
| | | handleSelectReq() |
| | | } |
| | | } |
| | | }) |
| | | |
| | |
| | | const sList: any = await getDictInfo(DICT_REPAIR_RES_STATUS) |
| | | statusList.value.push(...sList) |
| | | } |
| | | onLoad((options) => { |
| | | onLoad(() => { |
| | | initData() |
| | | uni.$on('res-list-refresh', reloadData) |
| | | }) |
| | | onUnload(() => { |
| | | uni.$off('res-list-refresh', reloadData) |
| | | }) |
| | | </script> |
| | | |