代码修改

This commit is contained in:
qiuyuan 2025-11-10 09:54:54 +08:00
parent 4be770167d
commit b0af79cb08
9 changed files with 1203 additions and 559 deletions

View File

@ -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 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)

View File

@ -308,6 +308,16 @@
}}</span>
</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">
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">
<span>编辑</span>

View File

@ -12,7 +12,7 @@
>
<a-form layout="vertical" ref="formRef" :model="formData" :rules="formRules">
<!-- 签入时间 -->
<a-form-item
<!-- <a-form-item
label="签入时间"
name="signTime"
required
@ -24,11 +24,11 @@
placeholder="选择时间"
style="width: 100%"
/>
</a-form-item>
</a-form-item> -->
<!-- 代签入原因 -->
<a-form-item
label="代签入原因"
label="原因"
name="reason"
required
>
@ -45,19 +45,8 @@
label="代签入图片"
name="images"
>
<a-upload
v-model:file-list="fileList"
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>
<gx-upload v-model="formData.inImages" accept-types=".jpg,.png,.webp"
:fileNumber="20" />
</a-form-item>
</a-form>
</a-modal>
@ -70,6 +59,8 @@ import { useForm } from '@/hooks'
import { useModal } from '@/hooks'
import { message } from 'ant-design-vue'
import dayjs from 'dayjs'
import apis from '@/apis'
import GxUpload from '@/components/GxUpload/index.vue'
const emit = defineEmits(['ok'])
@ -81,16 +72,16 @@ const fileList = ref([])
//
formData.value = reactive({
signTime: null,
// signTime: null,
reason: '',
images: [] // File URL
})
//
formRules.value = {
signTime: [
{ required: true, message: '请选择签入时间' }
],
// signTime: [
// { required: true, message: '' }
// ],
reason: [
{ required: true, message: '请填写代签入原因' },
{ max: 100, message: '原因不能超过100字' }
@ -111,7 +102,7 @@ function showCheckModal(record) {
type: 'cancel',
title: '代签入工单'
})
formData.value.signTime = null
// formData.value.signTime = null
formData.value.reason = ''
fileList.value = []
}
@ -143,32 +134,62 @@ function dummyRequest(options) {
//
async function handleOk() {
try {
const values = await formRef.value.validateFields()
showLoading()
await formRef.value?.validateFields();
showLoading();
//
const files = fileList.value
.filter(f => f.status === 'done')
.map(f => f.originFileObj || f)
const { id, status } = currentRecord.value || {};
const reason = formData.value.reason;
// API
// await apis.workOrder.proxySignIn({
// id: currentRecord.value?.id,
// signTime: dayjs(formData.value.signTime).format('YYYY-MM-DD HH:mm:ss'),
// reason: formData.value.reason,
// images: files
// })
if (!id) {
message.error('工单ID不存在');
return;
}
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) {
hideLoading()
console.error('表单验证失败:', error)
console.error('请求异常:', error);
} finally {
hideLoading();
}
}

View File

@ -1,139 +1,146 @@
<template>
<a-modal
:width="780"
:open="modal.open"
: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"
>
<a-modal :width="780" :open="modal.open" :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 实现两列排版 -->
<a-row :gutter="24">
<!-- 服务对象只读 -->
<a-col :span="12">
<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-col>
<!-- 服务人员下拉选择 -->
<a-col :span="12">
<a-form-item label="服务人员" name="serviceStaff" required :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
<a-select
v-model:value="formData.serviceStaff"
placeholder="请选择服务人员"
:options="staffOptions"
/>
<a-form-item label="服务人员" name="servicePersonId" required :label-col="{ span: 6 }"
:wrapper-col="{ span: 18 }">
<a-select v-model:value="formData.servicePersonId" placeholder="请选择服务人员" :options="staffOptions" />
</a-form-item>
</a-col>
<!-- 服务项目单选下拉 -->
<!-- 工单类型 -->
<a-col :span="12">
<a-form-item label="服务项目" name="serviceItems" required :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
<a-select
v-model:value="formData.serviceItems"
placeholder="请选择服务项目"
:options="serviceItemOptions"
/>
<a-form-item label="工单类型" name="orderType" required :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
<a-select v-model:value="formData.orderType" placeholder="请选择工单类型">
<a-select-option v-for="item in dicsStore.dictOptions.ORDER_TYPE" :key="item.dval" :value="item.dval">
{{ item.introduction }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<!-- 服务费用普通输入框 -->
<!-- 服务项目名称 -->
<a-col :span="12">
<a-form-item label="服务费用" name="serviceFee" required :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
<a-input
v-model:value="formData.serviceFee"
placeholder="请填写服务费用"
type="number"
/>
<a-form-item label="服务项目" name="projectName" required :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
<a-select v-model:value="formData.projectName" placeholder="请选择服务项目" :options="serviceItemOptions" />
</a-form-item>
</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-form-item label="计划开始日期" name="planDateRange" required :label-col="{ span:8}" :wrapper-col="{ span: 16 }">
<a-range-picker
v-model:value="formData.planDateRange"
format="YYYY-MM-DD"
:placeholder="['开始日期', '结束日期']"
/>
<a-form-item label="服务费用" name="price" required :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
<a-input v-model:value="formData.price" placeholder="请填写服务费用" type="number" />
</a-form-item>
</a-col>
<!-- 计划开始时间 -->
<!-- 服务时长 -->
<a-col :span="12">
<a-form-item label="计划开始时间" name="planStartTime" required :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">
<a-time-picker
v-model:value="formData.planStartTime"
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="请填写要求工单时长"
/>
<a-form-item label="服务时长" name="duration" required :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
<a-input-number v-model:value="formData.duration" :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="serviceArea" required :label-col="{ span: 3 }" :wrapper-col="{ span: 21 }">
<a-cascader
v-model:value="formData.serviceArea"
:options="areaOptions"
change-on-select
placeholder="请选择服务地址"
style="width: 100%"
/>
<!-- 计划开始日期 -->
<a-col :span="12">
<a-form-item label="计划开始日期" name="plannedStartDate" required :label-col="{ span: 8 }"
:wrapper-col="{ span: 16 }">
<a-date-picker v-model:value="formData.plannedStartDate" format="YYYY-MM-DD" placeholder="请选择计划开始日期"
style="width: 100%" />
</a-form-item>
</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-form-item label="详细地址" name="detailAddress" required :label-col="{ span: 3 }" :wrapper-col="{ span: 21 }">
<a-input v-model:value="formData.detailAddress" placeholder="请填写详细地址" />
</a-form-item>
</a-col>
<!-- 地图定位地址只读+图标占满一行 -->
<!-- 服务内容 -->
<a-col :span="24">
<a-form-item label="地图定位地址" :label-col="{ span: 3 }" :wrapper-col="{ span: 21 }">
<div style="display: flex; align-items: center;">
<span style="margin-right: 8px; cursor: pointer;" @click="openMap">📍</span>
<a-input v-model:value="formData.mapAddress" readonly />
</div>
<a-form-item label="服务内容" name="content" :label-col="{ span: 3 }" :wrapper-col="{ span: 21 }">
<a-textarea v-model:value="formData.content" placeholder="请填写服务内容"
:auto-size="{ minRows: 2, maxRows: 4 }" />
</a-form-item>
</a-col>
<!-- 备注占满一行 -->
<a-col :span="24">
<a-form-item label="备注" :label-col="{ span: 3 }" :wrapper-col="{ span: 21 }">
<a-textarea
v-model:value="formData.remark"
placeholder="请填写备注"
:auto-size="{ minRows: 2, maxRows: 4 }"
/>
<!-- 服务小结 -->
<!-- <a-col :span="24">
<a-form-item label="服务小结" name="serviceSummary" :label-col="{ span: 3 }" :wrapper-col="{ span: 21 }">
<a-textarea v-model:value="formData.serviceSummary" placeholder="请填写服务小结"
:auto-size="{ minRows: 2, maxRows: 4 }" />
</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-form>
</a-modal>
@ -145,38 +152,53 @@ import { useForm } from '@/hooks'
import { useModal } from '@/hooks'
import { message } from 'ant-design-vue'
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 = [
{ value: '邢光平', label: '邢光平' },
{ value: '张三', label: '张三' },
{ value: '李四', label: '李四' }
const staffOptions = ref([])
const serviceItemOptions = ref([])
const orderTypeOptions = [
{ value: '1', label: '类型1' },
{ value: '2', label: '类型2' }
]
const serviceItemOptions = [
{ value: '兴趣活动', label: '兴趣活动' },
{ value: '生活照料', label: '生活照料' },
{ value: '康复训练', label: '康复训练' }
]
const TZ = '+08:00'
const buildISODateTime = (dateMoment, timeStr = '00:00:00') => {
if (!dateMoment) return ''
return `${dateMoment.format('YYYY-MM-DD')}T${timeStr}${TZ}`
}
// const categoryTypeOptions = [
// { value: '1', label: '1' },
// { value: '2', label: '2' }
// ]
const areaOptions = [
{
value: '江苏省',
value: '320000000000',
label: '江苏省',
children: [
{
value: '南通市',
value: '320600000000',
label: '南通市',
children: [
{
value: '通州区',
value: '320612000000',
label: '通州区',
children: [
{
value: '金新街道',
value: '320612001000',
label: '金新街道',
children: [
{ value: '大石桥村委会', label: '大石桥村委会' }
{ value: '320612001203', label: '大石桥村委会' }
]
}
]
@ -192,33 +214,76 @@ const emit = defineEmits(['ok'])
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
const { formData, formRef, formRules, resetForm } = useForm()
//
formData.value = reactive({
serviceTarget: '袁正芬', //
serviceStaff: '邢光平', //
serviceItems: '兴趣活动', //
serviceFee: '40', //
planDateRange: [dayjs('2025-10-17'), dayjs('2025-10-31')], //
planStartTime: dayjs('00:03:00', 'HH:mm:ss'), //
requiredDuration: 90, //
serviceArea: ['江苏省', '南通市', '通州区', '金新街道', '大石桥村委会'], //
detailAddress: '南通市通州区川姜镇大石桥村九组131号', //
mapAddress: '', //
remark: '' //
//
const originalRecord = ref({})
// -
const initFormData = () => ({
//
id: '',
customerName: '',
customerIdCard: '',
customerId: '',
orderNum: '',
orderType: '',
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 = {
serviceStaff: [{ required: true, message: '请选择服务人员' }],
serviceItems: [{ required: true, message: '请选择服务项目' }],
serviceFee: [
servicePersonId: [{ required: true, message: '请选择服务人员' }],
orderType: [{ required: true, message: '请选择工单类型' }],
projectName: [{ required: true, message: '请选择服务项目' }],
// categoryType: [{ required: true, message: '' }],
price: [
{ required: true, message: '请填写服务费用' },
{ pattern: /^\d+$/, message: '请输入有效数字' }
],
planDateRange: [{ required: true, message: '请选择计划日期范围' }],
planStartTime: [{ required: true, message: '请选择计划开始时间' }],
requiredDuration: [{ required: true, message: '请填写要求工单时长' }],
serviceArea: [{ required: true, message: '请选择服务地址' }],
duration: [{ required: true, message: '请填写服务时长' }],
workDuration: [{ required: true, message: '请填写工单时长' }],
plannedStartDate: [{ required: true, message: '请选择计划开始日期' }],
plannedEndDate: [{ required: true, message: '请选择计划结束日期' }],
plannedServiceStartDate: [{ required: true, message: '请选择计划开始时间' }],
areaCodes: [{ required: true, message: '请选择服务地址' }],
detailAddress: [{ required: true, message: '请填写详细地址' }]
}
@ -226,35 +291,150 @@ formRules.value = {
const cancelText = ref('取消')
const okText = ref('保存')
//
function openMap() {
message.info('地图定位功能待实现')
async function getPageList() {
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() {
try {
const values = await formRef.value.validateFields()
showLoading()
//
const payload = {
...values,
planStartDate: values.planDateRange?.[0]?.format('YYYY-MM-DD') || '',
planEndDate: values.planDateRange?.[1]?.format('YYYY-MM-DD') || '',
planStartTime: values.planStartTime?.format('HH:mm:ss') || ''
//
const buildFullDateTime = (dateMoment, timeMoment) => {
if (!dateMoment) return null // null
const dateStr = dateMoment.format('YYYY-MM-DD')
const timeStr = timeMoment ? timeMoment.format('HH:mm:ss') : '00:00:00'
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()
hideModal()
emit('ok', payload)
message.success('保存成功')
}, 500)
emit('ok')
} else {
message.error(res?.message || '保存失败')
hideLoading()
}
} catch (error) {
console.error('表单验证失败:', error)
hideLoading()
message.error('保存失败,请检查表单数据')
}
}
@ -266,34 +446,76 @@ function handleCancel() {
//
function onAfterClose() {
resetForm()
originalRecord.value = {}
}
//
defineExpose({
showEditModal(record) {
// record formData
formData.value = reactive({
serviceTarget: record?.serviceTarget || '袁正芬',
serviceStaff: record?.serviceStaff || '邢光平',
serviceItems: record?.serviceItems || '兴趣活动',
serviceFee: record?.serviceFee || '40',
planDateRange: record?.planDateRange
? [dayjs(record.planStartDate), dayjs(record.planEndDate)]
: [dayjs('2025-10-17'), dayjs('2025-10-31')],
planStartTime: record?.planStartTime
? dayjs(record.planStartTime, 'HH:mm:ss')
: dayjs('00:03:00', 'HH:mm:ss'),
requiredDuration: record?.requiredDuration || 90,
serviceArea: record?.serviceArea || ['江苏省', '南通市', '通州区', '金新街道', '大石桥村委会'],
detailAddress: record?.detailAddress || '南通市通州区川姜镇大石桥村九组131号',
mapAddress: record?.mapAddress || '',
remark: record?.remark || ''
})
// ""
function showEditModal(record) {
getPageList()
getCategoriesAll()
if (!record) return
showModal({
type: 'edit',
title: '编辑工单'
})
console.log('编辑工单数据:', record)
//
originalRecord.value = { ...record }
// -
formData.value = {
//
id: record.id,
customerName: record.customerName || '',
customerIdCard: record.customerIdCard || '',
customerId: record.customerId || '',
orderNum: record.orderNum || '',
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({
type: 'edit',
title: '编辑工单'
})
}
//
defineExpose({
showEditModal
})
</script>

View File

@ -9,8 +9,9 @@
:ok-text="okText"
@ok="handleOk"
@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
:label="'作废原因'"
name="reason"
@ -27,10 +28,12 @@
</template>
<script setup>
import { message, Modal } from 'ant-design-vue'
import { ref } from 'vue'
import { useForm } from '@/hooks'
import { useModal } from '@/hooks'
import { useI18n } from 'vue-i18n'
import apis from '@/apis'
const emit = defineEmits(['ok'])
@ -66,18 +69,44 @@ function showCancelModal(record) {
//
async function handleOk() {
console.log("handleOk 方法被调用")
try {
//
await formRef.value.validateFields()
console.log("表单验证通过")
showLoading()
// API
// await apis.workOrder.cancelWorkOrder({ id: props.workOrderId, reason: formData.value.reason })
// API
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()
hideModal()
emit('ok', formData.value.reason) //
emit('ok', formData.value.reason)
} catch (error) {
console.error("捕获到错误:", error)
hideLoading()
// API
if (error.errorFields) {
console.log("表单验证错误:", error.errorFields)
message.error('请检查表单填写是否正确')
} else {
console.error("API调用错误:", error)
message.error('操作失败,请重试')
}
}
}

View File

@ -12,34 +12,31 @@
@cancel="handleCancel"
>
<a-tabs default-active-key="1" :tab-bar-style="{ marginBottom: '16px' }">
<!-- 工单信息页签已替换为现有布局与字段 -->
<!-- 工单信息页签 -->
<a-tab-pane key="1" tab="工单信息">
<a-form layout="vertical" ref="formRef" :model="formData">
<!-- 1. 工单信息 -->
<!-- 工单信息 -->
<a-card class="mb-4" title="工单信息">
<a-row :gutter="16">
<a-col :span="8">
<a-col :span="12">
<a-form-item label="工单号" name="workOrderNo">
<a-input v-model:value="formData.workOrderNo" disabled />
</a-form-item>
</a-col>
<a-col :span="8">
<a-col :span="12">
<a-form-item label="工单状态" name="status">
<a-input v-model:value="formData.status" disabled />
</a-form-item>
</a-col>
<a-col :span="8">
<a-col :span="12">
<a-form-item label="工单类型" name="type">
<div class="flex items-center">
<a-input v-model:value="formData.type" disabled style="flex: 1" />
<a-button type="link" disabled class="ml-2">修改</a-button>
</div>
<a-input v-model:value="formData.type" disabled />
</a-form-item>
</a-col>
</a-row>
</a-card>
<!-- 2. 用户信息 -->
<!-- 用户信息 -->
<a-card class="mb-4" title="用户信息">
<a-row :gutter="16">
<a-col :span="8">
@ -72,38 +69,38 @@
</a-col>
<a-col :span="12">
<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-col>
</a-row>
</a-card>
<!-- 3. 服务信息 -->
<!-- 服务信息 -->
<a-card class="mb-4" title="服务信息">
<a-row :gutter="16">
<a-col :span="8">
<a-col :span="12">
<a-form-item label="护理员" name="nurseName">
<a-input v-model:value="formData.nurseName" disabled />
</a-form-item>
</a-col>
<a-col :span="8">
<a-col :span="12">
<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-col>
<a-col :span="8">
<a-col :span="12">
<a-form-item label="计划开始日期" name="planStartDate">
<a-date-picker v-model:value="formData.planStartDate" format="YYYY-MM-DD" disabled style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-col :span="12">
<a-form-item label="计划结束日期" name="planEndDate">
<a-date-picker v-model:value="formData.planEndDate" format="YYYY-MM-DD" disabled style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-col :span="12">
<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-col>
<a-col :span="24">
@ -116,17 +113,17 @@
<a-button type="link" @click="showServiceItems" disabled>项目清单</a-button>
</a-form-item>
</a-col>
<a-col :span="8">
<a-col :span="24">
<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-col>
<a-col :span="8">
<a-col :span="12">
<a-form-item label="下单人" name="orderer">
<a-input v-model:value="formData.orderer" disabled />
</a-form-item>
</a-col>
<a-col :span="8">
<a-col :span="12">
<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-form-item>
@ -134,147 +131,23 @@
</a-row>
</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-row :gutter="16">
<a-col :span="12">
<a-col :span="24">
<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-col>
<a-col :span="12">
<a-col :span="24">
<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-col>
</a-row>
</a-card>
<!-- 6. 异常工单处理信息 -->
<!-- 异常处理信息 -->
<a-card class="mb-4" title="异常工单处理信息">
<a-row :gutter="16">
<a-col :span="12">
@ -284,12 +157,12 @@
</a-col>
<a-col :span="12">
<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-col>
<a-col :span="12">
<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-col>
<a-col :span="12">
@ -302,7 +175,7 @@
</a-form>
</a-tab-pane>
<!-- 服务评价页签完全保留原内容未修改 -->
<!-- 服务评价页签 -->
<a-tab-pane key="2" tab="服务评价">
<a-space direction="vertical" style="width: 100%">
<!-- 回访评价 -->
@ -364,15 +237,20 @@
import { ref } from 'vue'
import { message } from 'ant-design-vue'
import { useModal, useForm } from '@/hooks'
import apis from '@/apis'
import dayjs from 'dayjs'
import { useDicsStore } from '@/store'
const dicsStore = useDicsStore()
const emit = defineEmits(['ok'])
const { modal, showModal, hideModal } = useModal()
const { formData, formRef, resetForm } = useForm()
//
//
const initFormData = () => ({
//
workOrderNo: '',
status: '',
type: '',
@ -397,30 +275,7 @@ const initFormData = () => ({
exceptionReason: '',
exceptionHandler: '',
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: '',
staffSatisfaction: '',
visitFeedback: '',
@ -440,7 +295,7 @@ formData.value = initFormData()
/**
* 查看工单唯一打开弹框的方法
* @param {Object} record - 工单数据需包含新增的签到信息字段
* @param {Object} record - 工单数据
*/
function handleView(record = {}) {
showModal({ mode: 'view', title: '查看工单' })
@ -448,68 +303,135 @@ function handleView(record = {}) {
}
/**
* 加载工单数据到表单新增签到信息字段的赋值逻辑
* 加载工单数据到表单
* @param {Object} record - 工单数据
*/
function loadRecord(record) {
formData.value = {
...initFormData(),
//
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,
console.log('loadRecord', record)
loadWorkOrderDetail(record.id)
// record
checkInTime: record.checkInTime || '', // 2025-10-17 11:19:59
checkInDistance: record.checkInDistance || '', // 12163 m
checkInAddress: record.checkInAddress || '', //
checkInImage: record.checkInImage || '', //
checkInRemark: record.checkInRemark || '',
proxyCheckInOperator: record.proxyCheckInOperator || '',
proxyCheckInTime: record.proxyCheckInTime ? dayjs(record.proxyCheckInTime) : null,
proxyCheckInReason: record.proxyCheckInReason || '',
inProgressImage: record.inProgressImage || '',
inProgressVideo: record.inProgressVideo || '',
proxyCheckOutOperator: record.proxyCheckOutOperator || '',
proxyCheckOutTime: record.proxyCheckOutTime ? dayjs(record.proxyCheckOutTime) : null,
proxyCheckOutReason: record.proxyCheckOutReason || '',
plannedServiceDuration: record.plannedServiceDuration || '', // 90
standardServiceDuration: record.standardServiceDuration || '',
standardServiceFee: record.standardServiceFee || '',
actualServiceDuration: record.actualServiceDuration || '',
// formData.value = {
// ...initFormData(),
// 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,
// //
// 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 || '',
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 || '',
/**
* 加载工单详情并填充表单
* @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('加载工单信息失败')
}
}
@ -573,21 +495,4 @@ defineExpose({
display: inline-block;
padding-left: 8px;
}
/* 适配新增的签入信息模块样式 */
.flex {
display: flex;
}
.items-center {
align-items: center;
}
.ml-2 {
margin-left: 8px;
}
.ml-4 {
margin-left: 16px;
}
</style>

View File

@ -5,15 +5,17 @@
<a-tab-pane key="all" tab="全部" />
<a-tab-pane key="initialization" 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="cancelled" tab="已作废" />
<a-tab-pane key="expiredUncheckedIn" tab="过期未签入" />
<a-tab-pane key="expiredUncheckedOut" tab="过期未签出" />
<a-tab-pane key="remove" tab="已作废" />
<!-- <a-tab-pane key="expiredUncheckedIn" tab="过期未签入" /> -->
</a-tabs>
<x-search-bar class="mb-4">
<template #default="{ gutter, colSpan }">
<a-form :model="searchFormData" layout="inline">
<a-form :model="searchFormData" layout="inline">
<!-- 基础查询字段 -->
<a-row :gutter="gutter">
<a-col v-bind="colSpan">
@ -42,7 +44,7 @@
</a-row>
<!-- 高级查询折叠面板 -->
<a-collapse v-model:activeKey="advancedSearchVisible" ghost >
<a-collapse v-model:activeKey="advancedSearchVisible" ghost>
<a-collapse-panel key="1" :showArrow="false" style="padding: 0; border: none;">
<template #header></template>
<a-row :gutter="gutter" style="margin-top: -20px;">
@ -168,6 +170,10 @@
{{ formatUtcDateTime(record.created_at) }}
</template>
<template v-if="column.key === 'status'">
<span>{{ dicsStore.getDictLabel('Work_Order_Status', record.status) }}</span>
</template>
<template v-if="'statusType' === column.key">
<a-tag v-if="statusTypeEnum.is('enabled', record.status)" color="processing">
{{ statusTypeEnum.getDesc(record.status) }}
@ -178,7 +184,7 @@
</template>
<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)">
<a-tooltip><template #title>
{{ '作废' }}</template>作废
@ -192,15 +198,24 @@
</x-action-button>
</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)">
<a-tooltip><template #title>详情</template>详情</a-tooltip>
</x-action-button>
</template>
<template v-if="['all', 'expiredUncheckedIn', 'expiredUncheckedOut'].includes(activeTabKey)">
<template v-if="[ 'pendingCheckin'].includes(activeTabKey)">
<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>
</template>
</template>
@ -247,6 +262,10 @@ import storage from '@/utils/storage'
import AreaCascader from '@/components/AreaCascader/index.vue'
import dayjs from 'dayjs'
import ServiceStation from '@/components/ServiceStation/index.vue'
import { useDicsStore } from '@/store'
const dicsStore = useDicsStore()
defineOptions({
name: 'menu',
})
@ -262,7 +281,6 @@ const cancelReason = ref('')
//
const columnConfigs = ref({
all: [
// { title: '', dataIndex: 'orderNum', key: 'orderNum', fixed: true, width: 280 },
{ title: '服务对象', dataIndex: 'customerName', key: 'customerName', width: 140 },
{ title: '服务对象身份证', dataIndex: 'customerIdCard', key: 'customerIdCard', width: 240 },
@ -326,53 +344,377 @@ const columnConfigs = ref({
],
initialization: [
{ title: '工单号', dataIndex: 'name', key: 'name', fixed: true, width: 280 },
{ title: '服务对象', dataIndex: 'code', key: 'code', width: 240 },
{ title: '服务项目', dataIndex: 'project', key: 'project', width: 240 },
{ title: '计划服务时间', dataIndex: 'scheduledTime', key: 'scheduledTime', width: 240 },
{ title: '服务组织', dataIndex: 'organization', key: 'organization', width: 240 },
{ title: '操作', key: 'action', width: 240, fixed: 'right' }
// { 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' }
],
pendingCheckin: [
{ title: '工单号', dataIndex: 'name', key: 'name', fixed: true, width: 280 },
{ title: '服务对象', dataIndex: 'code', key: 'code', width: 240 },
{ title: '服务地址', dataIndex: 'address', key: 'address', width: 300 },
{ title: '计划服务时间', dataIndex: 'scheduledTime', key: 'scheduledTime', width: 240 },
{ title: '服务人员', dataIndex: 'staff', key: 'staff', width: 240 },
{ title: '操作', key: 'action', width: 240, fixed: 'right' }
// { 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' }
],
completed: [
{ title: '工单号', dataIndex: 'name', key: 'name', fixed: true, width: 280 },
{ title: '服务对象', dataIndex: 'code', key: 'code', width: 240 },
{ title: '服务项目', dataIndex: 'project', key: 'project', width: 240 },
{ title: '实际服务时间', dataIndex: 'actualTime', key: 'actualTime', width: 240 },
{ title: '服务人员', dataIndex: 'staff', key: 'staff', width: 240 },
{ title: '操作', key: 'action', width: 240, fixed: 'right' }
// { 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' }
],
cancelled: [
{ title: '工单号', dataIndex: 'name', key: 'name', fixed: true, width: 280 },
{ title: '服务对象', dataIndex: 'code', key: 'code', width: 240 },
{ title: '作废原因', dataIndex: 'cancelReason', key: 'cancelReason', width: 300 },
{ title: '作废时间', dataIndex: 'cancelTime', key: 'cancelTime', width: 240 },
{ title: '操作人', dataIndex: 'operator', key: 'operator', width: 240 },
{ title: '操作', key: 'action', width: 240, fixed: 'right' }
remove: [
// { 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' }
],
expiredUncheckedIn: [
{ title: '工单号', dataIndex: 'name', key: 'name', fixed: true, width: 280 },
{ title: '服务对象', dataIndex: 'code', key: 'code', width: 240 },
{ title: '计划服务时间', dataIndex: 'scheduledTime', key: 'scheduledTime', width: 240 },
{ title: '逾期天数', dataIndex: 'overdueDays', key: 'overdueDays', width: 180 },
{ title: '服务人员', dataIndex: 'staff', key: 'staff', width: 240 },
{ title: '操作', key: 'action', width: 240, fixed: 'right' }
pendingCheckOut: [
// { 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' }
],
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
initialization: 'Initialize',
pendingCheckin: 'Pending_Check-in',
pendingCheckOut: 'Pending_Check-out',
pendingCheckdoing: 'Pending_Check-Doing',
completed: 'Closed',
cancelled: 'Cancelled',
remove: 'Remove',
expiredUncheckedIn: 'Overdue_Unchecked-in',
expiredUncheckedOut: 'Overdue_Unchecked-out'
}
//

View File

@ -237,12 +237,18 @@
import { ref } from 'vue'
import { message } from 'ant-design-vue'
import { useModal, useForm } from '@/hooks'
import apis from '@/apis'
import dayjs from 'dayjs'
import { useDicsStore } from '@/store'
const dicsStore = useDicsStore()
const emit = defineEmits(['ok'])
const { modal, showModal, hideModal } = useModal()
const { formData, formRef, resetForm } = useForm()
//
const initFormData = () => ({
workOrderNo: '',
@ -302,44 +308,130 @@ function handleView(record = {}) {
*/
function loadRecord(record) {
console.log('loadRecord', record)
loadWorkOrderDetail(record.id)
formData.value = {
...initFormData(),
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,
//
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 || '',
// formData.value = {
// ...initFormData(),
// 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,
// //
// 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 || '',
// }
}
/**
* 加载工单详情并填充表单
* @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('加载工单信息失败')
}
}

View File

@ -148,7 +148,13 @@
</template>
<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 v-else-if="column.key === 'action'">