<template>
|
<wd-card type="rectangle" :key="item.id">
|
<template #title>
|
<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-sm">{{ item.resCode }}</text>
|
<text class="text-color-gray ml-2 text-mini">接单:{{ item.createTime }}</text>
|
</view>
|
|
<view>
|
<wd-tag size="small" v-if="item.status === '1'" type="warning">已接单</wd-tag>
|
<wd-tag size="small" v-else-if="item.status === '2'" type="primary">维修中</wd-tag>
|
<wd-tag size="small" v-else-if="item.status === '3'" type="success">已完成</wd-tag>
|
</view>
|
</view>
|
</template>
|
<view class="flex h-[240rpx] items-center">
|
<image
|
v-if="item.reqType === '1'"
|
class="slot-img text-center"
|
src="/static/ico/ico-huiyi.png"
|
/>
|
<image
|
v-else-if="item.reqType === '2'"
|
class="slot-img text-center"
|
src="/static/ico/ico-setting.png"
|
/>
|
<image
|
v-else-if="item.reqType === '3'"
|
class="slot-img text-center"
|
src="/static/ico/ico-faxian.png"
|
/>
|
<view class="flex-1 mt-1">
|
<view class="text-color-base">
|
<template v-if="item.reqType === '1'">
|
<text>设备类型</text>
|
<text class="mx-2">|</text>
|
<text>{{ item.equName }}</text>
|
</template>
|
|
<template v-if="item.reqType === '2'">
|
<text>工具类型</text>
|
<text class="mx-2">|</text>
|
<text>{{ item.fixtureName }}</text>
|
</template>
|
|
<template v-if="item.reqType === '3'">
|
<text>其他类型</text>
|
</template>
|
<view class="text-color-gray mt-1 text-mini">
|
<text>报修人: {{ item.reqUserName }}</text>
|
</view>
|
<view class="text-color-gray mt-1 text-mini">
|
<text>报修时间: {{ item.reqTime }}</text>
|
</view>
|
|
<view class="text-color-gray mt-1 text-mini">
|
<text>维修开始: {{ item.startTime }}</text>
|
</view>
|
<view class="text-color-gray mt-1 text-mini">
|
<text>维修结束: {{ item.endTime }}</text>
|
</view>
|
<view class="text-color-gray mt-1 text-mini">
|
<text>维修人: {{ item.resUserName }}</text>
|
</view>
|
</view>
|
</view>
|
<view>
|
<template v-if="item.status === '3'">
|
<view class="h-full flex flex-col">
|
<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)"
|
type="warning"
|
>
|
{{ item.fbId == null ? '写评价' : '查看评价' }}
|
</wd-button>
|
</view>
|
</template>
|
<!--操作工或维修工角色-->
|
<template v-if="isRepair() || isEquAdmin()">
|
<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)"
|
type="success"
|
>
|
完成维修
|
</wd-button>
|
|
</template>
|
|
</view>
|
</view>
|
</wd-card>
|
</template>
|
|
<script setup lang="ts">
|
import type { RepairResVO } from '@/service/repair.d'
|
import { isEquAdmin, isLeader, isLineOrRepair, isRepair } from "@/utils/RoleUtils";
|
import { formatDate } from "@/utils/DateUtils";
|
import { updateRepairRes } from "@/service/repair";
|
import { useToast, useMessage } from 'wot-design-uni'
|
import { useUserStore } from "@/store";
|
|
const userStore = useUserStore()
|
const message = useMessage()
|
const toast = useToast()
|
defineProps({
|
item: {
|
type: Object as () => RepairResVO,
|
required: true
|
}
|
})
|
|
const emit = defineEmits(['click'])
|
|
function handleClick(item) {
|
emit('click', 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) {
|
uni.$emit('list-refresh')
|
// 维修中状态才需要跳转
|
if (data?.status === '3') {
|
goToDetail(data)
|
}
|
}
|
})
|
.catch((res) => {
|
console.error(res)
|
})
|
}
|
|
/**
|
* 条目点击事件
|
* @param item
|
*/
|
function itemClick(item: any) {
|
goToDetail(item)
|
}
|
|
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}`,
|
})
|
}
|
|
</script>
|
|
<style scoped lang="scss">
|
.menu-title-box {
|
height: 30rpx;
|
line-height: 30rpx;
|
}
|
|
.slot-img {
|
width: 72rpx;
|
height: 72rpx;
|
margin-right: 24rpx;
|
}
|
.text-mini {
|
font-size: 22rpx;
|
}
|
|
.menu-indicator {
|
width: 6rpx;
|
height: 22rpx;
|
border-radius: 10rpx;
|
background-color: $uni-color-primary;
|
}
|
:deep(.wd-card__title-content) {
|
padding: 16rpx !important;
|
}
|
:deep(.wd-card__content) {
|
padding: 16rpx !important;
|
}
|
:deep(.wd-card__footer) {
|
padding: 10rpx !important;
|
}
|
</style>
|