generated from Leo_Ding/web-template
代码修改
This commit is contained in:
parent
4be770167d
commit
b0af79cb08
@ -21,5 +21,19 @@ export const getBackWorkOrderList = (params) => request.basic.get(`/api/v1/order
|
|||||||
export const getWorkOrderDetail = (id) => request.basic.get(`/api/v1/orders/${id}`)
|
export const getWorkOrderDetail = (id) => request.basic.get(`/api/v1/orders/${id}`)
|
||||||
|
|
||||||
// 派单
|
// 派单
|
||||||
export const sendWorkOrder = (id, params) => request.basic.put(`/api/v1/orders${id}`, params)
|
export const sendWorkOrder = (id, params) => request.basic.put(`/api/v1/orders/${id}`, params)
|
||||||
|
|
||||||
|
//作废工单
|
||||||
|
export const invalidWorkOrder = (id,params) => request.basic.delete(`/api/v1/orders/remove/${id}`,params)
|
||||||
|
|
||||||
|
|
||||||
|
// 工单签入
|
||||||
|
export const workOrderCheckIn = (params) => request.basic.post('/api/v1/orders/order_check_in',params)
|
||||||
|
|
||||||
|
// 工单签中
|
||||||
|
export const workOrderCheckDoing = (params) => request.basic.post('/api/v1/orders/order_check_doing',params)
|
||||||
|
|
||||||
|
// 工单签出
|
||||||
|
export const workOrderCheckOut = (params) => request.basic.post('/api/v1/orders/order_check_out',params)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -308,6 +308,16 @@
|
|||||||
}}</span>
|
}}</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template v-if="column.key === 'disabilityType'">
|
||||||
|
<span>{{ dicsStore.getDictLabel('DISABILITY_TYPES', record.disabilityType) }}</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-if="column.key === 'disabilityLevel'">
|
||||||
|
<span>{{ dicsStore.getDictLabel('Disability_Level', record.disabilityLevel) }}</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<template v-if="'action' === column.key">
|
<template v-if="'action' === column.key">
|
||||||
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">
|
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">
|
||||||
<span>编辑</span>
|
<span>编辑</span>
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
>
|
>
|
||||||
<a-form layout="vertical" ref="formRef" :model="formData" :rules="formRules">
|
<a-form layout="vertical" ref="formRef" :model="formData" :rules="formRules">
|
||||||
<!-- 签入时间 -->
|
<!-- 签入时间 -->
|
||||||
<a-form-item
|
<!-- <a-form-item
|
||||||
label="签入时间"
|
label="签入时间"
|
||||||
name="signTime"
|
name="signTime"
|
||||||
required
|
required
|
||||||
@ -24,11 +24,11 @@
|
|||||||
placeholder="选择时间"
|
placeholder="选择时间"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item> -->
|
||||||
|
|
||||||
<!-- 代签入原因 -->
|
<!-- 代签入原因 -->
|
||||||
<a-form-item
|
<a-form-item
|
||||||
label="代签入原因"
|
label="原因"
|
||||||
name="reason"
|
name="reason"
|
||||||
required
|
required
|
||||||
>
|
>
|
||||||
@ -45,19 +45,8 @@
|
|||||||
label="代签入图片"
|
label="代签入图片"
|
||||||
name="images"
|
name="images"
|
||||||
>
|
>
|
||||||
<a-upload
|
<gx-upload v-model="formData.inImages" accept-types=".jpg,.png,.webp"
|
||||||
v-model:file-list="fileList"
|
:fileNumber="20" />
|
||||||
list-type="picture-card"
|
|
||||||
:before-upload="beforeUpload"
|
|
||||||
:custom-request="dummyRequest"
|
|
||||||
:multiple="true"
|
|
||||||
accept="image/*"
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<PlusOutlined />
|
|
||||||
<div style="margin-top: 8px">选择图片</div>
|
|
||||||
</div>
|
|
||||||
</a-upload>
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
@ -70,6 +59,8 @@ import { useForm } from '@/hooks'
|
|||||||
import { useModal } from '@/hooks'
|
import { useModal } from '@/hooks'
|
||||||
import { message } from 'ant-design-vue'
|
import { message } from 'ant-design-vue'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
|
import apis from '@/apis'
|
||||||
|
import GxUpload from '@/components/GxUpload/index.vue'
|
||||||
|
|
||||||
const emit = defineEmits(['ok'])
|
const emit = defineEmits(['ok'])
|
||||||
|
|
||||||
@ -81,16 +72,16 @@ const fileList = ref([])
|
|||||||
|
|
||||||
// 表单数据初始化
|
// 表单数据初始化
|
||||||
formData.value = reactive({
|
formData.value = reactive({
|
||||||
signTime: null,
|
// signTime: null,
|
||||||
reason: '',
|
reason: '',
|
||||||
images: [] // 存储 File 对象或 URL
|
images: [] // 存储 File 对象或 URL
|
||||||
})
|
})
|
||||||
|
|
||||||
// 表单校验规则
|
// 表单校验规则
|
||||||
formRules.value = {
|
formRules.value = {
|
||||||
signTime: [
|
// signTime: [
|
||||||
{ required: true, message: '请选择签入时间' }
|
// { required: true, message: '请选择签入时间' }
|
||||||
],
|
// ],
|
||||||
reason: [
|
reason: [
|
||||||
{ required: true, message: '请填写代签入原因' },
|
{ required: true, message: '请填写代签入原因' },
|
||||||
{ max: 100, message: '原因不能超过100字' }
|
{ max: 100, message: '原因不能超过100字' }
|
||||||
@ -111,7 +102,7 @@ function showCheckModal(record) {
|
|||||||
type: 'cancel',
|
type: 'cancel',
|
||||||
title: '代签入工单'
|
title: '代签入工单'
|
||||||
})
|
})
|
||||||
formData.value.signTime = null
|
// formData.value.signTime = null
|
||||||
formData.value.reason = ''
|
formData.value.reason = ''
|
||||||
fileList.value = []
|
fileList.value = []
|
||||||
}
|
}
|
||||||
@ -143,32 +134,62 @@ function dummyRequest(options) {
|
|||||||
// 确定提交
|
// 确定提交
|
||||||
async function handleOk() {
|
async function handleOk() {
|
||||||
try {
|
try {
|
||||||
const values = await formRef.value.validateFields()
|
await formRef.value?.validateFields();
|
||||||
showLoading()
|
showLoading();
|
||||||
|
|
||||||
// 收集文件(如果需要传给父组件)
|
const { id, status } = currentRecord.value || {};
|
||||||
const files = fileList.value
|
const reason = formData.value.reason;
|
||||||
.filter(f => f.status === 'done')
|
|
||||||
.map(f => f.originFileObj || f)
|
|
||||||
|
|
||||||
// 此处可调用 API 提交:签入时间、原因、图片
|
if (!id) {
|
||||||
// await apis.workOrder.proxySignIn({
|
message.error('工单ID不存在');
|
||||||
// id: currentRecord.value?.id,
|
return;
|
||||||
// signTime: dayjs(formData.value.signTime).format('YYYY-MM-DD HH:mm:ss'),
|
}
|
||||||
// reason: formData.value.reason,
|
|
||||||
// images: files
|
let result;
|
||||||
// })
|
|
||||||
|
if (status === 'Pending_Check-in') {
|
||||||
|
// 签入
|
||||||
|
result = await apis.workOrder.workOrderCheckIn({
|
||||||
|
orderID: id,
|
||||||
|
inProxyRemark: reason,
|
||||||
|
inImages: formData.inImages
|
||||||
|
});
|
||||||
|
} else if (status === 'Pending_Check-doing') {
|
||||||
|
result = await apis.workOrder.workOrderCheckDoing({
|
||||||
|
orderID: id,
|
||||||
|
outProxyRemark: reason,
|
||||||
|
outImages: formData.inImages
|
||||||
|
});
|
||||||
|
|
||||||
|
} else if (status === 'Pending_Check-out') {
|
||||||
|
result = await apis.workOrder.workOrderCheckOut({
|
||||||
|
orderID: id,
|
||||||
|
outProxyRemark: reason,
|
||||||
|
outImages: formData.inImages,
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
message.warning(`不支持的状态: ${status}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result?.success) {
|
||||||
|
let msg = '操作成功';
|
||||||
|
if (status === 'Pending_Check-in') msg = '代签入成功';
|
||||||
|
else if (status === 'Pending_Check-doing') msg = '作业签出成功';
|
||||||
|
else if (status === 'Pending_Check-out') msg = '最终签出成功';
|
||||||
|
|
||||||
|
message.success(msg);
|
||||||
|
hideModal();
|
||||||
|
emit('ok', { reason, images: files });
|
||||||
|
} else {
|
||||||
|
message.error(result?.message || '操作失败');
|
||||||
|
}
|
||||||
|
|
||||||
hideLoading()
|
|
||||||
hideModal()
|
|
||||||
emit('ok', {
|
|
||||||
signTime: formData.value.signTime,
|
|
||||||
reason: formData.value.reason,
|
|
||||||
images: files
|
|
||||||
})
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
hideLoading()
|
console.error('请求异常:', error);
|
||||||
console.error('表单验证失败:', error)
|
} finally {
|
||||||
|
hideLoading();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,139 +1,146 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-modal
|
<a-modal :width="780" :open="modal.open" :title="modal.title" :confirm-loading="modal.confirmLoading"
|
||||||
:width="780"
|
:after-close="onAfterClose" :cancel-text="cancelText" :ok-text="okText" @ok="handleOk" @cancel="handleCancel">
|
||||||
:open="modal.open"
|
<a-form ref="formRef" :model="formData" :rules="formRules">
|
||||||
:title="modal.title"
|
|
||||||
:confirm-loading="modal.confirmLoading"
|
|
||||||
:after-close="onAfterClose"
|
|
||||||
:cancel-text="cancelText"
|
|
||||||
:ok-text="okText"
|
|
||||||
@ok="handleOk"
|
|
||||||
@cancel="handleCancel"
|
|
||||||
>
|
|
||||||
<a-form
|
|
||||||
ref="formRef"
|
|
||||||
:model="formData"
|
|
||||||
:rules="formRules"
|
|
||||||
>
|
|
||||||
<!-- 用 Row + Col 实现两列排版 -->
|
<!-- 用 Row + Col 实现两列排版 -->
|
||||||
<a-row :gutter="24">
|
<a-row :gutter="24">
|
||||||
<!-- 服务对象(只读) -->
|
<!-- 服务对象(只读) -->
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
<a-form-item label="服务对象" :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
|
<a-form-item label="服务对象" :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
|
||||||
<a-input v-model:value="formData.serviceTarget" disabled />
|
<a-input v-model:value="formData.customerName" disabled />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
|
||||||
|
<!-- 服务对象身份证(只读) -->
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-form-item label="身份证号" :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
|
||||||
|
<a-input v-model:value="formData.customerIdCard" disabled />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<!-- 服务人员(下拉选择) -->
|
<!-- 服务人员(下拉选择) -->
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
<a-form-item label="服务人员" name="serviceStaff" required :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
|
<a-form-item label="服务人员" name="servicePersonId" required :label-col="{ span: 6 }"
|
||||||
<a-select
|
:wrapper-col="{ span: 18 }">
|
||||||
v-model:value="formData.serviceStaff"
|
<a-select v-model:value="formData.servicePersonId" placeholder="请选择服务人员" :options="staffOptions" />
|
||||||
placeholder="请选择服务人员"
|
|
||||||
:options="staffOptions"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<!-- 服务项目(单选下拉) -->
|
|
||||||
|
<!-- 工单类型 -->
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
<a-form-item label="服务项目" name="serviceItems" required :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
|
<a-form-item label="工单类型" name="orderType" required :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
|
||||||
<a-select
|
<a-select v-model:value="formData.orderType" placeholder="请选择工单类型">
|
||||||
v-model:value="formData.serviceItems"
|
<a-select-option v-for="item in dicsStore.dictOptions.ORDER_TYPE" :key="item.dval" :value="item.dval">
|
||||||
placeholder="请选择服务项目"
|
{{ item.introduction }}
|
||||||
:options="serviceItemOptions"
|
</a-select-option>
|
||||||
/>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<!-- 服务费用(普通输入框) -->
|
<!-- 服务项目名称 -->
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
<a-form-item label="服务费用" name="serviceFee" required :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
|
<a-form-item label="服务项目" name="projectName" required :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
|
||||||
<a-input
|
<a-select v-model:value="formData.projectName" placeholder="请选择服务项目" :options="serviceItemOptions" />
|
||||||
v-model:value="formData.serviceFee"
|
|
||||||
placeholder="请填写服务费用"
|
|
||||||
type="number"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<!-- 计划日期范围(占满一行) -->
|
<!-- 项目分类 -->
|
||||||
|
<!-- <a-col :span="12">
|
||||||
|
<a-form-item label="项目分类" name="categoryType" required :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
|
||||||
|
<a-select v-model:value="formData.categoryType" placeholder="请选择项目分类" :options="categoryTypeOptions" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col> -->
|
||||||
|
|
||||||
|
<!-- 服务费用 -->
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
<a-form-item label="计划开始日期" name="planDateRange" required :label-col="{ span:8}" :wrapper-col="{ span: 16 }">
|
<a-form-item label="服务费用" name="price" required :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
|
||||||
<a-range-picker
|
<a-input v-model:value="formData.price" placeholder="请填写服务费用" type="number" />
|
||||||
v-model:value="formData.planDateRange"
|
|
||||||
format="YYYY-MM-DD"
|
|
||||||
:placeholder="['开始日期', '结束日期']"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<!-- 计划开始时间 -->
|
<!-- 服务时长 -->
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
<a-form-item label="计划开始时间" name="planStartTime" required :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">
|
<a-form-item label="服务时长" name="duration" required :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
|
||||||
<a-time-picker
|
<a-input-number v-model:value="formData.duration" :min="0" :step="1" style="width: 80%"
|
||||||
v-model:value="formData.planStartTime"
|
placeholder="请填写服务时长" />
|
||||||
format="HH:mm:ss"
|
|
||||||
placeholder="请选择计划开始时间"
|
|
||||||
style="width: 100%"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
|
|
||||||
<!-- 要求工单时长(分钟) -->
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="要求工单时长" name="requiredDuration" required :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">
|
|
||||||
<a-input-number
|
|
||||||
v-model:value="formData.requiredDuration"
|
|
||||||
:min="0"
|
|
||||||
:step="1"
|
|
||||||
style="width: 80%"
|
|
||||||
placeholder="请填写要求工单时长"
|
|
||||||
/>
|
|
||||||
<span style="margin-left: 8px">分钟</span>
|
<span style="margin-left: 8px">分钟</span>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<!-- 服务地址(级联选择,占满一行) -->
|
<!-- 计划开始日期 -->
|
||||||
<a-col :span="24">
|
<a-col :span="12">
|
||||||
<a-form-item label="服务地址" name="serviceArea" required :label-col="{ span: 3 }" :wrapper-col="{ span: 21 }">
|
<a-form-item label="计划开始日期" name="plannedStartDate" required :label-col="{ span: 8 }"
|
||||||
<a-cascader
|
:wrapper-col="{ span: 16 }">
|
||||||
v-model:value="formData.serviceArea"
|
<a-date-picker v-model:value="formData.plannedStartDate" format="YYYY-MM-DD" placeholder="请选择计划开始日期"
|
||||||
:options="areaOptions"
|
style="width: 100%" />
|
||||||
change-on-select
|
|
||||||
placeholder="请选择服务地址"
|
|
||||||
style="width: 100%"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<!-- 详细地址(占满一行) -->
|
<!-- 计划结束日期 -->
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-form-item label="计划结束日期" name="plannedEndDate" required :label-col="{ span: 8 }"
|
||||||
|
:wrapper-col="{ span: 16 }">
|
||||||
|
<a-date-picker v-model:value="formData.plannedEndDate" format="YYYY-MM-DD" placeholder="请选择计划结束日期"
|
||||||
|
style="width: 100%" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
|
||||||
|
<!-- 计划服务开始时间 -->
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-form-item label="计划开始时间" name="plannedServiceStartDate" required :label-col="{ span: 8 }"
|
||||||
|
:wrapper-col="{ span: 16 }">
|
||||||
|
<a-time-picker v-model:value="formData.plannedServiceStartDate" format="HH:mm:ss" placeholder="请选择计划开始时间"
|
||||||
|
style="width: 100%" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
|
||||||
|
<!-- 要求工单时长 -->
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-form-item label="工单时长" name="workDuration" required :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">
|
||||||
|
<a-input-number v-model:value="formData.workDuration" :min="0" :step="1" style="width: 80%"
|
||||||
|
placeholder="请填写工单时长" />
|
||||||
|
<span style="margin-left: 8px">分钟</span>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
|
||||||
|
<!-- 服务地址(级联选择) -->
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="服务地址" name="areaCodes" required :label-col="{ span: 3 }" :wrapper-col="{ span: 21 }">
|
||||||
|
<AreaCascader v-model:value="formData.areaCodes" @change="onAreaChange" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
|
||||||
|
<!-- 详细地址 -->
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-form-item label="详细地址" name="detailAddress" required :label-col="{ span: 3 }" :wrapper-col="{ span: 21 }">
|
<a-form-item label="详细地址" name="detailAddress" required :label-col="{ span: 3 }" :wrapper-col="{ span: 21 }">
|
||||||
<a-input v-model:value="formData.detailAddress" placeholder="请填写详细地址" />
|
<a-input v-model:value="formData.detailAddress" placeholder="请填写详细地址" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<!-- 地图定位地址(只读+图标,占满一行) -->
|
<!-- 服务内容 -->
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-form-item label="地图定位地址" :label-col="{ span: 3 }" :wrapper-col="{ span: 21 }">
|
<a-form-item label="服务内容" name="content" :label-col="{ span: 3 }" :wrapper-col="{ span: 21 }">
|
||||||
<div style="display: flex; align-items: center;">
|
<a-textarea v-model:value="formData.content" placeholder="请填写服务内容"
|
||||||
<span style="margin-right: 8px; cursor: pointer;" @click="openMap">📍</span>
|
:auto-size="{ minRows: 2, maxRows: 4 }" />
|
||||||
<a-input v-model:value="formData.mapAddress" readonly />
|
|
||||||
</div>
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<!-- 备注(占满一行) -->
|
<!-- 服务小结 -->
|
||||||
<a-col :span="24">
|
<!-- <a-col :span="24">
|
||||||
<a-form-item label="备注" :label-col="{ span: 3 }" :wrapper-col="{ span: 21 }">
|
<a-form-item label="服务小结" name="serviceSummary" :label-col="{ span: 3 }" :wrapper-col="{ span: 21 }">
|
||||||
<a-textarea
|
<a-textarea v-model:value="formData.serviceSummary" placeholder="请填写服务小结"
|
||||||
v-model:value="formData.remark"
|
:auto-size="{ minRows: 2, maxRows: 4 }" />
|
||||||
placeholder="请填写备注"
|
|
||||||
:auto-size="{ minRows: 2, maxRows: 4 }"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col> -->
|
||||||
|
|
||||||
|
<!-- 用户需求反馈 -->
|
||||||
|
<!-- <a-col :span="24">
|
||||||
|
<a-form-item label="用户反馈" name="userDemandFeedback" :label-col="{ span: 3 }" :wrapper-col="{ span: 21 }">
|
||||||
|
<a-textarea v-model:value="formData.userDemandFeedback" placeholder="请填写用户需求反馈"
|
||||||
|
:auto-size="{ minRows: 2, maxRows: 4 }" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col> -->
|
||||||
</a-row>
|
</a-row>
|
||||||
</a-form>
|
</a-form>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
@ -145,38 +152,53 @@ import { useForm } from '@/hooks'
|
|||||||
import { useModal } from '@/hooks'
|
import { useModal } from '@/hooks'
|
||||||
import { message } from 'ant-design-vue'
|
import { message } from 'ant-design-vue'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
|
import apis from '@/apis'
|
||||||
|
import { useDicsStore } from '@/store'
|
||||||
|
import { config } from '@/config'
|
||||||
|
import AreaCascader from '@/components/AreaCascader/index.vue'
|
||||||
|
|
||||||
|
const dicsStore = useDicsStore()
|
||||||
|
|
||||||
// 模拟下拉选项(实际从接口获取)
|
// 模拟下拉选项(实际从接口获取)
|
||||||
const staffOptions = [
|
const staffOptions = ref([])
|
||||||
{ value: '邢光平', label: '邢光平' },
|
|
||||||
{ value: '张三', label: '张三' },
|
const serviceItemOptions = ref([])
|
||||||
{ value: '李四', label: '李四' }
|
|
||||||
|
const orderTypeOptions = [
|
||||||
|
{ value: '1', label: '类型1' },
|
||||||
|
{ value: '2', label: '类型2' }
|
||||||
]
|
]
|
||||||
|
|
||||||
const serviceItemOptions = [
|
const TZ = '+08:00'
|
||||||
{ value: '兴趣活动', label: '兴趣活动' },
|
|
||||||
{ value: '生活照料', label: '生活照料' },
|
const buildISODateTime = (dateMoment, timeStr = '00:00:00') => {
|
||||||
{ value: '康复训练', label: '康复训练' }
|
if (!dateMoment) return ''
|
||||||
]
|
return `${dateMoment.format('YYYY-MM-DD')}T${timeStr}${TZ}`
|
||||||
|
}
|
||||||
|
|
||||||
|
// const categoryTypeOptions = [
|
||||||
|
// { value: '1', label: '分类1' },
|
||||||
|
// { value: '2', label: '分类2' }
|
||||||
|
// ]
|
||||||
|
|
||||||
const areaOptions = [
|
const areaOptions = [
|
||||||
{
|
{
|
||||||
value: '江苏省',
|
value: '320000000000',
|
||||||
label: '江苏省',
|
label: '江苏省',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
value: '南通市',
|
value: '320600000000',
|
||||||
label: '南通市',
|
label: '南通市',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
value: '通州区',
|
value: '320612000000',
|
||||||
label: '通州区',
|
label: '通州区',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
value: '金新街道',
|
value: '320612001000',
|
||||||
label: '金新街道',
|
label: '金新街道',
|
||||||
children: [
|
children: [
|
||||||
{ value: '大石桥村委会', label: '大石桥村委会' }
|
{ value: '320612001203', label: '大石桥村委会' }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -192,33 +214,76 @@ const emit = defineEmits(['ok'])
|
|||||||
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||||
const { formData, formRef, formRules, resetForm } = useForm()
|
const { formData, formRef, formRules, resetForm } = useForm()
|
||||||
|
|
||||||
// 初始化表单数据(与图片展示内容一致)
|
// 当前编辑的工单原始数据
|
||||||
formData.value = reactive({
|
const originalRecord = ref({})
|
||||||
serviceTarget: '袁正芬', // 服务对象(只读)
|
|
||||||
serviceStaff: '邢光平', // 服务人员
|
// 初始化表单数据 - 完全按照后台字段
|
||||||
serviceItems: '兴趣活动', // 服务项目(单选)
|
const initFormData = () => ({
|
||||||
serviceFee: '40', // 服务费用
|
// 基本信息
|
||||||
planDateRange: [dayjs('2025-10-17'), dayjs('2025-10-31')], // 计划日期范围
|
id: '',
|
||||||
planStartTime: dayjs('00:03:00', 'HH:mm:ss'), // 计划开始时间
|
customerName: '',
|
||||||
requiredDuration: 90, // 要求工单时长(分钟)
|
customerIdCard: '',
|
||||||
serviceArea: ['江苏省', '南通市', '通州区', '金新街道', '大石桥村委会'], // 服务地址(级联)
|
customerId: '',
|
||||||
detailAddress: '南通市通州区川姜镇大石桥村九组131号', // 详细地址
|
orderNum: '',
|
||||||
mapAddress: '', // 地图定位地址(暂空)
|
orderType: '',
|
||||||
remark: '' // 备注
|
orderingMethod: '',
|
||||||
|
status: '',
|
||||||
|
stationId: '',
|
||||||
|
|
||||||
|
// 服务人员
|
||||||
|
servicePersonId: '',
|
||||||
|
|
||||||
|
// 项目信息
|
||||||
|
projectName: '',
|
||||||
|
// categoryType: '',
|
||||||
|
categoryMethod: '',
|
||||||
|
price: '',
|
||||||
|
duration: 0,
|
||||||
|
workDuration: 0,
|
||||||
|
|
||||||
|
// 时间信息
|
||||||
|
plannedStartDate: null,
|
||||||
|
plannedEndDate: null,
|
||||||
|
plannedServiceStartDate: null,
|
||||||
|
|
||||||
|
// 地址信息
|
||||||
|
areaCodes: [],
|
||||||
|
areaLabels: [],
|
||||||
|
detailAddress: '',
|
||||||
|
lat: 0,
|
||||||
|
lng: 0,
|
||||||
|
|
||||||
|
// 内容信息
|
||||||
|
content: '',
|
||||||
|
// serviceSummary: '',
|
||||||
|
// userDemandFeedback: '',
|
||||||
|
|
||||||
|
// 其他
|
||||||
|
orderAddId: '',
|
||||||
|
signInAt: '',
|
||||||
|
signOutAt: '',
|
||||||
|
actualServiceDuration: 0
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 初始化表单
|
||||||
|
formData.value = initFormData()
|
||||||
|
|
||||||
// 表单验证规则
|
// 表单验证规则
|
||||||
formRules.value = {
|
formRules.value = {
|
||||||
serviceStaff: [{ required: true, message: '请选择服务人员' }],
|
servicePersonId: [{ required: true, message: '请选择服务人员' }],
|
||||||
serviceItems: [{ required: true, message: '请选择服务项目' }],
|
orderType: [{ required: true, message: '请选择工单类型' }],
|
||||||
serviceFee: [
|
projectName: [{ required: true, message: '请选择服务项目' }],
|
||||||
|
// categoryType: [{ required: true, message: '请选择项目分类' }],
|
||||||
|
price: [
|
||||||
{ required: true, message: '请填写服务费用' },
|
{ required: true, message: '请填写服务费用' },
|
||||||
{ pattern: /^\d+$/, message: '请输入有效数字' }
|
{ pattern: /^\d+$/, message: '请输入有效数字' }
|
||||||
],
|
],
|
||||||
planDateRange: [{ required: true, message: '请选择计划日期范围' }],
|
duration: [{ required: true, message: '请填写服务时长' }],
|
||||||
planStartTime: [{ required: true, message: '请选择计划开始时间' }],
|
workDuration: [{ required: true, message: '请填写工单时长' }],
|
||||||
requiredDuration: [{ required: true, message: '请填写要求工单时长' }],
|
plannedStartDate: [{ required: true, message: '请选择计划开始日期' }],
|
||||||
serviceArea: [{ required: true, message: '请选择服务地址' }],
|
plannedEndDate: [{ required: true, message: '请选择计划结束日期' }],
|
||||||
|
plannedServiceStartDate: [{ required: true, message: '请选择计划开始时间' }],
|
||||||
|
areaCodes: [{ required: true, message: '请选择服务地址' }],
|
||||||
detailAddress: [{ required: true, message: '请填写详细地址' }]
|
detailAddress: [{ required: true, message: '请填写详细地址' }]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,35 +291,150 @@ formRules.value = {
|
|||||||
const cancelText = ref('取消')
|
const cancelText = ref('取消')
|
||||||
const okText = ref('保存')
|
const okText = ref('保存')
|
||||||
|
|
||||||
// 打开地图(示例方法,可扩展真实逻辑)
|
|
||||||
function openMap() {
|
async function getPageList() {
|
||||||
message.info('地图定位功能待实现')
|
console.log('获取服务人员列表:')
|
||||||
|
try {
|
||||||
|
const res = await apis.serviceStaffList
|
||||||
|
.getProjectList({
|
||||||
|
// companyId: storage.local.getItem('companyId'),
|
||||||
|
// stationId: storage.local.getItem('stationId'),
|
||||||
|
pageSize: 999,
|
||||||
|
current: 1,
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log('获取服务人员列表:', res)
|
||||||
|
|
||||||
|
if (res && res.success) {
|
||||||
|
staffOptions.value = res.data.map(item => ({
|
||||||
|
value: item.id,
|
||||||
|
label: item.name
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('API 请求失败:', error)
|
||||||
|
throw error // 或者 return null 等
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
async function getCategoriesAll() {
|
||||||
|
try {
|
||||||
|
console.log(111)
|
||||||
|
const { success, data, total } = await apis.projectType
|
||||||
|
.getProjectListAll({
|
||||||
|
pageSize:100, current:1,
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
if (config('http.code.success') === success) {
|
||||||
|
serviceItemOptions.value = data.map(item=>({value:item.id,label:item.name}))
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
// 确定保存
|
// 确定保存
|
||||||
async function handleOk() {
|
async function handleOk() {
|
||||||
try {
|
try {
|
||||||
const values = await formRef.value.validateFields()
|
const values = await formRef.value.validateFields()
|
||||||
showLoading()
|
showLoading()
|
||||||
|
|
||||||
// 构造提交数据(根据后端需求调整格式,如日期转字符串)
|
// 构建完整的时间格式,处理空值情况
|
||||||
const payload = {
|
const buildFullDateTime = (dateMoment, timeMoment) => {
|
||||||
...values,
|
if (!dateMoment) return null // 返回 null 而不是空字符串
|
||||||
planStartDate: values.planDateRange?.[0]?.format('YYYY-MM-DD') || '',
|
const dateStr = dateMoment.format('YYYY-MM-DD')
|
||||||
planEndDate: values.planDateRange?.[1]?.format('YYYY-MM-DD') || '',
|
const timeStr = timeMoment ? timeMoment.format('HH:mm:ss') : '00:00:00'
|
||||||
planStartTime: values.planStartTime?.format('HH:mm:ss') || ''
|
return `${dateStr}T${timeStr}${TZ}`
|
||||||
}
|
}
|
||||||
|
|
||||||
// 模拟接口请求:await apis.workOrder.save(payload)
|
// 单独处理服务开始时间(需要日期+时间)
|
||||||
setTimeout(() => {
|
const buildServiceStartTime = (dateMoment, timeMoment) => {
|
||||||
|
if (!dateMoment || !timeMoment) return null
|
||||||
|
const dateStr = dateMoment.format('YYYY-MM-DD')
|
||||||
|
const timeStr = timeMoment.format('HH:mm:ss')
|
||||||
|
return `${dateStr}T${timeStr}${TZ}`
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构造提交数据 - 完全按照后台格式
|
||||||
|
const payload = {
|
||||||
|
// 基本信息
|
||||||
|
id: originalRecord.value.id,
|
||||||
|
customerId: originalRecord.value.customerId || '',
|
||||||
|
orderNum: originalRecord.value.orderNum || '',
|
||||||
|
orderType: values.orderType,
|
||||||
|
orderingMethod: originalRecord.value.orderingMethod || '',
|
||||||
|
status: originalRecord.value.status || '',
|
||||||
|
stationId: originalRecord.value.stationId || '',
|
||||||
|
|
||||||
|
// 服务人员
|
||||||
|
servicePersonId: values.servicePersonId,
|
||||||
|
|
||||||
|
// 项目信息
|
||||||
|
projects: [{
|
||||||
|
name: values.projectName,
|
||||||
|
categoryMethod: originalRecord.value.projects?.[0]?.categoryMethod || '',
|
||||||
|
price: Number(values.price),
|
||||||
|
duration: Number(values.duration),
|
||||||
|
num: originalRecord.value.projects?.[0]?.num || 0
|
||||||
|
}],
|
||||||
|
price: Number(values.price),
|
||||||
|
workDuration: Number(values.workDuration),
|
||||||
|
|
||||||
|
// 时间信息 - 修正时间格式,处理空值
|
||||||
|
plannedStartDate: buildFullDateTime(values.plannedStartDate, values.plannedServiceStartDate),
|
||||||
|
plannedEndDate: buildFullDateTime(values.plannedEndDate, null),
|
||||||
|
plannedServiceStartDate: buildServiceStartTime(values.plannedStartDate, values.plannedServiceStartDate),
|
||||||
|
|
||||||
|
// 地址信息
|
||||||
|
areaCodes: values.areaCodes,
|
||||||
|
areaLabels: originalRecord.value.areaLabels || [],
|
||||||
|
detailAddress: values.detailAddress,
|
||||||
|
lat: originalRecord.value.lat || 0,
|
||||||
|
lng: originalRecord.value.lng || 0,
|
||||||
|
|
||||||
|
// 内容信息
|
||||||
|
content: values.content || '',
|
||||||
|
|
||||||
|
// 其他信息
|
||||||
|
orderAddId: originalRecord.value.orderAddId || '',
|
||||||
|
signInAt: originalRecord.value.signInAt || '',
|
||||||
|
signOutAt: originalRecord.value.signOutAt || '',
|
||||||
|
actualServiceDuration: originalRecord.value.actualServiceDuration || 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清理空值字段(可选,根据后端要求)
|
||||||
|
Object.keys(payload).forEach(key => {
|
||||||
|
if (payload[key] === null || payload[key] === '') {
|
||||||
|
delete payload[key]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log('提交的数据:', JSON.stringify(payload, null, 2))
|
||||||
|
|
||||||
|
// 调用编辑接口
|
||||||
|
const res = await apis.workOrder.sendWorkOrder(originalRecord.value.id, payload)
|
||||||
|
|
||||||
|
if (res && res.success) {
|
||||||
|
message.success('保存成功')
|
||||||
hideLoading()
|
hideLoading()
|
||||||
hideModal()
|
hideModal()
|
||||||
emit('ok', payload)
|
emit('ok')
|
||||||
message.success('保存成功')
|
} else {
|
||||||
}, 500)
|
message.error(res?.message || '保存失败')
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('表单验证失败:', error)
|
console.error('表单验证失败:', error)
|
||||||
hideLoading()
|
hideLoading()
|
||||||
|
message.error('保存失败,请检查表单数据')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,34 +446,76 @@ function handleCancel() {
|
|||||||
// 关闭后重置表单
|
// 关闭后重置表单
|
||||||
function onAfterClose() {
|
function onAfterClose() {
|
||||||
resetForm()
|
resetForm()
|
||||||
|
originalRecord.value = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 暴露“显示编辑弹窗”方法(若需外部调用)
|
// 暴露"显示编辑弹窗"方法
|
||||||
defineExpose({
|
function showEditModal(record) {
|
||||||
showEditModal(record) {
|
getPageList()
|
||||||
// 若为“编辑”场景,需将 record 数据映射到 formData(示例逻辑)
|
getCategoriesAll()
|
||||||
formData.value = reactive({
|
if (!record) return
|
||||||
serviceTarget: record?.serviceTarget || '袁正芬',
|
|
||||||
serviceStaff: record?.serviceStaff || '邢光平',
|
console.log('编辑工单数据:', record)
|
||||||
serviceItems: record?.serviceItems || '兴趣活动',
|
|
||||||
serviceFee: record?.serviceFee || '40',
|
// 保存原始数据
|
||||||
planDateRange: record?.planDateRange
|
originalRecord.value = { ...record }
|
||||||
? [dayjs(record.planStartDate), dayjs(record.planEndDate)]
|
|
||||||
: [dayjs('2025-10-17'), dayjs('2025-10-31')],
|
// 映射数据到表单 - 完全按照后台字段
|
||||||
planStartTime: record?.planStartTime
|
formData.value = {
|
||||||
? dayjs(record.planStartTime, 'HH:mm:ss')
|
// 基本信息
|
||||||
: dayjs('00:03:00', 'HH:mm:ss'),
|
id: record.id,
|
||||||
requiredDuration: record?.requiredDuration || 90,
|
customerName: record.customerName || '',
|
||||||
serviceArea: record?.serviceArea || ['江苏省', '南通市', '通州区', '金新街道', '大石桥村委会'],
|
customerIdCard: record.customerIdCard || '',
|
||||||
detailAddress: record?.detailAddress || '南通市通州区川姜镇大石桥村九组131号',
|
customerId: record.customerId || '',
|
||||||
mapAddress: record?.mapAddress || '',
|
orderNum: record.orderNum || '',
|
||||||
remark: record?.remark || ''
|
orderType: record.orderType || '',
|
||||||
})
|
orderingMethod: record.orderingMethod || '',
|
||||||
|
status: record.status || '',
|
||||||
|
stationId: record.stationId || '',
|
||||||
|
|
||||||
|
// 服务人员
|
||||||
|
servicePersonId: record.servicePersonId || '',
|
||||||
|
|
||||||
|
// 项目信息
|
||||||
|
projectName: record.projects?.[0]?.name || '',
|
||||||
|
// categoryType: record.projects?.[0]?.categoryType || '',
|
||||||
|
categoryMethod: record.projects?.[0]?.categoryMethod || '',
|
||||||
|
price: record.projects?.[0]?.price?.toString() || '',
|
||||||
|
duration: record.projects?.[0]?.duration || 0,
|
||||||
|
workDuration: record.workDuration || 0,
|
||||||
|
|
||||||
|
// 时间信息
|
||||||
|
plannedStartDate: record.plannedStartDate ? dayjs(record.plannedStartDate) : null,
|
||||||
|
plannedEndDate: record.plannedEndDate ? dayjs(record.plannedEndDate) : null,
|
||||||
|
plannedServiceStartDate: record.plannedServiceStartDate ? dayjs(record.plannedServiceStartDate, 'HH:mm:ss') : null,
|
||||||
|
|
||||||
|
// 地址信息
|
||||||
|
areaCodes: record.areaCodes || [],
|
||||||
|
areaLabels: record.areaLabels || [],
|
||||||
|
detailAddress: record.detailAddress || '',
|
||||||
|
lat: record.lat || 0,
|
||||||
|
lng: record.lng || 0,
|
||||||
|
|
||||||
|
// 内容信息
|
||||||
|
content: record.content || '',
|
||||||
|
// serviceSummary: record.serviceSummary || '',
|
||||||
|
// userDemandFeedback: record.userDemandFeedback || '',
|
||||||
|
|
||||||
|
// 其他
|
||||||
|
orderAddId: record.orderAddId || '',
|
||||||
|
signInAt: record.signInAt || '',
|
||||||
|
signOutAt: record.signOutAt || '',
|
||||||
|
actualServiceDuration: record.actualServiceDuration || 0
|
||||||
|
}
|
||||||
|
|
||||||
showModal({
|
showModal({
|
||||||
type: 'edit',
|
type: 'edit',
|
||||||
title: '编辑工单'
|
title: '编辑工单'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 暴露方法给父组件
|
||||||
|
defineExpose({
|
||||||
|
showEditModal
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
@ -9,8 +9,9 @@
|
|||||||
:ok-text="okText"
|
:ok-text="okText"
|
||||||
@ok="handleOk"
|
@ok="handleOk"
|
||||||
@cancel="handleCancel"
|
@cancel="handleCancel"
|
||||||
|
:ok-button-props="{ htmlType: 'submit' }"
|
||||||
>
|
>
|
||||||
<a-form layout="vertical" ref="formRef" :model="formData" :rules="formRules">
|
<a-form layout="vertical" ref="formRef" :model="formData" :rules="formRules" @finish="handleOk" >
|
||||||
<a-form-item
|
<a-form-item
|
||||||
:label="'作废原因'"
|
:label="'作废原因'"
|
||||||
name="reason"
|
name="reason"
|
||||||
@ -27,10 +28,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import { message, Modal } from 'ant-design-vue'
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { useForm } from '@/hooks'
|
import { useForm } from '@/hooks'
|
||||||
import { useModal } from '@/hooks'
|
import { useModal } from '@/hooks'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import apis from '@/apis'
|
||||||
|
|
||||||
const emit = defineEmits(['ok'])
|
const emit = defineEmits(['ok'])
|
||||||
|
|
||||||
@ -66,18 +69,44 @@ function showCancelModal(record) {
|
|||||||
|
|
||||||
// 确定
|
// 确定
|
||||||
async function handleOk() {
|
async function handleOk() {
|
||||||
|
console.log("handleOk 方法被调用")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// 验证表单
|
||||||
await formRef.value.validateFields()
|
await formRef.value.validateFields()
|
||||||
|
console.log("表单验证通过")
|
||||||
|
|
||||||
showLoading()
|
showLoading()
|
||||||
|
|
||||||
// 此处可调用 API 提交作废原因
|
// 调用 API
|
||||||
// await apis.workOrder.cancelWorkOrder({ id: props.workOrderId, reason: formData.value.reason })
|
const res = await apis.workOrder.invalidWorkOrder(currentRecord.value.id, {
|
||||||
|
reason: formData.value.reason
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log("API响应:", res)
|
||||||
|
|
||||||
|
if(res && res.success){
|
||||||
|
message.success('操作成功')
|
||||||
|
} else {
|
||||||
|
message.error(res?.message || '操作失败')
|
||||||
|
}
|
||||||
|
|
||||||
hideLoading()
|
hideLoading()
|
||||||
hideModal()
|
hideModal()
|
||||||
emit('ok', formData.value.reason) // 可选:将原因传回父组件
|
emit('ok', formData.value.reason)
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error("捕获到错误:", error)
|
||||||
hideLoading()
|
hideLoading()
|
||||||
|
|
||||||
|
// 区分是表单验证错误还是API错误
|
||||||
|
if (error.errorFields) {
|
||||||
|
console.log("表单验证错误:", error.errorFields)
|
||||||
|
message.error('请检查表单填写是否正确')
|
||||||
|
} else {
|
||||||
|
console.error("API调用错误:", error)
|
||||||
|
message.error('操作失败,请重试')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,34 +12,31 @@
|
|||||||
@cancel="handleCancel"
|
@cancel="handleCancel"
|
||||||
>
|
>
|
||||||
<a-tabs default-active-key="1" :tab-bar-style="{ marginBottom: '16px' }">
|
<a-tabs default-active-key="1" :tab-bar-style="{ marginBottom: '16px' }">
|
||||||
<!-- 工单信息页签(已替换为现有布局与字段) -->
|
<!-- 工单信息页签 -->
|
||||||
<a-tab-pane key="1" tab="工单信息">
|
<a-tab-pane key="1" tab="工单信息">
|
||||||
<a-form layout="vertical" ref="formRef" :model="formData">
|
<a-form layout="vertical" ref="formRef" :model="formData">
|
||||||
<!-- 1. 工单信息 -->
|
<!-- 工单信息 -->
|
||||||
<a-card class="mb-4" title="工单信息">
|
<a-card class="mb-4" title="工单信息">
|
||||||
<a-row :gutter="16">
|
<a-row :gutter="16">
|
||||||
<a-col :span="8">
|
<a-col :span="12">
|
||||||
<a-form-item label="工单号" name="workOrderNo">
|
<a-form-item label="工单号" name="workOrderNo">
|
||||||
<a-input v-model:value="formData.workOrderNo" disabled />
|
<a-input v-model:value="formData.workOrderNo" disabled />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="8">
|
<a-col :span="12">
|
||||||
<a-form-item label="工单状态" name="status">
|
<a-form-item label="工单状态" name="status">
|
||||||
<a-input v-model:value="formData.status" disabled />
|
<a-input v-model:value="formData.status" disabled />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="8">
|
<a-col :span="12">
|
||||||
<a-form-item label="工单类型" name="type">
|
<a-form-item label="工单类型" name="type">
|
||||||
<div class="flex items-center">
|
<a-input v-model:value="formData.type" disabled />
|
||||||
<a-input v-model:value="formData.type" disabled style="flex: 1" />
|
|
||||||
<a-button type="link" disabled class="ml-2">修改</a-button>
|
|
||||||
</div>
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
</a-card>
|
</a-card>
|
||||||
|
|
||||||
<!-- 2. 用户信息 -->
|
<!-- 用户信息 -->
|
||||||
<a-card class="mb-4" title="用户信息">
|
<a-card class="mb-4" title="用户信息">
|
||||||
<a-row :gutter="16">
|
<a-row :gutter="16">
|
||||||
<a-col :span="8">
|
<a-col :span="8">
|
||||||
@ -72,38 +69,38 @@
|
|||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
<a-form-item label="评估等级" name="assessmentLevel">
|
<a-form-item label="评估等级" name="assessmentLevel">
|
||||||
<a-input v-model:value="formData.assessmentLevel" disabled placeholder="" />
|
<a-input v-model:value="formData.assessmentLevel" disabled />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
</a-card>
|
</a-card>
|
||||||
|
|
||||||
<!-- 3. 服务信息 -->
|
<!-- 服务信息 -->
|
||||||
<a-card class="mb-4" title="服务信息">
|
<a-card class="mb-4" title="服务信息">
|
||||||
<a-row :gutter="16">
|
<a-row :gutter="16">
|
||||||
<a-col :span="8">
|
<a-col :span="12">
|
||||||
<a-form-item label="护理员" name="nurseName">
|
<a-form-item label="护理员" name="nurseName">
|
||||||
<a-input v-model:value="formData.nurseName" disabled />
|
<a-input v-model:value="formData.nurseName" disabled />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="8">
|
<a-col :span="12">
|
||||||
<a-form-item label="护理等级" name="nurseLevel">
|
<a-form-item label="护理等级" name="nurseLevel">
|
||||||
<a-input v-model:value="formData.nurseLevel" disabled placeholder="" />
|
<a-input v-model:value="formData.nurseLevel" disabled />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="8">
|
<a-col :span="12">
|
||||||
<a-form-item label="计划开始日期" name="planStartDate">
|
<a-form-item label="计划开始日期" name="planStartDate">
|
||||||
<a-date-picker v-model:value="formData.planStartDate" format="YYYY-MM-DD" disabled style="width: 100%" />
|
<a-date-picker v-model:value="formData.planStartDate" format="YYYY-MM-DD" disabled style="width: 100%" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="8">
|
<a-col :span="12">
|
||||||
<a-form-item label="计划结束日期" name="planEndDate">
|
<a-form-item label="计划结束日期" name="planEndDate">
|
||||||
<a-date-picker v-model:value="formData.planEndDate" format="YYYY-MM-DD" disabled style="width: 100%" />
|
<a-date-picker v-model:value="formData.planEndDate" format="YYYY-MM-DD" disabled style="width: 100%" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="8">
|
<a-col :span="12">
|
||||||
<a-form-item label="计划服务开始时间" name="planStartTime">
|
<a-form-item label="计划服务开始时间" name="planStartTime">
|
||||||
<a-time-picker v-model:value="formData.planStartTime" format="HH:mm:ss" disabled style="width: 100%" />
|
<a-time-picker v-model:value="formData.planStartTime" format="HH:mm" disabled style="width: 100%" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
@ -116,17 +113,17 @@
|
|||||||
<a-button type="link" @click="showServiceItems" disabled>项目清单</a-button>
|
<a-button type="link" @click="showServiceItems" disabled>项目清单</a-button>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="8">
|
<a-col :span="24">
|
||||||
<a-form-item label="服务内容" name="serviceContent">
|
<a-form-item label="服务内容" name="serviceContent">
|
||||||
<a-input v-model:value="formData.serviceContent" disabled placeholder="" />
|
<a-textarea v-model:value="formData.serviceContent" disabled rows="3" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="8">
|
<a-col :span="12">
|
||||||
<a-form-item label="下单人" name="orderer">
|
<a-form-item label="下单人" name="orderer">
|
||||||
<a-input v-model:value="formData.orderer" disabled />
|
<a-input v-model:value="formData.orderer" disabled />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="8">
|
<a-col :span="12">
|
||||||
<a-form-item label="下单时间" name="orderTime">
|
<a-form-item label="下单时间" name="orderTime">
|
||||||
<a-date-picker v-model:value="formData.orderTime" show-time format="YYYY-MM-DD HH:mm:ss" disabled style="width: 100%" />
|
<a-date-picker v-model:value="formData.orderTime" show-time format="YYYY-MM-DD HH:mm:ss" disabled style="width: 100%" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
@ -134,147 +131,23 @@
|
|||||||
</a-row>
|
</a-row>
|
||||||
</a-card>
|
</a-card>
|
||||||
|
|
||||||
<!-- 4. 签到信息(新增模块,匹配现有布局) -->
|
<!-- 服务小结与反馈 -->
|
||||||
<a-card class="mb-4" title="签到信息">
|
|
||||||
<a-row :gutter="16">
|
|
||||||
<!-- 签入基础信息 -->
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="签入时间" name="checkInTime">
|
|
||||||
<a-input v-model:value="formData.checkInTime" disabled style="color: red" />
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="签入距离" name="checkInDistance">
|
|
||||||
<a-input v-model:value="formData.checkInDistance" disabled />
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="24">
|
|
||||||
<a-form-item label="签入地址" name="checkInAddress">
|
|
||||||
<a-input v-model:value="formData.checkInAddress" disabled style="color: red" />
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
|
|
||||||
<!-- 签入图片 -->
|
|
||||||
<a-col :span="24">
|
|
||||||
<a-form-item label="签入图片" name="checkInImage">
|
|
||||||
<div class="flex items-center">
|
|
||||||
<a-link v-if="formData.checkInImage" :href="formData.checkInImage" target="_blank" rel="noopener noreferrer">
|
|
||||||
查看图片
|
|
||||||
</a-link>
|
|
||||||
<span v-else>-</span>
|
|
||||||
<a-button type="primary" size="small" class="ml-4" disabled>编 辑</a-button>
|
|
||||||
</div>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
|
|
||||||
<!-- 签入备注与代签入 -->
|
|
||||||
<a-col :span="24">
|
|
||||||
<a-form-item label="签入备注" name="checkInRemark">
|
|
||||||
<a-input v-model:value="formData.checkInRemark" disabled placeholder="" />
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="代签入操作人" name="proxyCheckInOperator">
|
|
||||||
<a-input v-model:value="formData.proxyCheckInOperator" disabled placeholder="" />
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="代签入时间" name="proxyCheckInTime">
|
|
||||||
<a-date-picker v-model:value="formData.proxyCheckInTime" show-time format="YYYY-MM-DD HH:mm:ss" disabled style="width: 100%" />
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="24">
|
|
||||||
<a-form-item label="代签入原因" name="proxyCheckInReason">
|
|
||||||
<a-input v-model:value="formData.proxyCheckInReason" disabled placeholder="" />
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
|
|
||||||
<!-- 录音与过程文件 -->
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="签入录音" name="checkInRecording">
|
|
||||||
<a-input v-model:value="formData.checkInRecording" disabled placeholder="无" />
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="进行中的图片" name="inProgressImage">
|
|
||||||
<div class="flex items-center">
|
|
||||||
<span v-if="!formData.inProgressImage">-</span>
|
|
||||||
<a-button type="primary" size="small" class="ml-2" disabled>编 辑</a-button>
|
|
||||||
</div>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="24">
|
|
||||||
<a-form-item label="进行中的视频" name="inProgressVideo">
|
|
||||||
<a-input v-model:value="formData.inProgressVideo" disabled placeholder="" />
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
|
|
||||||
<!-- 签出与服务时长 -->
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="代签出操作人" name="proxyCheckOutOperator">
|
|
||||||
<a-input v-model:value="formData.proxyCheckOutOperator" disabled placeholder="" />
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="代签出时间" name="proxyCheckOutTime">
|
|
||||||
<a-date-picker v-model:value="formData.proxyCheckOutTime" show-time format="YYYY-MM-DD HH:mm:ss" disabled style="width: 100%" />
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="24">
|
|
||||||
<a-form-item label="代签出原因" name="proxyCheckOutReason">
|
|
||||||
<a-input v-model:value="formData.proxyCheckOutReason" disabled placeholder="" />
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="计划服务时长" name="plannedServiceDuration">
|
|
||||||
<a-input v-model:value="formData.plannedServiceDuration" disabled />
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="标准服务时长" name="standardServiceDuration">
|
|
||||||
<a-input v-model:value="formData.standardServiceDuration" disabled placeholder="" />
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="标准服务费用" name="standardServiceFee">
|
|
||||||
<a-input v-model:value="formData.standardServiceFee" disabled placeholder="" />
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="实际服务时长" name="actualServiceDuration">
|
|
||||||
<a-input v-model:value="formData.actualServiceDuration" disabled placeholder="" />
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="签出录音" name="checkOutRecording">
|
|
||||||
<a-input v-model:value="formData.checkOutRecording" disabled placeholder="无" />
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="全程录音" name="fullRecording">
|
|
||||||
<a-input v-model:value="formData.fullRecording" disabled placeholder="无" />
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
</a-card>
|
|
||||||
|
|
||||||
<!-- 5. 服务小结与反馈 -->
|
|
||||||
<a-card class="mb-4" title="服务小结与反馈">
|
<a-card class="mb-4" title="服务小结与反馈">
|
||||||
<a-row :gutter="16">
|
<a-row :gutter="16">
|
||||||
<a-col :span="12">
|
<a-col :span="24">
|
||||||
<a-form-item label="服务小结" name="summary">
|
<a-form-item label="服务小结" name="summary">
|
||||||
<a-input v-model:value="formData.summary" disabled placeholder="" />
|
<a-textarea v-model:value="formData.summary" disabled rows="3" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="24">
|
||||||
<a-form-item label="用户需求反馈" name="feedback">
|
<a-form-item label="用户需求反馈" name="feedback">
|
||||||
<a-input v-model:value="formData.feedback" disabled placeholder="" />
|
<a-textarea v-model:value="formData.feedback" disabled rows="3" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
</a-card>
|
</a-card>
|
||||||
|
|
||||||
<!-- 6. 异常工单处理信息 -->
|
<!-- 异常处理信息 -->
|
||||||
<a-card class="mb-4" title="异常工单处理信息">
|
<a-card class="mb-4" title="异常工单处理信息">
|
||||||
<a-row :gutter="16">
|
<a-row :gutter="16">
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
@ -284,12 +157,12 @@
|
|||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
<a-form-item label="处理原因" name="exceptionReason">
|
<a-form-item label="处理原因" name="exceptionReason">
|
||||||
<a-input v-model:value="formData.exceptionReason" disabled placeholder="" />
|
<a-input v-model:value="formData.exceptionReason" disabled />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
<a-form-item label="处理人" name="exceptionHandler">
|
<a-form-item label="处理人" name="exceptionHandler">
|
||||||
<a-input v-model:value="formData.exceptionHandler" disabled placeholder="" />
|
<a-input v-model:value="formData.exceptionHandler" disabled />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
@ -302,7 +175,7 @@
|
|||||||
</a-form>
|
</a-form>
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
|
|
||||||
<!-- 服务评价页签(完全保留原内容,未修改) -->
|
<!-- 服务评价页签 -->
|
||||||
<a-tab-pane key="2" tab="服务评价">
|
<a-tab-pane key="2" tab="服务评价">
|
||||||
<a-space direction="vertical" style="width: 100%">
|
<a-space direction="vertical" style="width: 100%">
|
||||||
<!-- 回访评价 -->
|
<!-- 回访评价 -->
|
||||||
@ -364,15 +237,20 @@
|
|||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { message } from 'ant-design-vue'
|
import { message } from 'ant-design-vue'
|
||||||
import { useModal, useForm } from '@/hooks'
|
import { useModal, useForm } from '@/hooks'
|
||||||
|
import apis from '@/apis'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
|
import { useDicsStore } from '@/store'
|
||||||
|
|
||||||
|
const dicsStore = useDicsStore()
|
||||||
|
|
||||||
|
|
||||||
const emit = defineEmits(['ok'])
|
const emit = defineEmits(['ok'])
|
||||||
const { modal, showModal, hideModal } = useModal()
|
const { modal, showModal, hideModal } = useModal()
|
||||||
const { formData, formRef, resetForm } = useForm()
|
const { formData, formRef, resetForm } = useForm()
|
||||||
|
|
||||||
// 初始化表单数据(新增签到信息相关字段,匹配现有页面)
|
|
||||||
|
// 初始化表单数据(含服务评价字段)
|
||||||
const initFormData = () => ({
|
const initFormData = () => ({
|
||||||
// 原有基础字段
|
|
||||||
workOrderNo: '',
|
workOrderNo: '',
|
||||||
status: '',
|
status: '',
|
||||||
type: '',
|
type: '',
|
||||||
@ -397,30 +275,7 @@ const initFormData = () => ({
|
|||||||
exceptionReason: '',
|
exceptionReason: '',
|
||||||
exceptionHandler: '',
|
exceptionHandler: '',
|
||||||
exceptionTime: null,
|
exceptionTime: null,
|
||||||
|
// 服务评价相关字段
|
||||||
// 新增:签到信息字段(与现有页面一一对应)
|
|
||||||
checkInTime: '', // 格式:2025-10-17 11:19:59(字符串,含红色样式)
|
|
||||||
checkInDistance: '', // 格式:12163 m
|
|
||||||
checkInAddress: '', // 格式:江苏省南通市...(字符串,含红色样式)
|
|
||||||
checkInImage: '', // 图片预览链接
|
|
||||||
checkInRemark: '', // 签入备注
|
|
||||||
proxyCheckInOperator: '', // 代签入操作人
|
|
||||||
proxyCheckInTime: null, // 代签入时间(日期时间类型)
|
|
||||||
proxyCheckInReason: '', // 代签入原因
|
|
||||||
checkInRecording: '无', // 签入录音(默认无)
|
|
||||||
inProgressImage: '', // 进行中的图片(编辑按钮控制)
|
|
||||||
inProgressVideo: '', // 进行中的视频
|
|
||||||
proxyCheckOutOperator: '', // 代签出操作人
|
|
||||||
proxyCheckOutTime: null, // 代签出时间(日期时间类型)
|
|
||||||
proxyCheckOutReason: '', // 代签出原因
|
|
||||||
plannedServiceDuration: '', // 格式:90 分钟
|
|
||||||
standardServiceDuration: '', // 标准服务时长
|
|
||||||
standardServiceFee: '', // 标准服务费用
|
|
||||||
actualServiceDuration: '', // 实际服务时长
|
|
||||||
checkOutRecording: '无', // 签出录音(默认无)
|
|
||||||
fullRecording: '无', // 全程录音(默认无)
|
|
||||||
|
|
||||||
// 原有:服务评价相关字段(完全保留)
|
|
||||||
visitSatisfaction: '',
|
visitSatisfaction: '',
|
||||||
staffSatisfaction: '',
|
staffSatisfaction: '',
|
||||||
visitFeedback: '',
|
visitFeedback: '',
|
||||||
@ -440,7 +295,7 @@ formData.value = initFormData()
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查看工单(唯一打开弹框的方法)
|
* 查看工单(唯一打开弹框的方法)
|
||||||
* @param {Object} record - 工单数据(需包含新增的签到信息字段)
|
* @param {Object} record - 工单数据
|
||||||
*/
|
*/
|
||||||
function handleView(record = {}) {
|
function handleView(record = {}) {
|
||||||
showModal({ mode: 'view', title: '查看工单' })
|
showModal({ mode: 'view', title: '查看工单' })
|
||||||
@ -448,68 +303,135 @@ function handleView(record = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载工单数据到表单(新增签到信息字段的赋值逻辑)
|
* 加载工单数据到表单
|
||||||
* @param {Object} record - 工单数据
|
* @param {Object} record - 工单数据
|
||||||
*/
|
*/
|
||||||
function loadRecord(record) {
|
function loadRecord(record) {
|
||||||
formData.value = {
|
console.log('loadRecord', record)
|
||||||
...initFormData(),
|
loadWorkOrderDetail(record.id)
|
||||||
// 原有字段赋值(保持不变)
|
|
||||||
workOrderNo: record.workOrderNo || '',
|
|
||||||
status: record.status || '',
|
|
||||||
type: record.type || '',
|
|
||||||
userName: record.userName || '',
|
|
||||||
gender: record.gender || '',
|
|
||||||
age: record.age || null,
|
|
||||||
idCard: record.idCard || '',
|
|
||||||
phone: record.phone || '',
|
|
||||||
assessmentLevel: record.assessmentLevel || '',
|
|
||||||
nurseName: record.nurseName || '',
|
|
||||||
nurseLevel: record.nurseLevel || '',
|
|
||||||
planStartDate: record.planStartDate ? dayjs(record.planStartDate) : null,
|
|
||||||
planEndDate: record.planEndDate ? dayjs(record.planEndDate) : null,
|
|
||||||
planStartTime: record.planStartTime ? dayjs(`1970-01-01 ${record.planStartTime}`) : null,
|
|
||||||
serviceAddress: record.serviceAddress || '',
|
|
||||||
serviceContent: record.serviceContent || '',
|
|
||||||
orderer: record.orderer || '',
|
|
||||||
orderTime: record.orderTime ? dayjs(record.orderTime) : null,
|
|
||||||
summary: record.summary || '',
|
|
||||||
feedback: record.feedback || '',
|
|
||||||
exceptionStatus: record.exceptionStatus || '',
|
|
||||||
exceptionReason: record.exceptionReason || '',
|
|
||||||
exceptionHandler: record.exceptionHandler || '',
|
|
||||||
exceptionTime: record.exceptionTime ? dayjs(record.exceptionTime) : null,
|
|
||||||
|
|
||||||
// 新增:签到信息字段赋值(匹配record数据格式)
|
// formData.value = {
|
||||||
checkInTime: record.checkInTime || '', // 直接接收字符串格式(如:2025-10-17 11:19:59)
|
// ...initFormData(),
|
||||||
checkInDistance: record.checkInDistance || '', // 直接接收字符串格式(如:12163 m)
|
// workOrderNo: record.workOrderNo || '',
|
||||||
checkInAddress: record.checkInAddress || '', // 直接接收字符串格式
|
// status: record.status || '',
|
||||||
checkInImage: record.checkInImage || '', // 接收图片预览链接
|
// type: record.type || '',
|
||||||
checkInRemark: record.checkInRemark || '',
|
// userName: record.userName || '',
|
||||||
proxyCheckInOperator: record.proxyCheckInOperator || '',
|
// gender: record.gender || '',
|
||||||
proxyCheckInTime: record.proxyCheckInTime ? dayjs(record.proxyCheckInTime) : null,
|
// age: record.age || null,
|
||||||
proxyCheckInReason: record.proxyCheckInReason || '',
|
// idCard: record.idCard || '',
|
||||||
inProgressImage: record.inProgressImage || '',
|
// phone: record.phone || '',
|
||||||
inProgressVideo: record.inProgressVideo || '',
|
// assessmentLevel: record.assessmentLevel || '',
|
||||||
proxyCheckOutOperator: record.proxyCheckOutOperator || '',
|
// nurseName: record.nurseName || '',
|
||||||
proxyCheckOutTime: record.proxyCheckOutTime ? dayjs(record.proxyCheckOutTime) : null,
|
// nurseLevel: record.nurseLevel || '',
|
||||||
proxyCheckOutReason: record.proxyCheckOutReason || '',
|
// planStartDate: record.planStartDate ? dayjs(record.planStartDate) : null,
|
||||||
plannedServiceDuration: record.plannedServiceDuration || '', // 直接接收字符串格式(如:90 分钟)
|
// planEndDate: record.planEndDate ? dayjs(record.planEndDate) : null,
|
||||||
standardServiceDuration: record.standardServiceDuration || '',
|
// planStartTime: record.planStartTime ? dayjs(`1970-01-01 ${record.planStartTime}`) : null,
|
||||||
standardServiceFee: record.standardServiceFee || '',
|
// serviceAddress: record.serviceAddress || '',
|
||||||
actualServiceDuration: record.actualServiceDuration || '',
|
// serviceContent: record.serviceContent || '',
|
||||||
|
// orderer: record.orderer || '',
|
||||||
|
// orderTime: record.orderTime ? dayjs(record.orderTime) : null,
|
||||||
|
// summary: record.summary || '',
|
||||||
|
// feedback: record.feedback || '',
|
||||||
|
// exceptionStatus: record.exceptionStatus || '',
|
||||||
|
// exceptionReason: record.exceptionReason || '',
|
||||||
|
// exceptionHandler: record.exceptionHandler || '',
|
||||||
|
// exceptionTime: record.exceptionTime ? dayjs(record.exceptionTime) : null,
|
||||||
|
// // 服务评价字段
|
||||||
|
// visitSatisfaction: record.visitSatisfaction || '',
|
||||||
|
// staffSatisfaction: record.staffSatisfaction || '',
|
||||||
|
// visitFeedback: record.visitFeedback || '',
|
||||||
|
// visitor: record.visitor || '',
|
||||||
|
// visitTime: record.visitTime ? dayjs(record.visitTime) : null,
|
||||||
|
// serviceSatisfaction: record.serviceSatisfaction || '',
|
||||||
|
// evaluationContent: record.evaluationContent || '',
|
||||||
|
// evaluator: record.evaluator || '',
|
||||||
|
// evaluationTime: record.evaluationTime ? dayjs(record.evaluationTime) : null,
|
||||||
|
// evaluationChannel: record.evaluationChannel || '',
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
// 原有:服务评价字段赋值(保持不变)
|
/**
|
||||||
visitSatisfaction: record.visitSatisfaction || '',
|
* 加载工单详情并填充表单
|
||||||
staffSatisfaction: record.staffSatisfaction || '',
|
* @param {string} id - 工单ID
|
||||||
visitFeedback: record.visitFeedback || '',
|
*/
|
||||||
visitor: record.visitor || '',
|
/**
|
||||||
visitTime: record.visitTime ? dayjs(record.visitTime) : null,
|
* 加载工单详情并填充表单
|
||||||
serviceSatisfaction: record.serviceSatisfaction || '',
|
* @param {string} id - 工单ID
|
||||||
evaluationContent: record.evaluationContent || '',
|
*/
|
||||||
evaluator: record.evaluator || '',
|
async function loadWorkOrderDetail(id) {
|
||||||
evaluationTime: record.evaluationTime ? dayjs(record.evaluationTime) : null,
|
console.log('开始加载工单详情,ID:', id)
|
||||||
evaluationChannel: record.evaluationChannel || '',
|
try {
|
||||||
|
const { success, data } = await apis.workOrder.getWorkOrderDetail(id)
|
||||||
|
console.log('工单详情接口响应:', data)
|
||||||
|
|
||||||
|
if (success && data) {
|
||||||
|
const detailData = data
|
||||||
|
console.log('工单详情数据:', detailData)
|
||||||
|
|
||||||
|
// 处理服务项目
|
||||||
|
let projects = detailData.projects?.map(item => item.name) || []
|
||||||
|
|
||||||
|
// 处理服务地址
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
// 直接更新响应式 formData 的值
|
||||||
|
formData.value.workOrderNo = detailData.orderNum || ''
|
||||||
|
formData.value.status = dicsStore.getDictLabel('Work_Order_Status', detailData.status) || ''
|
||||||
|
formData.value.type = dicsStore.getDictLabel('ORDER_TYPE', detailData.orderType) || ''
|
||||||
|
formData.value.userName = detailData.customer?.name || ''
|
||||||
|
formData.value.gender = detailData.customer?.gender || ''
|
||||||
|
formData.value.age = age
|
||||||
|
formData.value.idCard = detailData.customer?.identityNo || ''
|
||||||
|
formData.value.phone = detailData.customer?.contact1 || ''
|
||||||
|
formData.value.assessmentLevel = detailData.assessmentLevel || ''
|
||||||
|
formData.value.nurseName = detailData.servicePerson?.name || ''
|
||||||
|
formData.value.nurseLevel = detailData.serviceContent?.gender || '' // 这里可能是护理等级,确认字段名
|
||||||
|
formData.value.planStartDate = detailData.plannedStartDate ? dayjs(detailData.plannedStartDate) : null
|
||||||
|
formData.value.planEndDate = detailData.plannedEndDate ? dayjs(detailData.plannedEndDate) : null
|
||||||
|
formData.value.planStartTime = detailData.plannedServiceStartDate ? dayjs(detailData.plannedServiceStartDate) : null
|
||||||
|
formData.value.serviceAddress = serviceAddress
|
||||||
|
// formData.value.serviceContent = detailData.content || ''
|
||||||
|
formData.value.serviceContent = detailData.projects.map(item => item.name).join(',')
|
||||||
|
formData.value.orderer = '';
|
||||||
|
formData.value.orderTime = detailData.createdAt ? dayjs(detailData.createdAt) : null
|
||||||
|
formData.value.summary = detailData.serviceSummary || ''
|
||||||
|
formData.value.feedback = detailData.userDemandFeedback || ''
|
||||||
|
|
||||||
|
// 异常处理信息
|
||||||
|
formData.value.exceptionStatus = detailData.orderError?.status || ''
|
||||||
|
formData.value.exceptionReason = detailData.orderError?.reason || ''
|
||||||
|
formData.value.exceptionHandler = detailData.orderError?.user?.name || ''
|
||||||
|
formData.value.exceptionTime = detailData.orderError?.updated_at ? dayjs(detailData.orderError.updated_at) : null
|
||||||
|
|
||||||
|
// 服务评价相关字段
|
||||||
|
formData.value.visitSatisfaction = detailData.visitSatisfaction || ''
|
||||||
|
formData.value.staffSatisfaction = detailData.staffSatisfaction || ''
|
||||||
|
formData.value.visitFeedback = detailData.visitFeedback || ''
|
||||||
|
formData.value.visitor = detailData.visitor || ''
|
||||||
|
formData.value.visitTime = detailData.visitTime ? dayjs(detailData.visitTime) : null
|
||||||
|
formData.value.serviceSatisfaction = detailData.serviceSatisfaction || ''
|
||||||
|
formData.value.evaluationContent = detailData.evaluationContent || ''
|
||||||
|
formData.value.evaluator = detailData.evaluator || ''
|
||||||
|
formData.value.evaluationTime = detailData.evaluationTime ? dayjs(detailData.evaluationTime) : null
|
||||||
|
formData.value.evaluationChannel = detailData.evaluationChannel || ''
|
||||||
|
|
||||||
|
console.log('设置后的 formData:', formData.value)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
message.error('获取工单详情失败')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取工单详情失败:', error)
|
||||||
|
message.error('加载工单信息失败')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -573,21 +495,4 @@ defineExpose({
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding-left: 8px;
|
padding-left: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 适配新增的签入信息模块样式 */
|
|
||||||
.flex {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.items-center {
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ml-2 {
|
|
||||||
margin-left: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ml-4 {
|
|
||||||
margin-left: 16px;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
@ -5,10 +5,12 @@
|
|||||||
<a-tab-pane key="all" tab="全部" />
|
<a-tab-pane key="all" tab="全部" />
|
||||||
<a-tab-pane key="initialization" tab="初始化" />
|
<a-tab-pane key="initialization" tab="初始化" />
|
||||||
<a-tab-pane key="pendingCheckin" tab="待签入" />
|
<a-tab-pane key="pendingCheckin" tab="待签入" />
|
||||||
|
<a-tab-pane key="pendingCheckdoing" tab="工单签中" />
|
||||||
|
<a-tab-pane key="pendingCheckOut" tab="已签出" />
|
||||||
<a-tab-pane key="completed" tab="已结单" />
|
<a-tab-pane key="completed" tab="已结单" />
|
||||||
<a-tab-pane key="cancelled" tab="已作废" />
|
<a-tab-pane key="remove" tab="已作废" />
|
||||||
<a-tab-pane key="expiredUncheckedIn" tab="过期未签入" />
|
<!-- <a-tab-pane key="expiredUncheckedIn" tab="过期未签入" /> -->
|
||||||
<a-tab-pane key="expiredUncheckedOut" tab="过期未签出" />
|
|
||||||
</a-tabs>
|
</a-tabs>
|
||||||
|
|
||||||
<x-search-bar class="mb-4">
|
<x-search-bar class="mb-4">
|
||||||
@ -168,6 +170,10 @@
|
|||||||
{{ formatUtcDateTime(record.created_at) }}
|
{{ formatUtcDateTime(record.created_at) }}
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template v-if="column.key === 'status'">
|
||||||
|
<span>{{ dicsStore.getDictLabel('Work_Order_Status', record.status) }}</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
<template v-if="'statusType' === column.key">
|
<template v-if="'statusType' === column.key">
|
||||||
<a-tag v-if="statusTypeEnum.is('enabled', record.status)" color="processing">
|
<a-tag v-if="statusTypeEnum.is('enabled', record.status)" color="processing">
|
||||||
{{ statusTypeEnum.getDesc(record.status) }}
|
{{ statusTypeEnum.getDesc(record.status) }}
|
||||||
@ -178,7 +184,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="'action' === column.key">
|
<template v-if="'action' === column.key">
|
||||||
<template v-if="['all', 'initialization', 'pendingCheckin'].includes(activeTabKey)">
|
<template v-if="['all', 'initialization'].includes(activeTabKey)">
|
||||||
<x-action-button @click="$refs.cancelDialogRef.showCancelModal(record)">
|
<x-action-button @click="$refs.cancelDialogRef.showCancelModal(record)">
|
||||||
<a-tooltip><template #title>
|
<a-tooltip><template #title>
|
||||||
{{ '作废' }}</template>作废
|
{{ '作废' }}</template>作废
|
||||||
@ -192,15 +198,24 @@
|
|||||||
</x-action-button>
|
</x-action-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="['all', 'completed', 'cancelled'].includes(activeTabKey)">
|
<template v-if="['all', 'completed', 'remove'].includes(activeTabKey)">
|
||||||
<x-action-button @click="$refs.viewDialogRef.handleView(record)">
|
<x-action-button @click="$refs.viewDialogRef.handleView(record)">
|
||||||
<a-tooltip><template #title>详情</template>详情</a-tooltip>
|
<a-tooltip><template #title>详情</template>详情</a-tooltip>
|
||||||
</x-action-button>
|
</x-action-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="['all', 'expiredUncheckedIn', 'expiredUncheckedOut'].includes(activeTabKey)">
|
<template v-if="[ 'pendingCheckin'].includes(activeTabKey)">
|
||||||
<x-action-button @click="$refs.checkDialogRef.showCheckModal(record)">
|
<x-action-button @click="$refs.checkDialogRef.showCheckModal(record)">
|
||||||
<a-tooltip><template #title>待签入</template>待签入</a-tooltip>
|
<a-tooltip><template #title>代签入</template>代签入</a-tooltip>
|
||||||
|
</x-action-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-if="[ 'pendingCheckdoing','pendingCheckOut'].includes(activeTabKey)">
|
||||||
|
<x-action-button @click="$refs.checkDialogRef.showCheckModal(record)">
|
||||||
|
<a-tooltip><template #title>签出</template>签出</a-tooltip>
|
||||||
|
</x-action-button>
|
||||||
|
<x-action-button @click="$refs.viewDialogRef.handleView(record)">
|
||||||
|
<a-tooltip><template #title>详情</template>详情</a-tooltip>
|
||||||
</x-action-button>
|
</x-action-button>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
@ -247,6 +262,10 @@ import storage from '@/utils/storage'
|
|||||||
import AreaCascader from '@/components/AreaCascader/index.vue'
|
import AreaCascader from '@/components/AreaCascader/index.vue'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import ServiceStation from '@/components/ServiceStation/index.vue'
|
import ServiceStation from '@/components/ServiceStation/index.vue'
|
||||||
|
|
||||||
|
import { useDicsStore } from '@/store'
|
||||||
|
|
||||||
|
const dicsStore = useDicsStore()
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'menu',
|
name: 'menu',
|
||||||
})
|
})
|
||||||
@ -262,7 +281,6 @@ const cancelReason = ref('')
|
|||||||
// 不同标签页对应的表格列配置
|
// 不同标签页对应的表格列配置
|
||||||
const columnConfigs = ref({
|
const columnConfigs = ref({
|
||||||
all: [
|
all: [
|
||||||
|
|
||||||
// { title: '工单号', dataIndex: 'orderNum', key: 'orderNum', fixed: true, width: 280 },
|
// { title: '工单号', dataIndex: 'orderNum', key: 'orderNum', fixed: true, width: 280 },
|
||||||
{ title: '服务对象', dataIndex: 'customerName', key: 'customerName', width: 140 },
|
{ title: '服务对象', dataIndex: 'customerName', key: 'customerName', width: 140 },
|
||||||
{ title: '服务对象身份证', dataIndex: 'customerIdCard', key: 'customerIdCard', width: 240 },
|
{ title: '服务对象身份证', dataIndex: 'customerIdCard', key: 'customerIdCard', width: 240 },
|
||||||
@ -326,53 +344,377 @@ const columnConfigs = ref({
|
|||||||
|
|
||||||
],
|
],
|
||||||
initialization: [
|
initialization: [
|
||||||
{ title: '工单号', dataIndex: 'name', key: 'name', fixed: true, width: 280 },
|
// { title: '工单号', dataIndex: 'orderNum', key: 'orderNum', fixed: true, width: 280 },
|
||||||
{ title: '服务对象', dataIndex: 'code', key: 'code', width: 240 },
|
{ title: '服务对象', dataIndex: 'customerName', key: 'customerName', width: 140 },
|
||||||
{ title: '服务项目', dataIndex: 'project', key: 'project', width: 240 },
|
{ title: '服务对象身份证', dataIndex: 'customerIdCard', key: 'customerIdCard', width: 240 },
|
||||||
{ title: '计划服务时间', dataIndex: 'scheduledTime', key: 'scheduledTime', width: 240 },
|
{
|
||||||
{ title: '服务组织', dataIndex: 'organization', key: 'organization', width: 240 },
|
title: '服务对象分类', dataIndex: 'labels', key: 'labels', width: 140,
|
||||||
{ title: '操作', key: 'action', width: 240, fixed: 'right' }
|
render: (labels) => Array.isArray(labels) ? labels.join(', ') : ''
|
||||||
|
},
|
||||||
|
{ title: '服务人员', dataIndex: 'serviceName', key: 'serviceName', width: 140 },
|
||||||
|
{
|
||||||
|
title: '计划日期',
|
||||||
|
dataIndex: 'plannedStartDate',
|
||||||
|
key: 'plannedStartDate',
|
||||||
|
width: 240,
|
||||||
|
customRender: ({ text, record }) => {
|
||||||
|
if (!text) return '';
|
||||||
|
try {
|
||||||
|
// 确保 dayjs 已导入
|
||||||
|
const formatted = dayjs(text).format('YYYY-MM-DD HH:mm:ss');
|
||||||
|
return formatted;
|
||||||
|
} catch (e) {
|
||||||
|
console.error('日期格式化失败:', text, e);
|
||||||
|
return text; // 或 return '无效日期'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '服务项目分类',
|
||||||
|
// 假设取 projects[0].categoryType,可根据实际字段调整
|
||||||
|
render: (_, record) => record.projects?.[0]?.categoryType || record.projects?.[0]?.categoryMethod || '',
|
||||||
|
key: 'serviceCategory',
|
||||||
|
width: 240
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '服务项目',
|
||||||
|
render: (_, record) => record.projects?.[0]?.name || '',
|
||||||
|
key: 'serviceNameProject',
|
||||||
|
width: 240
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '服务费用',
|
||||||
|
render: (_, record) => record.projects?.[0]?.price ?? 0,
|
||||||
|
key: 'servicePrice',
|
||||||
|
width: 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '实际支付费用',
|
||||||
|
// 若无单独字段,可先与服务费用一致;后续可替换为 actualPaid 等字段
|
||||||
|
render: (_, record) => record.projects?.[0]?.price ?? 0,
|
||||||
|
key: 'actualPaid',
|
||||||
|
width: 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '计划服务时间(分钟)',
|
||||||
|
|
||||||
|
dataIndex: 'workDuration',
|
||||||
|
key: 'workDuration',
|
||||||
|
width: 240
|
||||||
|
},
|
||||||
|
{ title: '服务状态', dataIndex: 'status', key: 'status', width: 180 },
|
||||||
|
{ title: '操作', key: 'action', width: 440, fixed: 'right' }
|
||||||
],
|
],
|
||||||
pendingCheckin: [
|
pendingCheckin: [
|
||||||
{ title: '工单号', dataIndex: 'name', key: 'name', fixed: true, width: 280 },
|
// { title: '工单号', dataIndex: 'orderNum', key: 'orderNum', fixed: true, width: 280 },
|
||||||
{ title: '服务对象', dataIndex: 'code', key: 'code', width: 240 },
|
{ title: '服务对象', dataIndex: 'customerName', key: 'customerName', width: 140 },
|
||||||
{ title: '服务地址', dataIndex: 'address', key: 'address', width: 300 },
|
{ title: '服务对象身份证', dataIndex: 'customerIdCard', key: 'customerIdCard', width: 240 },
|
||||||
{ title: '计划服务时间', dataIndex: 'scheduledTime', key: 'scheduledTime', width: 240 },
|
{
|
||||||
{ title: '服务人员', dataIndex: 'staff', key: 'staff', width: 240 },
|
title: '服务对象分类', dataIndex: 'labels', key: 'labels', width: 140,
|
||||||
{ title: '操作', key: 'action', width: 240, fixed: 'right' }
|
render: (labels) => Array.isArray(labels) ? labels.join(', ') : ''
|
||||||
|
},
|
||||||
|
{ title: '服务人员', dataIndex: 'serviceName', key: 'serviceName', width: 140 },
|
||||||
|
{
|
||||||
|
title: '计划日期',
|
||||||
|
dataIndex: 'plannedStartDate',
|
||||||
|
key: 'plannedStartDate',
|
||||||
|
width: 240,
|
||||||
|
customRender: ({ text, record }) => {
|
||||||
|
if (!text) return '';
|
||||||
|
try {
|
||||||
|
// 确保 dayjs 已导入
|
||||||
|
const formatted = dayjs(text).format('YYYY-MM-DD HH:mm:ss');
|
||||||
|
return formatted;
|
||||||
|
} catch (e) {
|
||||||
|
console.error('日期格式化失败:', text, e);
|
||||||
|
return text; // 或 return '无效日期'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '服务项目分类',
|
||||||
|
// 假设取 projects[0].categoryType,可根据实际字段调整
|
||||||
|
render: (_, record) => record.projects?.[0]?.categoryType || record.projects?.[0]?.categoryMethod || '',
|
||||||
|
key: 'serviceCategory',
|
||||||
|
width: 240
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '服务项目',
|
||||||
|
render: (_, record) => record.projects?.[0]?.name || '',
|
||||||
|
key: 'serviceNameProject',
|
||||||
|
width: 240
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '服务费用',
|
||||||
|
render: (_, record) => record.projects?.[0]?.price ?? 0,
|
||||||
|
key: 'servicePrice',
|
||||||
|
width: 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '实际支付费用',
|
||||||
|
// 若无单独字段,可先与服务费用一致;后续可替换为 actualPaid 等字段
|
||||||
|
render: (_, record) => record.projects?.[0]?.price ?? 0,
|
||||||
|
key: 'actualPaid',
|
||||||
|
width: 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '计划服务时间(分钟)',
|
||||||
|
|
||||||
|
dataIndex: 'workDuration',
|
||||||
|
key: 'workDuration',
|
||||||
|
width: 240
|
||||||
|
},
|
||||||
|
{ title: '服务状态', dataIndex: 'status', key: 'status', width: 180 },
|
||||||
|
{ title: '操作', key: 'action', width: 440, fixed: 'right' }
|
||||||
],
|
],
|
||||||
completed: [
|
completed: [
|
||||||
{ title: '工单号', dataIndex: 'name', key: 'name', fixed: true, width: 280 },
|
// { title: '工单号', dataIndex: 'orderNum', key: 'orderNum', fixed: true, width: 280 },
|
||||||
{ title: '服务对象', dataIndex: 'code', key: 'code', width: 240 },
|
{ title: '服务对象', dataIndex: 'customerName', key: 'customerName', width: 140 },
|
||||||
{ title: '服务项目', dataIndex: 'project', key: 'project', width: 240 },
|
{ title: '服务对象身份证', dataIndex: 'customerIdCard', key: 'customerIdCard', width: 240 },
|
||||||
{ title: '实际服务时间', dataIndex: 'actualTime', key: 'actualTime', width: 240 },
|
{
|
||||||
{ title: '服务人员', dataIndex: 'staff', key: 'staff', width: 240 },
|
title: '服务对象分类', dataIndex: 'labels', key: 'labels', width: 140,
|
||||||
{ title: '操作', key: 'action', width: 240, fixed: 'right' }
|
render: (labels) => Array.isArray(labels) ? labels.join(', ') : ''
|
||||||
|
},
|
||||||
|
{ title: '服务人员', dataIndex: 'serviceName', key: 'serviceName', width: 140 },
|
||||||
|
{
|
||||||
|
title: '计划日期',
|
||||||
|
dataIndex: 'plannedStartDate',
|
||||||
|
key: 'plannedStartDate',
|
||||||
|
width: 240,
|
||||||
|
customRender: ({ text, record }) => {
|
||||||
|
if (!text) return '';
|
||||||
|
try {
|
||||||
|
// 确保 dayjs 已导入
|
||||||
|
const formatted = dayjs(text).format('YYYY-MM-DD HH:mm:ss');
|
||||||
|
return formatted;
|
||||||
|
} catch (e) {
|
||||||
|
console.error('日期格式化失败:', text, e);
|
||||||
|
return text; // 或 return '无效日期'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '服务项目分类',
|
||||||
|
// 假设取 projects[0].categoryType,可根据实际字段调整
|
||||||
|
render: (_, record) => record.projects?.[0]?.categoryType || record.projects?.[0]?.categoryMethod || '',
|
||||||
|
key: 'serviceCategory',
|
||||||
|
width: 240
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '服务项目',
|
||||||
|
render: (_, record) => record.projects?.[0]?.name || '',
|
||||||
|
key: 'serviceNameProject',
|
||||||
|
width: 240
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '服务费用',
|
||||||
|
render: (_, record) => record.projects?.[0]?.price ?? 0,
|
||||||
|
key: 'servicePrice',
|
||||||
|
width: 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '实际支付费用',
|
||||||
|
// 若无单独字段,可先与服务费用一致;后续可替换为 actualPaid 等字段
|
||||||
|
render: (_, record) => record.projects?.[0]?.price ?? 0,
|
||||||
|
key: 'actualPaid',
|
||||||
|
width: 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '计划服务时间(分钟)',
|
||||||
|
|
||||||
|
dataIndex: 'workDuration',
|
||||||
|
key: 'workDuration',
|
||||||
|
width: 240
|
||||||
|
},
|
||||||
|
{ title: '服务状态', dataIndex: 'status', key: 'status', width: 180 },
|
||||||
|
{ title: '操作', key: 'action', width: 440, fixed: 'right' }
|
||||||
],
|
],
|
||||||
cancelled: [
|
remove: [
|
||||||
{ title: '工单号', dataIndex: 'name', key: 'name', fixed: true, width: 280 },
|
// { title: '工单号', dataIndex: 'orderNum', key: 'orderNum', fixed: true, width: 280 },
|
||||||
{ title: '服务对象', dataIndex: 'code', key: 'code', width: 240 },
|
{ title: '服务对象', dataIndex: 'customerName', key: 'customerName', width: 140 },
|
||||||
{ title: '作废原因', dataIndex: 'cancelReason', key: 'cancelReason', width: 300 },
|
{ title: '服务对象身份证', dataIndex: 'customerIdCard', key: 'customerIdCard', width: 240 },
|
||||||
{ title: '作废时间', dataIndex: 'cancelTime', key: 'cancelTime', width: 240 },
|
{
|
||||||
{ title: '操作人', dataIndex: 'operator', key: 'operator', width: 240 },
|
title: '服务对象分类', dataIndex: 'labels', key: 'labels', width: 140,
|
||||||
{ title: '操作', key: 'action', width: 240, fixed: 'right' }
|
render: (labels) => Array.isArray(labels) ? labels.join(', ') : ''
|
||||||
|
},
|
||||||
|
{ title: '服务人员', dataIndex: 'serviceName', key: 'serviceName', width: 140 },
|
||||||
|
{
|
||||||
|
title: '计划日期',
|
||||||
|
dataIndex: 'plannedStartDate',
|
||||||
|
key: 'plannedStartDate',
|
||||||
|
width: 240,
|
||||||
|
customRender: ({ text, record }) => {
|
||||||
|
if (!text) return '';
|
||||||
|
try {
|
||||||
|
// 确保 dayjs 已导入
|
||||||
|
const formatted = dayjs(text).format('YYYY-MM-DD HH:mm:ss');
|
||||||
|
return formatted;
|
||||||
|
} catch (e) {
|
||||||
|
console.error('日期格式化失败:', text, e);
|
||||||
|
return text; // 或 return '无效日期'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '服务项目分类',
|
||||||
|
// 假设取 projects[0].categoryType,可根据实际字段调整
|
||||||
|
render: (_, record) => record.projects?.[0]?.categoryType || record.projects?.[0]?.categoryMethod || '',
|
||||||
|
key: 'serviceCategory',
|
||||||
|
width: 240
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '服务项目',
|
||||||
|
render: (_, record) => record.projects?.[0]?.name || '',
|
||||||
|
key: 'serviceNameProject',
|
||||||
|
width: 240
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '服务费用',
|
||||||
|
render: (_, record) => record.projects?.[0]?.price ?? 0,
|
||||||
|
key: 'servicePrice',
|
||||||
|
width: 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '实际支付费用',
|
||||||
|
// 若无单独字段,可先与服务费用一致;后续可替换为 actualPaid 等字段
|
||||||
|
render: (_, record) => record.projects?.[0]?.price ?? 0,
|
||||||
|
key: 'actualPaid',
|
||||||
|
width: 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '计划服务时间(分钟)',
|
||||||
|
|
||||||
|
dataIndex: 'workDuration',
|
||||||
|
key: 'workDuration',
|
||||||
|
width: 240
|
||||||
|
},
|
||||||
|
{ title: '服务状态', dataIndex: 'status', key: 'status', width: 180 },
|
||||||
|
{ title: '操作', key: 'action', width: 440, fixed: 'right' }
|
||||||
],
|
],
|
||||||
expiredUncheckedIn: [
|
pendingCheckOut: [
|
||||||
{ title: '工单号', dataIndex: 'name', key: 'name', fixed: true, width: 280 },
|
// { title: '工单号', dataIndex: 'orderNum', key: 'orderNum', fixed: true, width: 280 },
|
||||||
{ title: '服务对象', dataIndex: 'code', key: 'code', width: 240 },
|
{ title: '服务对象', dataIndex: 'customerName', key: 'customerName', width: 140 },
|
||||||
{ title: '计划服务时间', dataIndex: 'scheduledTime', key: 'scheduledTime', width: 240 },
|
{ title: '服务对象身份证', dataIndex: 'customerIdCard', key: 'customerIdCard', width: 240 },
|
||||||
{ title: '逾期天数', dataIndex: 'overdueDays', key: 'overdueDays', width: 180 },
|
{
|
||||||
{ title: '服务人员', dataIndex: 'staff', key: 'staff', width: 240 },
|
title: '服务对象分类', dataIndex: 'labels', key: 'labels', width: 140,
|
||||||
{ title: '操作', key: 'action', width: 240, fixed: 'right' }
|
render: (labels) => Array.isArray(labels) ? labels.join(', ') : ''
|
||||||
|
},
|
||||||
|
{ title: '服务人员', dataIndex: 'serviceName', key: 'serviceName', width: 140 },
|
||||||
|
{
|
||||||
|
title: '计划日期',
|
||||||
|
dataIndex: 'plannedStartDate',
|
||||||
|
key: 'plannedStartDate',
|
||||||
|
width: 240,
|
||||||
|
customRender: ({ text, record }) => {
|
||||||
|
if (!text) return '';
|
||||||
|
try {
|
||||||
|
// 确保 dayjs 已导入
|
||||||
|
const formatted = dayjs(text).format('YYYY-MM-DD HH:mm:ss');
|
||||||
|
return formatted;
|
||||||
|
} catch (e) {
|
||||||
|
console.error('日期格式化失败:', text, e);
|
||||||
|
return text; // 或 return '无效日期'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '服务项目分类',
|
||||||
|
// 假设取 projects[0].categoryType,可根据实际字段调整
|
||||||
|
render: (_, record) => record.projects?.[0]?.categoryType || record.projects?.[0]?.categoryMethod || '',
|
||||||
|
key: 'serviceCategory',
|
||||||
|
width: 240
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '服务项目',
|
||||||
|
render: (_, record) => record.projects?.[0]?.name || '',
|
||||||
|
key: 'serviceNameProject',
|
||||||
|
width: 240
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '服务费用',
|
||||||
|
render: (_, record) => record.projects?.[0]?.price ?? 0,
|
||||||
|
key: 'servicePrice',
|
||||||
|
width: 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '实际支付费用',
|
||||||
|
// 若无单独字段,可先与服务费用一致;后续可替换为 actualPaid 等字段
|
||||||
|
render: (_, record) => record.projects?.[0]?.price ?? 0,
|
||||||
|
key: 'actualPaid',
|
||||||
|
width: 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '计划服务时间(分钟)',
|
||||||
|
|
||||||
|
dataIndex: 'workDuration',
|
||||||
|
key: 'workDuration',
|
||||||
|
width: 240
|
||||||
|
},
|
||||||
|
{ title: '服务状态', dataIndex: 'status', key: 'status', width: 180 },
|
||||||
|
{ title: '操作', key: 'action', width: 440, fixed: 'right' }
|
||||||
|
],
|
||||||
|
pendingCheckdoing: [
|
||||||
|
// { title: '工单号', dataIndex: 'orderNum', key: 'orderNum', fixed: true, width: 280 },
|
||||||
|
{ title: '服务对象', dataIndex: 'customerName', key: 'customerName', width: 140 },
|
||||||
|
{ title: '服务对象身份证', dataIndex: 'customerIdCard', key: 'customerIdCard', width: 240 },
|
||||||
|
{
|
||||||
|
title: '服务对象分类', dataIndex: 'labels', key: 'labels', width: 140,
|
||||||
|
render: (labels) => Array.isArray(labels) ? labels.join(', ') : ''
|
||||||
|
},
|
||||||
|
{ title: '服务人员', dataIndex: 'serviceName', key: 'serviceName', width: 140 },
|
||||||
|
{
|
||||||
|
title: '计划日期',
|
||||||
|
dataIndex: 'plannedStartDate',
|
||||||
|
key: 'plannedStartDate',
|
||||||
|
width: 240,
|
||||||
|
customRender: ({ text, record }) => {
|
||||||
|
if (!text) return '';
|
||||||
|
try {
|
||||||
|
// 确保 dayjs 已导入
|
||||||
|
const formatted = dayjs(text).format('YYYY-MM-DD HH:mm:ss');
|
||||||
|
return formatted;
|
||||||
|
} catch (e) {
|
||||||
|
console.error('日期格式化失败:', text, e);
|
||||||
|
return text; // 或 return '无效日期'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '服务项目分类',
|
||||||
|
// 假设取 projects[0].categoryType,可根据实际字段调整
|
||||||
|
render: (_, record) => record.projects?.[0]?.categoryType || record.projects?.[0]?.categoryMethod || '',
|
||||||
|
key: 'serviceCategory',
|
||||||
|
width: 240
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '服务项目',
|
||||||
|
render: (_, record) => record.projects?.[0]?.name || '',
|
||||||
|
key: 'serviceNameProject',
|
||||||
|
width: 240
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '服务费用',
|
||||||
|
render: (_, record) => record.projects?.[0]?.price ?? 0,
|
||||||
|
key: 'servicePrice',
|
||||||
|
width: 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '实际支付费用',
|
||||||
|
// 若无单独字段,可先与服务费用一致;后续可替换为 actualPaid 等字段
|
||||||
|
render: (_, record) => record.projects?.[0]?.price ?? 0,
|
||||||
|
key: 'actualPaid',
|
||||||
|
width: 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '计划服务时间(分钟)',
|
||||||
|
|
||||||
|
dataIndex: 'workDuration',
|
||||||
|
key: 'workDuration',
|
||||||
|
width: 240
|
||||||
|
},
|
||||||
|
{ title: '服务状态', dataIndex: 'status', key: 'status', width: 180 },
|
||||||
|
{ title: '操作', key: 'action', width: 440, fixed: 'right' }
|
||||||
],
|
],
|
||||||
expiredUncheckedOut: [
|
|
||||||
{ title: '工单号', dataIndex: 'name', key: 'name', fixed: true, width: 280 },
|
|
||||||
{ title: '服务对象', dataIndex: 'code', key: 'code', width: 240 },
|
|
||||||
{ title: '签入时间', dataIndex: 'checkinTime', key: 'checkinTime', width: 240 },
|
|
||||||
{ title: '逾期天数', dataIndex: 'overdueDays', key: 'overdueDays', width: 180 },
|
|
||||||
{ title: '服务人员', dataIndex: 'staff', key: 'staff', width: 240 },
|
|
||||||
{ title: '操作', key: 'action', width: 240, fixed: 'right' }
|
|
||||||
]
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// 根据当前选中的标签页获取对应的表格列
|
// 根据当前选中的标签页获取对应的表格列
|
||||||
@ -392,10 +734,13 @@ const tabKeyToStatusMap = {
|
|||||||
all: undefined, // 全部不传 status
|
all: undefined, // 全部不传 status
|
||||||
initialization: 'Initialize',
|
initialization: 'Initialize',
|
||||||
pendingCheckin: 'Pending_Check-in',
|
pendingCheckin: 'Pending_Check-in',
|
||||||
|
pendingCheckOut: 'Pending_Check-out',
|
||||||
|
pendingCheckdoing: 'Pending_Check-Doing',
|
||||||
completed: 'Closed',
|
completed: 'Closed',
|
||||||
cancelled: 'Cancelled',
|
remove: 'Remove',
|
||||||
expiredUncheckedIn: 'Overdue_Unchecked-in',
|
expiredUncheckedIn: 'Overdue_Unchecked-in',
|
||||||
expiredUncheckedOut: 'Overdue_Unchecked-out'
|
expiredUncheckedOut: 'Overdue_Unchecked-out'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始加载数据
|
// 初始加载数据
|
||||||
|
|||||||
@ -237,12 +237,18 @@
|
|||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { message } from 'ant-design-vue'
|
import { message } from 'ant-design-vue'
|
||||||
import { useModal, useForm } from '@/hooks'
|
import { useModal, useForm } from '@/hooks'
|
||||||
|
import apis from '@/apis'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
|
import { useDicsStore } from '@/store'
|
||||||
|
|
||||||
|
const dicsStore = useDicsStore()
|
||||||
|
|
||||||
|
|
||||||
const emit = defineEmits(['ok'])
|
const emit = defineEmits(['ok'])
|
||||||
const { modal, showModal, hideModal } = useModal()
|
const { modal, showModal, hideModal } = useModal()
|
||||||
const { formData, formRef, resetForm } = useForm()
|
const { formData, formRef, resetForm } = useForm()
|
||||||
|
|
||||||
|
|
||||||
// 初始化表单数据(含服务评价字段)
|
// 初始化表单数据(含服务评价字段)
|
||||||
const initFormData = () => ({
|
const initFormData = () => ({
|
||||||
workOrderNo: '',
|
workOrderNo: '',
|
||||||
@ -302,44 +308,130 @@ function handleView(record = {}) {
|
|||||||
*/
|
*/
|
||||||
function loadRecord(record) {
|
function loadRecord(record) {
|
||||||
console.log('loadRecord', record)
|
console.log('loadRecord', record)
|
||||||
|
loadWorkOrderDetail(record.id)
|
||||||
|
|
||||||
formData.value = {
|
// formData.value = {
|
||||||
...initFormData(),
|
// ...initFormData(),
|
||||||
workOrderNo: record.workOrderNo || '',
|
// workOrderNo: record.workOrderNo || '',
|
||||||
status: record.status || '',
|
// status: record.status || '',
|
||||||
type: record.type || '',
|
// type: record.type || '',
|
||||||
userName: record.userName || '',
|
// userName: record.userName || '',
|
||||||
gender: record.gender || '',
|
// gender: record.gender || '',
|
||||||
age: record.age || null,
|
// age: record.age || null,
|
||||||
idCard: record.idCard || '',
|
// idCard: record.idCard || '',
|
||||||
phone: record.phone || '',
|
// phone: record.phone || '',
|
||||||
assessmentLevel: record.assessmentLevel || '',
|
// assessmentLevel: record.assessmentLevel || '',
|
||||||
nurseName: record.nurseName || '',
|
// nurseName: record.nurseName || '',
|
||||||
nurseLevel: record.nurseLevel || '',
|
// nurseLevel: record.nurseLevel || '',
|
||||||
planStartDate: record.planStartDate ? dayjs(record.planStartDate) : null,
|
// planStartDate: record.planStartDate ? dayjs(record.planStartDate) : null,
|
||||||
planEndDate: record.planEndDate ? dayjs(record.planEndDate) : null,
|
// planEndDate: record.planEndDate ? dayjs(record.planEndDate) : null,
|
||||||
planStartTime: record.planStartTime ? dayjs(`1970-01-01 ${record.planStartTime}`) : null,
|
// planStartTime: record.planStartTime ? dayjs(`1970-01-01 ${record.planStartTime}`) : null,
|
||||||
serviceAddress: record.serviceAddress || '',
|
// serviceAddress: record.serviceAddress || '',
|
||||||
serviceContent: record.serviceContent || '',
|
// serviceContent: record.serviceContent || '',
|
||||||
orderer: record.orderer || '',
|
// orderer: record.orderer || '',
|
||||||
orderTime: record.orderTime ? dayjs(record.orderTime) : null,
|
// orderTime: record.orderTime ? dayjs(record.orderTime) : null,
|
||||||
summary: record.summary || '',
|
// summary: record.summary || '',
|
||||||
feedback: record.feedback || '',
|
// feedback: record.feedback || '',
|
||||||
exceptionStatus: record.exceptionStatus || '',
|
// exceptionStatus: record.exceptionStatus || '',
|
||||||
exceptionReason: record.exceptionReason || '',
|
// exceptionReason: record.exceptionReason || '',
|
||||||
exceptionHandler: record.exceptionHandler || '',
|
// exceptionHandler: record.exceptionHandler || '',
|
||||||
exceptionTime: record.exceptionTime ? dayjs(record.exceptionTime) : null,
|
// exceptionTime: record.exceptionTime ? dayjs(record.exceptionTime) : null,
|
||||||
// 服务评价字段
|
// // 服务评价字段
|
||||||
visitSatisfaction: record.visitSatisfaction || '',
|
// visitSatisfaction: record.visitSatisfaction || '',
|
||||||
staffSatisfaction: record.staffSatisfaction || '',
|
// staffSatisfaction: record.staffSatisfaction || '',
|
||||||
visitFeedback: record.visitFeedback || '',
|
// visitFeedback: record.visitFeedback || '',
|
||||||
visitor: record.visitor || '',
|
// visitor: record.visitor || '',
|
||||||
visitTime: record.visitTime ? dayjs(record.visitTime) : null,
|
// visitTime: record.visitTime ? dayjs(record.visitTime) : null,
|
||||||
serviceSatisfaction: record.serviceSatisfaction || '',
|
// serviceSatisfaction: record.serviceSatisfaction || '',
|
||||||
evaluationContent: record.evaluationContent || '',
|
// evaluationContent: record.evaluationContent || '',
|
||||||
evaluator: record.evaluator || '',
|
// evaluator: record.evaluator || '',
|
||||||
evaluationTime: record.evaluationTime ? dayjs(record.evaluationTime) : null,
|
// evaluationTime: record.evaluationTime ? dayjs(record.evaluationTime) : null,
|
||||||
evaluationChannel: record.evaluationChannel || '',
|
// evaluationChannel: record.evaluationChannel || '',
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载工单详情并填充表单
|
||||||
|
* @param {string} id - 工单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 projects = detailData.projects?.map(item => item.name) || []
|
||||||
|
|
||||||
|
// 处理服务地址
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
// 直接更新响应式 formData 的值
|
||||||
|
formData.value.workOrderNo = detailData.orderNum || ''
|
||||||
|
formData.value.status = dicsStore.getDictLabel('Work_Order_Status', detailData.status) || ''
|
||||||
|
formData.value.type = dicsStore.getDictLabel('ORDER_TYPE', detailData.orderType) || ''
|
||||||
|
formData.value.userName = detailData.customer?.name || ''
|
||||||
|
formData.value.gender = detailData.customer?.gender || ''
|
||||||
|
formData.value.age = age
|
||||||
|
formData.value.idCard = detailData.customer?.identityNo || ''
|
||||||
|
formData.value.phone = detailData.customer?.contact1 || ''
|
||||||
|
formData.value.assessmentLevel = detailData.assessmentLevel || ''
|
||||||
|
formData.value.nurseName = detailData.servicePerson?.name || ''
|
||||||
|
formData.value.nurseLevel = detailData.serviceContent?.gender || '' // 这里可能是护理等级,确认字段名
|
||||||
|
formData.value.planStartDate = detailData.plannedStartDate ? dayjs(detailData.plannedStartDate) : null
|
||||||
|
formData.value.planEndDate = detailData.plannedEndDate ? dayjs(detailData.plannedEndDate) : null
|
||||||
|
formData.value.planStartTime = detailData.plannedServiceStartDate ? dayjs(detailData.plannedServiceStartDate) : null
|
||||||
|
formData.value.serviceAddress = serviceAddress
|
||||||
|
// formData.value.serviceContent = detailData.content || ''
|
||||||
|
formData.value.serviceContent = detailData.projects.map(item => item.name).join(',')
|
||||||
|
formData.value.orderer = '';
|
||||||
|
formData.value.orderTime = detailData.createdAt ? dayjs(detailData.createdAt) : null
|
||||||
|
formData.value.summary = detailData.serviceSummary || ''
|
||||||
|
formData.value.feedback = detailData.userDemandFeedback || ''
|
||||||
|
|
||||||
|
// 异常处理信息
|
||||||
|
formData.value.exceptionStatus = detailData.orderError?.status || ''
|
||||||
|
formData.value.exceptionReason = detailData.orderError?.reason || ''
|
||||||
|
formData.value.exceptionHandler = detailData.orderError?.user?.name || ''
|
||||||
|
formData.value.exceptionTime = detailData.orderError?.updated_at ? dayjs(detailData.orderError.updated_at) : null
|
||||||
|
|
||||||
|
// 服务评价相关字段
|
||||||
|
formData.value.visitSatisfaction = detailData.visitSatisfaction || ''
|
||||||
|
formData.value.staffSatisfaction = detailData.staffSatisfaction || ''
|
||||||
|
formData.value.visitFeedback = detailData.visitFeedback || ''
|
||||||
|
formData.value.visitor = detailData.visitor || ''
|
||||||
|
formData.value.visitTime = detailData.visitTime ? dayjs(detailData.visitTime) : null
|
||||||
|
formData.value.serviceSatisfaction = detailData.serviceSatisfaction || ''
|
||||||
|
formData.value.evaluationContent = detailData.evaluationContent || ''
|
||||||
|
formData.value.evaluator = detailData.evaluator || ''
|
||||||
|
formData.value.evaluationTime = detailData.evaluationTime ? dayjs(detailData.evaluationTime) : null
|
||||||
|
formData.value.evaluationChannel = detailData.evaluationChannel || ''
|
||||||
|
|
||||||
|
console.log('设置后的 formData:', formData.value)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
message.error('获取工单详情失败')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取工单详情失败:', error)
|
||||||
|
message.error('加载工单信息失败')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -148,7 +148,13 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-else-if="column.dataIndex === 'plannedServiceStartDate'">
|
<template v-else-if="column.dataIndex === 'plannedServiceStartDate'">
|
||||||
<span>{{ formatDate(record.plannedServiceStartDate) }}</span>
|
<span>{{ dayjs(record.plannedServiceStartDate).format('YYYY-MM-DD HH:mm:ss') }}</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<template v-if="column.key === 'status'">
|
||||||
|
<span>{{ dicsStore.getDictLabel('Work_Order_Status', record.status) }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-else-if="column.key === 'action'">
|
<template v-else-if="column.key === 'action'">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user