<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.code }}</text>
|
</view>
|
|
<view>
|
<wd-button size="small" v-if="item.status === '0'" type="info">待接单</wd-button>
|
<wd-button size="small" v-else-if="item.status === '1'" type="warning">已接单</wd-button>
|
<wd-button size="small" v-else-if="item.status === '2'" type="primary">维修中</wd-button>
|
<wd-button size="small" v-else-if="item.status === '3'" type="success">已完成</wd-button>
|
</view>
|
</view>
|
</template>
|
<wd-swipe-action>
|
<view class="flex items-center" @click.stop="itemClick(item)">
|
<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.occTime }}</text>
|
</view>
|
|
<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.reqDesc }}</text>
|
</view>
|
<view class="text-color-gray mt-1 text-mini">
|
<text>紧急程度: </text>
|
<wd-tag type="danger" v-if="item.urgencyLevel === '1'">紧急</wd-tag>
|
<wd-tag type="warning" v-else-if="item.urgencyLevel === '2'">一般</wd-tag>
|
<wd-tag type="success" v-else-if="item.urgencyLevel === '3'">普通</wd-tag>
|
</view>
|
</view>
|
<view class="text-color-gray text-sm mt-1">
|
{{ item.location }} {{ item.madeIn }}
|
</view>
|
|
</view>
|
<view v-if="isRepair() || isEquAdmin()">
|
<wd-button size="small" icon="edit-outline" @click.stop="handleSelectReq(item)">
|
接单
|
</wd-button>
|
</view>
|
</view>
|
<template #right>
|
<view class="h-full px-3 flex items-center">
|
<wd-button size="small" type="error" @click.stop="handleDelete(item)">删除</wd-button>
|
</view>
|
</template>
|
</wd-swipe-action>
|
</wd-card>
|
</template>
|
|
<script setup lang="ts">
|
import { useToast, useMessage } from 'wot-design-uni'
|
import type { RepairReqVO } from '@/service/repair.d'
|
import {addRepairRes} from "@/service/repair";
|
import { isEquAdmin, isRepair } from "@/utils/RoleUtils";
|
import { useUserStore } from "@/store";
|
|
const userStore = useUserStore()
|
const message = useMessage()
|
const toast = useToast()
|
defineProps({
|
item: {
|
type: Object as () => RepairReqVO,
|
required: true
|
}
|
})
|
|
const emit = defineEmits(['click'])
|
|
function itemClick(item) {
|
emit('click', item)
|
// 跳转到报修单详情页面
|
uni.navigateTo({
|
url: '/pages/repair/req-detail?id=' + item.id
|
})
|
}
|
|
|
function handleSelectReq(item: any) {
|
// 弹出确认是否接单弹窗
|
message.confirm({
|
msg: '确定接单?',
|
title: '提示',
|
beforeConfirm: ({ resolve }) => {
|
resolve(true)
|
addNewRepairRes(item)
|
},
|
})
|
}
|
function addNewRepairRes(data: any) {
|
console.error(data)
|
// 选择报修单后,修改报修单状态和新增维修工单
|
const resCode = `WXD${data.code.slice(3)}`
|
const deptId = userStore?.userInfo?.deptId
|
const userId = userStore?.userInfo?.userId
|
const resData = {
|
reqId: data.id,
|
reqCode: data.code,
|
reqUser: data.reqUser,
|
reqDept: data.reqDept,
|
resCode,
|
status: '1',
|
resUser: userId,
|
resDept: deptId,
|
}
|
addRepairRes(resData)
|
.then((res: any) => {
|
if (res.code === 200) {
|
toast.success(res?.msg || '操作成功')
|
uni.$emit('list-refresh')
|
} else {
|
toast.error(res?.msg || '生成维修工单失败,请重试')
|
}
|
})
|
.catch((res) => {
|
toast.error(res?.msg || '生成维修工单失败,请重试')
|
})
|
}
|
</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>
|