| | |
| | | <view class="h-[1px] bg-base"></view> |
| | | <view class="bg-white flex justify-around py-4"> |
| | | <wd-button icon="edit-outline" @click.stop="handleInsp">点检</wd-button> |
| | | <wd-button icon="laptop" @click.stop="handMaint">保养</wd-button> |
| | | <wd-button icon="tools" @click.stop="showActions">维修</wd-button> |
| | | <wd-button icon="laptop" v-if="isRepair() || isLeader()" @click.stop="handMaint"> |
| | | 保养 |
| | | </wd-button> |
| | | <wd-button icon="laptop" @click.stop="handleRequest">报修</wd-button> |
| | | <!-- <wd-button icon="tools" @click.stop="showActions">维修</wd-button>--> |
| | | </view> |
| | | </view> |
| | | <view class="h-[10px] bg-base"></view> |
| | | <wd-tabs v-model="tab"> |
| | | |
| | | <wd-tab title="维修请求"> |
| | | <view class="h-[10px] bg-base"></view> |
| | | <!-- 维修请求区域 --> |
| | | <view class="mt-2" v-if="reqList.length > 0"> |
| | | |
| | | |
| | | <view class="bg-base"> |
| | | <req-card |
| | | v-for="item in reqList" |
| | | :key="item.id" |
| | | :item="item" |
| | | @click="handleReqClick" |
| | | /> |
| | | </view> |
| | | </view> |
| | | </wd-tab> |
| | | <wd-tab title="维修单"> |
| | | <view class="h-[10px] bg-base"></view> |
| | | <!-- 维修单区域 --> |
| | | <view class="mt-2" v-if="resList.length > 0"> |
| | | |
| | | |
| | | <view class="bg-base"> |
| | | <res-card v-for="item in resList" :key="item.id" :item="item" /> |
| | | </view> |
| | | </view> |
| | | </wd-tab> |
| | | </wd-tabs> |
| | | |
| | | <wd-action-sheet |
| | | v-model="show" |
| | |
| | | <script setup lang="ts"> |
| | | import dayjs from 'dayjs' |
| | | import type { EquVO } from '@/service/equ.d' |
| | | import type { RepairReqVO, RepairResVO } from '@/service/repair.d' |
| | | import { useToast, useMessage } from 'wot-design-uni' |
| | | import { getEquByAssetNo } from '@/service/equ' |
| | | import { getInspStByStId } from '@/service/inspect' |
| | | import { isLeader, isRepair } from '@/utils/RoleUtils' |
| | | import { getRepairReqList, getRepairResList } from '@/service/repair' |
| | | import ReqCard from '@/components/repair/req-card.vue' |
| | | import ResCard from '@/components/repair/res-card.vue' |
| | | import { useUserStore } from '@/store' |
| | | const tab = ref<number>(0) |
| | | const message = useMessage() |
| | | const toast = useToast() |
| | | const model = reactive<EquVO>({}) |
| | | |
| | | const userStore = useUserStore() |
| | | const scanResult = ref<string>('') |
| | | const show = ref<boolean>(false) |
| | | const exist = ref<boolean>(false) |
| | | const reqList = ref<RepairReqVO[]>([]) |
| | | const resList = ref<RepairResVO[]>([]) |
| | | const actions = ref([ |
| | | { |
| | | name: '新增报修', |
| | |
| | | if (res?.equId) { |
| | | exist.value = true |
| | | Object.assign(model, res) |
| | | // 加载维修请求和维修单数据 |
| | | loadRepairData(res.equId) |
| | | } else { |
| | | toast.error('未查询到该资产编号相关数据!') |
| | | } |
| | |
| | | toast.error(res?.data?.msg || '请求失败') |
| | | }) |
| | | } |
| | | |
| | | // 加载维修请求和维修单数据 |
| | | function loadRepairData(equId: string | number) { |
| | | // 加载未接单的维修请求 |
| | | getRepairReqList({ |
| | | equId, |
| | | status: '0', |
| | | }).then((res: any) => { |
| | | if (res?.rows) { |
| | | reqList.value = res.rows |
| | | } |
| | | }) |
| | | |
| | | // 加载未完成的维修单 |
| | | const params = { |
| | | equId, |
| | | params: { |
| | | status: '0,1,2', |
| | | }, |
| | | } |
| | | // 如果是维修工则加载本要接单的维修单 |
| | | if (isRepair()) { |
| | | params.resUser = userStore?.userInfo?.userId |
| | | params.params.status = '0,1,2' |
| | | } |
| | | getRepairResList(params).then((res: any) => { |
| | | if (res?.rows) { |
| | | resList.value = res.rows |
| | | } |
| | | }) |
| | | } |
| | | |
| | | function handleInfo() { |
| | | uni.showToast({ |
| | | title: '功能开发中', |
| | |
| | | }) |
| | | } |
| | | |
| | | function handleRequest() { |
| | | if (!model?.assetNo) { |
| | | uni.showToast({ |
| | | title: '未查询到设备,请联系管理员!', |
| | | icon: 'none', |
| | | }) |
| | | return false |
| | | } |
| | | uni.navigateTo({ |
| | | url: `/pages/repair/repair-add?equId=${model?.equId}&equName=${model?.equName}&from=scan`, |
| | | }) |
| | | } |
| | | |
| | | function showActions() { |
| | | show.value = true |
| | | } |
| | |
| | | function close() { |
| | | show.value = false |
| | | } |
| | | |
| | | function select({ item, index }) { |
| | | console.error(model?.equId) |
| | | console.error(!model?.equId) |
| | |
| | | break |
| | | } |
| | | } |
| | | ;`/pages/repair/req-list`, |
| | | // 处理维修请求点击事件 |
| | | function handleReqClick(item) { |
| | | uni.navigateTo({ |
| | | url: `/pages/repair/req-detail?id=${item.id}`, |
| | | }) |
| | | } |
| | | |
| | | // // 处理维修单点击事件 |
| | | // function handleResClick(item) { |
| | | // uni.navigateTo({ |
| | | // url: `/pages/repair/res-detail?id=${item.id}`, |
| | | // }) |
| | | // } |
| | | |
| | | onLoad((options) => { |
| | | uni.$on('list-refresh', loadRepairData) |
| | | scanResult.value = options?.result |
| | | initData(options?.result) |
| | | }) |
| | | onUnload(() => { |
| | | uni.$off('list-refresh', loadRepairData) |
| | | }) |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |