generated from Leo_Ding/web-template
异常工单修改
This commit is contained in:
parent
65ea48af37
commit
729403c391
@ -7,6 +7,27 @@
|
||||
@cancel="handleCancel"
|
||||
wrapClassName="order-detail-modal"
|
||||
>
|
||||
|
||||
|
||||
<!-- 用户信息 -->
|
||||
<a-descriptions bordered size="small" :column="2" class="mb-6">
|
||||
<template #title>
|
||||
<a-divider orientation="left">用户信息</a-divider>
|
||||
</template>
|
||||
<a-descriptions-item label="工单号">{{ detail.workOrderNo || '-' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="工单状态">{{ detail.status || '-' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="工单类型">{{ detail.type || '-' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="姓名">{{ detail.userName || '-' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="性别">{{ detail.gender || '-' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="年龄">{{ detail.age ? detail.age + ' 岁' : '-' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="联系电话">{{ detail.phone || '-' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="身份证号">{{ detail.idCard || '-' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="评估等级" :span="2">
|
||||
{{ detail.assessmentLevel || '未填写' }}
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
|
||||
|
||||
<!-- 服务轨迹 -->
|
||||
<a-descriptions bordered size="small" :column="2" class="mb-6">
|
||||
<template #title>
|
||||
@ -14,14 +35,14 @@
|
||||
</template>
|
||||
|
||||
<a-descriptions-item label="签入时间">
|
||||
{{ detail.checkInTime }}
|
||||
{{ detail.checkInTime || '-' }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="签入距离">
|
||||
{{ detail.checkInDistance }}
|
||||
{{ detail.checkInDistance || '-' }}
|
||||
</a-descriptions-item>
|
||||
|
||||
<a-descriptions-item label="签入地址" :span="2">
|
||||
{{ detail.checkInAddress }}
|
||||
{{ detail.checkInAddress || '-' }}
|
||||
</a-descriptions-item>
|
||||
|
||||
<a-descriptions-item label="签入图片" :span="2">
|
||||
@ -43,14 +64,14 @@
|
||||
</a-descriptions-item>
|
||||
|
||||
<a-descriptions-item label="签出时间">
|
||||
{{ detail.checkOutTime }}
|
||||
{{ detail.checkOutTime || '-' }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="签出距离">
|
||||
{{ detail.checkOutDistance }}
|
||||
{{ detail.checkOutDistance || '-' }}
|
||||
</a-descriptions-item>
|
||||
|
||||
<a-descriptions-item label="签出地址" :span="2">
|
||||
{{ detail.checkOutAddress }}
|
||||
{{ detail.checkOutAddress || '-' }}
|
||||
</a-descriptions-item>
|
||||
|
||||
<a-descriptions-item label="签出图片" :span="2">
|
||||
@ -76,36 +97,33 @@
|
||||
</a-descriptions-item>
|
||||
|
||||
<a-descriptions-item label="实际服务时长" :span="2">
|
||||
{{ detail.serviceDuration }}
|
||||
{{ detail.serviceDuration || '-' }}
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
|
||||
<!-- 用户信息 -->
|
||||
<a-descriptions bordered size="small" :column="2" class="mb-6">
|
||||
<template #title>
|
||||
<a-divider orientation="left">用户信息</a-divider>
|
||||
</template>
|
||||
<a-descriptions-item label="工单号">{{ detail.orderNo }}</a-descriptions-item>
|
||||
<a-descriptions-item label="姓名">{{ detail.userName }}</a-descriptions-item>
|
||||
<a-descriptions-item label="性别">{{ detail.gender }}</a-descriptions-item>
|
||||
<a-descriptions-item label="年龄">{{ detail.age }} 岁</a-descriptions-item>
|
||||
<a-descriptions-item label="联系电话">{{ detail.phone }}</a-descriptions-item>
|
||||
<a-descriptions-item label="身份证号">{{ detail.idCard }}</a-descriptions-item>
|
||||
<a-descriptions-item label="评估等级" :span="2">
|
||||
{{ detail.assessmentLevel || '未填写' }}
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
|
||||
<!-- 任务信息 -->
|
||||
<a-descriptions bordered size="small" :column="2" class="mb-6">
|
||||
<template #title>
|
||||
<a-divider orientation="left">任务信息</a-divider>
|
||||
</template>
|
||||
<a-descriptions-item label="护理员">{{ detail.caregiver }}</a-descriptions-item>
|
||||
<a-descriptions-item label="护理等级">{{ detail.careLevel || '未填写' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="计划服务时间">{{ detail.plannedTime }}</a-descriptions-item>
|
||||
<a-descriptions-item label="护理员">{{ detail.nurseName || '-' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="护理等级">{{ detail.nurseLevel || '未填写' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="计划开始日期">
|
||||
{{ detail.planStartDate ? dayjs(detail.planStartDate).format('YYYY-MM-DD') : '-' }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="计划结束日期">
|
||||
{{ detail.planEndDate ? dayjs(detail.planEndDate).format('YYYY-MM-DD') : '-' }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="计划服务开始时间">
|
||||
{{ detail.planStartTime ? dayjs(detail.planStartTime).format('HH:mm') : '-' }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="下单人">{{ detail.orderer || '-' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="下单时间">
|
||||
{{ detail.orderTime ? dayjs(detail.orderTime).format('YYYY-MM-DD HH:mm:ss') : '-' }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="服务地址" :span="2">
|
||||
{{ detail.serviceAddress }}
|
||||
{{ detail.serviceAddress || '-' }}
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
|
||||
@ -122,62 +140,161 @@
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 服务内容 -->
|
||||
<a-descriptions bordered size="small" :column="1" class="mb-6">
|
||||
<template #title>
|
||||
<a-divider orientation="left">服务内容</a-divider>
|
||||
</template>
|
||||
<a-descriptions-item label="服务内容">
|
||||
{{ detail.serviceContent || '无' }}
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
|
||||
<!-- 服务小结与反馈 -->
|
||||
<a-descriptions bordered size="small" :column="1" class="mb-6">
|
||||
<template #title>
|
||||
<a-divider orientation="left">服务小结与反馈</a-divider>
|
||||
</template>
|
||||
<a-descriptions-item label="服务小结">
|
||||
{{ detail.summary || '无' }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="用户需求反馈">
|
||||
{{ detail.feedback || '无' }}
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
|
||||
<!-- 服务评价 -->
|
||||
<a-descriptions bordered size="small" :column="2" class="mb-6">
|
||||
<template #title>
|
||||
<a-divider orientation="left">服务评价</a-divider>
|
||||
</template>
|
||||
<a-descriptions-item label="服务满意度">
|
||||
{{ detail.serviceSatisfaction || '-' }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="评价渠道">
|
||||
{{ detail.evaluationChannel || '-' }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="评价内容" :span="2">
|
||||
{{ detail.evaluationContent || '无' }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="评价人">
|
||||
{{ detail.evaluator || '-' }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="评价时间">
|
||||
{{ detail.evaluationTime ? dayjs(detail.evaluationTime).format('YYYY-MM-DD HH:mm:ss') : '-' }}
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
|
||||
<!-- 回访评价 -->
|
||||
<a-descriptions bordered size="small" :column="2" class="mb-6">
|
||||
<template #title>
|
||||
<a-divider orientation="left">回访评价</a-divider>
|
||||
</template>
|
||||
<a-descriptions-item label="服务满意度">
|
||||
{{ detail.visitSatisfaction || '-' }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="服务人员满意度">
|
||||
{{ detail.staffSatisfaction || '-' }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="服务反馈" :span="2">
|
||||
{{ detail.visitFeedback || '无' }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="回访人">
|
||||
{{ detail.visitor || '-' }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="回访时间">
|
||||
{{ detail.visitTime ? dayjs(detail.visitTime).format('YYYY-MM-DD HH:mm:ss') : '-' }}
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
|
||||
<!-- 异常工单处理信息 -->
|
||||
<a-descriptions bordered size="small" :column="2">
|
||||
<template #title>
|
||||
<a-divider orientation="left">异常工单处理信息</a-divider>
|
||||
</template>
|
||||
<a-descriptions-item label="处理状态">{{ detail.exceptionStatus }}</a-descriptions-item>
|
||||
<a-descriptions-item label="处理状态">{{ detail.exceptionStatus || '无' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="处理原因">{{ detail.exceptionReason || '无' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="处理人">{{ detail.exceptionHandler || '无' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="处理时间">{{ detail.exceptionTime || '无' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="处理时间">
|
||||
{{ detail.exceptionTime ? dayjs(detail.exceptionTime).format('YYYY-MM-DD HH:mm:ss') : '无' }}
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive } from 'vue'
|
||||
import { ref, reactive } from 'vue'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { useModal } from '@/hooks'
|
||||
import apis from '@/apis'
|
||||
import dayjs from 'dayjs'
|
||||
import { useDicsStore } from '@/store'
|
||||
|
||||
const dicsStore = useDicsStore()
|
||||
const { modal, hideModal } = useModal()
|
||||
|
||||
// 模拟数据(实际应由父组件传入)
|
||||
// 工单详情数据
|
||||
const detail = reactive({
|
||||
checkInTime: '2025-10-15 11:44:01',
|
||||
checkInDistance: '14996 m',
|
||||
checkInAddress: '江苏省南通市通州区十总镇南通市通州区十总镇五总居8-128西北775米',
|
||||
checkInImages: [
|
||||
'https://akt.obs.cn-east-3.myhuaweicloud.com:443/hahacloud/saas/1813150290048446464/6a4ddb23-8733-4ca4-a1f9-b0f061a4ca0a.jpg?AccessKeyId=EBJWO1KETPFJKBWNCG5V&Expires=1761122523&Signature=bygou7kYVrQ6f9bDDWlpebs15Nc%3D',
|
||||
'https://akt.obs.cn-east-3.myhuaweicloud.com:443/hahacloud/saas/1813150290048446464/11ce319c-705e-431a-a3a7-4a9bb8350fce.jpg?AccessKeyId=EBJWO1KETPFJKBWNCG5V&Expires=1761122523&Signature=cOHYxAxsTP0RQDgT2bNv2jjkWco%3D'
|
||||
],
|
||||
checkOutTime: '2025-10-15 12:44:43',
|
||||
checkOutDistance: '14984 m',
|
||||
checkOutAddress: '江苏省南通市通州区十总镇南通市通州区十总镇五总居8-128西北757米',
|
||||
checkOutImages: [
|
||||
'https://akt.obs.cn-east-3.myhuaweicloud.com:443/hahacloud/saas/1813150290048446464/3e7817e4-4d31-41d8-ba89-6532a5baea5d.jpg?AccessKeyId=EBJWO1KETPFJKBWNCG5V&Expires=1761122523&Signature=efu9s%2BjgIXdxZPU6sEH5OR0ipdE%3D',
|
||||
'https://akt.obs.cn-east-3.myhuaweicloud.com:443/hahacloud/saas/1813150290048446464/9902435e-fd61-423c-9681-7f11bcab7ee8.jpg?AccessKeyId=EBJWO1KETPFJKBWNCG5V&Expires=1761122523&Signature=y204ac9D%2BiI%2BWtNOaOu9UylAezg%3D',
|
||||
'https://akt.obs.cn-east-3.myhuaweicloud.com:443/hahacloud/saas/1813150290048446464/157a72f1-c081-4407-ab48-e38e25b38a24.jpg?AccessKeyId=EBJWO1KETPFJKBWNCG5V&Expires=1761122523&Signature=wvjINjdpPlG3QhkuDYIAISc20sY%3D'
|
||||
],
|
||||
checkOutRemark: '助洁理发,助餐剥花生',
|
||||
serviceDuration: '60 分钟',
|
||||
orderNo: '202510151043270345563994',
|
||||
userName: '顾美田',
|
||||
gender: '男',
|
||||
age: '90',
|
||||
phone: '18452439097',
|
||||
idCard: '320624193507244576',
|
||||
// 服务轨迹
|
||||
checkInTime: '',
|
||||
checkInDistance: '',
|
||||
checkInAddress: '',
|
||||
checkInImages: [],
|
||||
checkOutTime: '',
|
||||
checkOutDistance: '',
|
||||
checkOutAddress: '',
|
||||
checkOutImages: [],
|
||||
checkOutRemark: '',
|
||||
serviceDuration: '',
|
||||
|
||||
// 用户信息
|
||||
workOrderNo: '',
|
||||
status: '',
|
||||
type: '',
|
||||
userName: '',
|
||||
gender: '',
|
||||
age: null,
|
||||
phone: '',
|
||||
idCard: '',
|
||||
assessmentLevel: '',
|
||||
caregiver: '于圣霞',
|
||||
careLevel: '',
|
||||
plannedTime: '2025-10-15 10:42:00',
|
||||
serviceAddress: '江苏省南通市通州区十总镇五总社区居委会通州区五总居十七组3号',
|
||||
serviceItems: [
|
||||
{ itemCategoryName: '助乐服务', itemName: '精神关爱', careDuration: '60' }
|
||||
],
|
||||
exceptionStatus: '未处理',
|
||||
|
||||
// 任务信息
|
||||
nurseName: '',
|
||||
nurseLevel: '',
|
||||
planStartDate: null,
|
||||
planEndDate: null,
|
||||
planStartTime: null,
|
||||
serviceAddress: '',
|
||||
orderer: '',
|
||||
orderTime: null,
|
||||
|
||||
// 服务项目
|
||||
serviceItems: [],
|
||||
serviceContent: '',
|
||||
|
||||
// 服务小结与反馈
|
||||
summary: '',
|
||||
feedback: '',
|
||||
|
||||
// 服务评价
|
||||
serviceSatisfaction: '',
|
||||
evaluationChannel: '',
|
||||
evaluationContent: '',
|
||||
evaluator: '',
|
||||
evaluationTime: null,
|
||||
|
||||
// 回访评价
|
||||
visitSatisfaction: '',
|
||||
staffSatisfaction: '',
|
||||
visitFeedback: '',
|
||||
visitor: '',
|
||||
visitTime: null,
|
||||
|
||||
// 异常处理
|
||||
exceptionStatus: '',
|
||||
exceptionReason: '',
|
||||
exceptionHandler: '',
|
||||
exceptionTime: ''
|
||||
exceptionTime: null
|
||||
})
|
||||
|
||||
const serviceColumns = [
|
||||
@ -186,15 +303,133 @@ const serviceColumns = [
|
||||
{ title: '服务时长(分钟)', dataIndex: 'careDuration', width: '30%' }
|
||||
]
|
||||
|
||||
/**
|
||||
* 查看工单(唯一打开弹框的方法)
|
||||
* @param {Object} record - 工单数据
|
||||
*/
|
||||
function handleView(record = {}) {
|
||||
modal.value.open = true
|
||||
modal.value.title = '查看工单'
|
||||
console.log('查看工单数据:', record)
|
||||
loadWorkOrderDetail(record.id)
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载工单详情并填充表单
|
||||
* @param {string} id - 工单ID
|
||||
*/
|
||||
async function loadWorkOrderDetail(id) {
|
||||
console.log('开始加载工单详情,ID:', id)
|
||||
try {
|
||||
const { success, data } = await apis.workOrder.getWorkOrderDetail(id)
|
||||
console.log('工单详情接口响应:', data)
|
||||
|
||||
if (success && data) {
|
||||
const detailData = data
|
||||
console.log('工单详情数据:', detailData)
|
||||
|
||||
// 处理服务项目
|
||||
let serviceItems = detailData.projects?.map(item => ({
|
||||
itemCategoryName: item.category || '未分类',
|
||||
itemName: item.name || '',
|
||||
careDuration: item.duration || '0'
|
||||
})) || []
|
||||
|
||||
// 处理服务地址
|
||||
let areaLabels = detailData.areaLabels || []
|
||||
let serviceAddress = areaLabels.join('') + (detailData.detailAddress || '')
|
||||
|
||||
// 处理年龄 - 如果有出生日期可以计算年龄
|
||||
let age = null
|
||||
if (detailData.customer?.birthday) {
|
||||
const birthYear = new Date(detailData.customer.birthday).getFullYear()
|
||||
const currentYear = new Date().getFullYear()
|
||||
age = currentYear - birthYear
|
||||
}
|
||||
|
||||
// 更新详情数据
|
||||
Object.assign(detail, {
|
||||
// 服务轨迹(需要根据实际接口字段调整)
|
||||
checkInTime: detailData.checkInTime || '',
|
||||
checkInDistance: detailData.checkInDistance || '',
|
||||
checkInAddress: detailData.checkInAddress || '',
|
||||
checkInImages: detailData.checkInImages || [],
|
||||
checkOutTime: detailData.checkOutTime || '',
|
||||
checkOutDistance: detailData.checkOutDistance || '',
|
||||
checkOutAddress: detailData.checkOutAddress || '',
|
||||
checkOutImages: detailData.checkOutImages || [],
|
||||
checkOutRemark: detailData.checkOutRemark || '',
|
||||
serviceDuration: detailData.serviceDuration || '',
|
||||
|
||||
// 用户信息
|
||||
workOrderNo: detailData.orderNum || '',
|
||||
status: dicsStore.getDictLabel('Work_Order_Status', detailData.status) || '',
|
||||
type: dicsStore.getDictLabel('ORDER_TYPE', detailData.orderType) || '',
|
||||
userName: detailData.customer?.name || '',
|
||||
gender: detailData.customer?.gender || '',
|
||||
age: age,
|
||||
phone: detailData.customer?.contact1 || '',
|
||||
idCard: detailData.customer?.identityNo || '',
|
||||
assessmentLevel: detailData.assessmentLevel || '',
|
||||
|
||||
// 任务信息
|
||||
nurseName: detailData.servicePerson?.name || '',
|
||||
nurseLevel: detailData.serviceContent?.gender || '', // 这里可能是护理等级,确认字段名
|
||||
planStartDate: detailData.plannedStartDate || null,
|
||||
planEndDate: detailData.plannedEndDate || null,
|
||||
planStartTime: detailData.plannedServiceStartDate || null,
|
||||
serviceAddress: serviceAddress,
|
||||
orderer: detailData.createdBy?.name || '',
|
||||
orderTime: detailData.createdAt || null,
|
||||
|
||||
// 服务项目
|
||||
serviceItems: serviceItems,
|
||||
serviceContent: detailData.projects?.map(item => item.name).join(', ') || '',
|
||||
|
||||
// 服务小结与反馈
|
||||
summary: detailData.serviceSummary || '',
|
||||
feedback: detailData.userDemandFeedback || '',
|
||||
|
||||
// 服务评价
|
||||
serviceSatisfaction: detailData.serviceSatisfaction || '',
|
||||
evaluationChannel: detailData.evaluationChannel || '',
|
||||
evaluationContent: detailData.evaluationContent || '',
|
||||
evaluator: detailData.evaluator || '',
|
||||
evaluationTime: detailData.evaluationTime || null,
|
||||
|
||||
// 回访评价
|
||||
visitSatisfaction: detailData.visitSatisfaction || '',
|
||||
staffSatisfaction: detailData.staffSatisfaction || '',
|
||||
visitFeedback: detailData.visitFeedback || '',
|
||||
visitor: detailData.visitor || '',
|
||||
visitTime: detailData.visitTime || null,
|
||||
|
||||
// 异常处理信息
|
||||
exceptionStatus: detailData.orderError?.status || '',
|
||||
exceptionReason: detailData.orderError?.reason || '',
|
||||
exceptionHandler: detailData.orderError?.user?.name || '',
|
||||
exceptionTime: detailData.orderError?.updated_at || null
|
||||
})
|
||||
|
||||
console.log('设置后的详情数据:', detail)
|
||||
|
||||
} else {
|
||||
message.error('获取工单详情失败')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取工单详情失败:', error)
|
||||
message.error('加载工单信息失败')
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消/关闭按钮
|
||||
*/
|
||||
function handleCancel() {
|
||||
hideModal()
|
||||
}
|
||||
|
||||
function handleView() {
|
||||
modal.value.open = true
|
||||
modal.value.title = '工单详情'
|
||||
}
|
||||
|
||||
// 仅暴露查看方法
|
||||
defineExpose({
|
||||
handleView
|
||||
})
|
||||
|
||||
@ -109,14 +109,14 @@
|
||||
v-model:open="processModalVisible"
|
||||
title="处理异常"
|
||||
@ok="handleProcessSubmit"
|
||||
@cancel="processModalVisible = false"
|
||||
@cancel="handleProcessCancel"
|
||||
:confirm-loading="processSubmitting"
|
||||
>
|
||||
<a-form :model="processForm" :label-col="{ span: 6 }" :wrapper-col="{ span: 16 }">
|
||||
<a-form-item label="处理结果" name="processStatus" required>
|
||||
<a-select v-model:value="processForm.processStatus" placeholder="请选择处理结果">
|
||||
<a-select-option value="handled">已处理</a-select-option>
|
||||
<a-select-option value="ignored">忽略</a-select-option>
|
||||
<a-select-option value="Success">处理成功</a-select-option>
|
||||
<a-select-option value="Fail">处理失败</a-select-option>
|
||||
<!-- 可根据实际枚举扩展 -->
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
@ -137,7 +137,7 @@
|
||||
|
||||
<script setup>
|
||||
import { Modal, message } from 'ant-design-vue'
|
||||
import { ref,reactive } from 'vue'
|
||||
import { ref, reactive } from 'vue'
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined, PlusCircleOutlined } from '@ant-design/icons-vue'
|
||||
import apis from '@/apis'
|
||||
import { config } from '@/config'
|
||||
@ -149,11 +149,13 @@ import { useI18n } from 'vue-i18n'
|
||||
import storage from '@/utils/storage'
|
||||
import AreaCascader from '@/components/AreaCascader/index.vue'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
defineOptions({
|
||||
// eslint-disable-next-line vue/no-reserved-component-names
|
||||
name: 'menu',
|
||||
})
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
|
||||
const { t } = useI18n()
|
||||
const columns = ref([
|
||||
{ title: '工单号', dataIndex: 'orderId', key: 'orderId', width: 180 },
|
||||
{ title: '姓名', dataIndex: 'customerName', key: 'customerName', width: 120 },
|
||||
@ -170,17 +172,17 @@ const columns = ref([
|
||||
{ title: '服务地址', dataIndex: 'serviceAddress', key: 'serviceAddress', width: 200 },
|
||||
{ title: '操作', key: 'action', fixed: 'right', width: 340 },
|
||||
])
|
||||
const { listData, loading, showLoading, hideLoading, searchFormData, paginationState, resetPagination } =
|
||||
usePagination()
|
||||
|
||||
const { listData, loading, showLoading, hideLoading, searchFormData, paginationState, resetPagination } = usePagination()
|
||||
const { resetForm } = useForm()
|
||||
const viewDialogRef = ref()
|
||||
const selectedRowKeys = ref([]) // 选中的 id 列表
|
||||
const selectedRows = ref([]) // 选中的完整记录
|
||||
const selectedRowKeys = ref([])
|
||||
const selectedRows = ref([])
|
||||
|
||||
const rowSelection = ref({
|
||||
onChange: (keys, rows) => {
|
||||
if (keys.length > 40) {
|
||||
message.warning('最多只能选择40条记录进行批量处理')
|
||||
// 保留前40条
|
||||
selectedRowKeys.value = keys.slice(0, 40)
|
||||
selectedRows.value = rows.slice(0, 40)
|
||||
return
|
||||
@ -191,9 +193,7 @@ const rowSelection = ref({
|
||||
selectedRowKeys: selectedRowKeys,
|
||||
})
|
||||
|
||||
|
||||
|
||||
// 处理弹窗
|
||||
// 处理弹窗相关
|
||||
const processModalVisible = ref(false)
|
||||
const processSubmitting = ref(false)
|
||||
const processForm = reactive({
|
||||
@ -201,8 +201,7 @@ const processForm = reactive({
|
||||
processRemark: '',
|
||||
})
|
||||
|
||||
|
||||
let currentProcessRecords = [] // 当前要处理的记录(单条或批量)
|
||||
let currentProcessRecords = [] // 当前要处理的记录
|
||||
|
||||
// 打开批量处理
|
||||
function handleBatchProcess() {
|
||||
@ -217,63 +216,116 @@ function handleBatchProcess() {
|
||||
processModalVisible.value = true
|
||||
}
|
||||
|
||||
getMenuList()
|
||||
// 打开单条处理
|
||||
function handleSingleProcess(record) {
|
||||
currentProcessRecords = [record]
|
||||
processForm.processStatus = undefined
|
||||
processForm.processRemark = ''
|
||||
processModalVisible.value = true
|
||||
}
|
||||
|
||||
// 处理弹窗取消
|
||||
function handleProcessCancel() {
|
||||
processModalVisible.value = false
|
||||
processForm.processStatus = undefined
|
||||
processForm.processRemark = ''
|
||||
}
|
||||
|
||||
// 提交处理
|
||||
// 提交处理
|
||||
async function handleProcessSubmit() {
|
||||
const { processStatus, processRemark } = processForm
|
||||
if (!processStatus) {
|
||||
message.warning('请选择处理结果')
|
||||
return
|
||||
}
|
||||
|
||||
processSubmitting.value = true
|
||||
try {
|
||||
// 批量处理:传递ID数组
|
||||
const orderIds = currentProcessRecords.map(record => record.raw.id)
|
||||
|
||||
const { success } = await apis.workOrder.workerOrderErrorCheck({
|
||||
orderIDs: orderIds, // 传递ID数组
|
||||
status: processStatus,
|
||||
reason: processRemark,
|
||||
})
|
||||
|
||||
if (success) {
|
||||
message.success(`成功处理 ${orderIds.length} 条异常工单`)
|
||||
processModalVisible.value = false
|
||||
await getMenuList() // 刷新列表
|
||||
// 清空选中状态
|
||||
selectedRowKeys.value = []
|
||||
selectedRows.value = []
|
||||
} else {
|
||||
message.warning('处理失败')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('处理异常工单失败:', error)
|
||||
message.error('处理失败,请重试')
|
||||
} finally {
|
||||
processSubmitting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单列表
|
||||
* @return {Promise<void>}
|
||||
* 获取异常工单列表
|
||||
*/
|
||||
|
||||
async function getMenuList() {
|
||||
try {
|
||||
showLoading()
|
||||
const { pageSize, current } = paginationState
|
||||
|
||||
const { success, data, total } = await apis.workOrder.getAbnormalWorkOrderList({
|
||||
stationId:storage.local.getItem('stationId'),
|
||||
companyId:storage.local.getItem('companyId'),
|
||||
stationId: storage.local.getItem('stationId'),
|
||||
companyId: storage.local.getItem('companyId'),
|
||||
pageSize,
|
||||
current: current,
|
||||
...searchFormData.value,
|
||||
})
|
||||
|
||||
if (success) {
|
||||
// 字段映射
|
||||
const mappedData = data.map(item => ({
|
||||
id: item.orderNum || item.id, // 如果没有 id,可以用 orderNum 代替,或后端补充
|
||||
orderId: item.orderNum || '-', // 工单号
|
||||
customerName: item.customerName || '-', // 姓名
|
||||
identityNo: item.customerIdCard || '-', // 身份证号
|
||||
serviceUserName: item.serviceName || '-', // 服务人员
|
||||
itemNames: item.projects?.map(p => p.name).join('、') || '-', // 服务项目(多个用顿号连接)
|
||||
realStartTime: item.signInAt, // 签入时间(保持原格式,formatUtcDateTime 会处理)
|
||||
realEndTime: item.signOutAt, // 签出时间
|
||||
processStatus: item.processStatus === '1' ? '已处理' : item.processStatus === '0' ? '未处理' : '未知', // 处理状态(根据实际枚举调整)
|
||||
processRemark: item.reason || '-', // 处理原因
|
||||
processUserName: item.userName || '-', // 处理人
|
||||
processTime: dayjs(item.processAt).format('YYYY-MM-DD HH:mm:ss'), // 处理时间
|
||||
serviceAddress: item.detailAddress || '-', // 服务地址
|
||||
// 原始数据保留,便于后续操作(如提交处理时用 id)
|
||||
id: item.id,
|
||||
orderId: item.orderNum || '-',
|
||||
customerName: item.customerName || '-',
|
||||
identityNo: item.customerIdCard || '-',
|
||||
serviceUserName: item.serviceName || '-',
|
||||
itemNames: item.projects?.map(p => p.name).join('、') || '-',
|
||||
realStartTime: item.signInAt ? formatUtcDateTime(item.signInAt) : '-',
|
||||
realEndTime: item.signOutAt ? formatUtcDateTime(item.signOutAt) : '-',
|
||||
processStatus: item.processStatus === '1' ? '已处理' : item.processStatus === '0' ? '未处理' : '未知',
|
||||
processRemark: item.reason || '-',
|
||||
processUserName: item.userName || '-',
|
||||
processTime: item.processAt ? dayjs(item.processAt).format('YYYY-MM-DD HH:mm:ss') : '-',
|
||||
serviceAddress: item.detailAddress || '-',
|
||||
// 原始数据保留,便于后续操作
|
||||
raw: item,
|
||||
}))
|
||||
|
||||
listData.value = mappedData
|
||||
paginationState.total = total
|
||||
hideLoading()
|
||||
} catch (error) {
|
||||
console.error('获取工单列表失败:', error)
|
||||
hideLoading()
|
||||
} else {
|
||||
message.error('获取数据失败')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取异常工单列表失败:', error)
|
||||
message.error('获取数据失败')
|
||||
} finally {
|
||||
hideLoading()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
function handleSearch() {
|
||||
// resetForm()
|
||||
resetPagination()
|
||||
getMenuList()
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
@ -282,35 +334,7 @@ function handleResetSearch() {
|
||||
resetPagination()
|
||||
getMenuList()
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
*/
|
||||
function handleDelete({ id }) {
|
||||
Modal.confirm({
|
||||
title: t('pages.system.menu.delTip'),
|
||||
content: t('button.confirm'),
|
||||
okText: t('button.confirm'),
|
||||
onOk: () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
; (async () => {
|
||||
try {
|
||||
const { success } = await apis.menu.delMenu(id).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
resolve()
|
||||
message.success(t('component.message.success.delete'))
|
||||
await getMenuList()
|
||||
}
|
||||
} catch (error) {
|
||||
reject()
|
||||
}
|
||||
})()
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑完成
|
||||
*/
|
||||
@ -318,59 +342,8 @@ async function onOk() {
|
||||
await getMenuList()
|
||||
}
|
||||
|
||||
|
||||
// 打开单条处理
|
||||
function handleSingleProcess(record) {
|
||||
currentProcessRecords = [record]
|
||||
processForm.processStatus = record.processStatus || undefined
|
||||
processForm.processRemark = record.processRemark || ''
|
||||
processModalVisible.value = true
|
||||
}
|
||||
|
||||
// 提交处理
|
||||
async function handleProcessSubmit() {
|
||||
const { processStatus } = processForm
|
||||
if (!processStatus ) {
|
||||
message.warning('请选择处理结果')
|
||||
return
|
||||
}
|
||||
|
||||
processSubmitting.value = true
|
||||
// try {
|
||||
// // 假设你的 API 是批量处理:apis.order.batchProcess({ ids, processStatus, processRemark })
|
||||
// const ids = currentProcessRecords.map(r => r.id)
|
||||
// const { success } = await apis.order.batchProcess({
|
||||
// ids,
|
||||
// processStatus,
|
||||
// processRemark,
|
||||
// })
|
||||
|
||||
// if (config('http.code.success') === success) {
|
||||
// message.success('处理成功')
|
||||
// processModalVisible.value = false
|
||||
// await getOrderList() // 刷新列表
|
||||
// }
|
||||
// } catch (error) {
|
||||
// message.error('处理失败')
|
||||
// } finally {
|
||||
// processSubmitting.value = false
|
||||
// }
|
||||
}
|
||||
|
||||
async function handleView(record = {}) {
|
||||
showModal({
|
||||
type: 'view',
|
||||
title: '查看详情',
|
||||
})
|
||||
const { data } = await apis.menu.getMenu(record.id).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
formData.value = cloneDeep(data)
|
||||
formData.value.properties = formData.value.properties ? JSON.parse(formData.value.properties) : ''
|
||||
formData.value.resources = formData.value.resources || (formData.value.resources = [])
|
||||
platform.value=data.platform
|
||||
}
|
||||
|
||||
// 初始化加载
|
||||
getMenuList()
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
Loading…
x
Reference in New Issue
Block a user