generated from Leo_Ding/web-template
代码修改
This commit is contained in:
parent
10a2f3e4c2
commit
bb32d532bf
22
src/apis/modules/workOrder.js
Normal file
22
src/apis/modules/workOrder.js
Normal file
@ -0,0 +1,22 @@
|
||||
// 工单模块
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 工单列表-- 全部
|
||||
export const getWorkOrderList = (params) => request.basic.get('/api/v1/orders', params)
|
||||
|
||||
// 异常工单列表
|
||||
export const getAbnormalWorkOrderList = (params) => request.basic.get('/api/v1/orders/errors_order', params)
|
||||
|
||||
// 我下的工单
|
||||
export const getMyWorkOrderList = (params) => request.basic.get('/api/v1/orders/my_order', params)
|
||||
|
||||
// 回访记录
|
||||
export const getBackRecordList = (params) => request.basic.get('/api/v1/orders/back_order', params)
|
||||
|
||||
// 工单回访列表
|
||||
export const getBackWorkOrderList = (params) => request.basic.get(`/api/v1/orders/noback_order`, params)
|
||||
|
||||
|
||||
// 工单详情
|
||||
export const getWorkOrderDetail = (id) => request.basic.get(`/api/v1/orders/${id}`)
|
||||
|
||||
@ -56,6 +56,7 @@
|
||||
:columns="columns"
|
||||
:data-source="listData"
|
||||
:row-selection="rowSelection"
|
||||
:scroll="{ x: 'max-content' }"
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="'menuType' === column.key">
|
||||
@ -147,6 +148,7 @@ import ViewDialog from './components/viewDialog.vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import storage from '@/utils/storage'
|
||||
import AreaCascader from '@/components/AreaCascader/index.vue'
|
||||
import dayjs from 'dayjs'
|
||||
defineOptions({
|
||||
// eslint-disable-next-line vue/no-reserved-component-names
|
||||
name: 'menu',
|
||||
@ -222,29 +224,44 @@ getMenuList()
|
||||
* 获取菜单列表
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
|
||||
async function getMenuList() {
|
||||
try {
|
||||
showLoading()
|
||||
// const { current } = paginationState
|
||||
const platform = storage.local.getItem('platform')
|
||||
const { data, success, total } = await apis.menu
|
||||
.getMenuList({
|
||||
...searchFormData.value,
|
||||
platform
|
||||
})
|
||||
.catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
const { pageSize, current } = paginationState
|
||||
|
||||
const { success, data, total } = await apis.workOrder.getAbnormalWorkOrderList({
|
||||
pageSize,
|
||||
current: current,
|
||||
...searchFormData.value,
|
||||
})
|
||||
|
||||
// 字段映射
|
||||
const mappedData = data.map(item => ({
|
||||
id: item.orderNum || item.id, // 如果没有 id,可以用 orderNum 代替,或后端补充
|
||||
orderId: item.orderNum || '-', // 工单号
|
||||
customerName: item.customerName || '-', // 姓名
|
||||
identityNo: item.customerIdCard || '-', // 身份证号
|
||||
serviceUserName: item.serviceName || '-', // 服务人员
|
||||
itemNames: item.projects?.map(p => p.name).join('、') || '-', // 服务项目(多个用顿号连接)
|
||||
realStartTime: item.signInAt, // 签入时间(保持原格式,formatUtcDateTime 会处理)
|
||||
realEndTime: item.signOutAt, // 签出时间
|
||||
processStatus: item.processStatus === '1' ? '已处理' : item.processStatus === '0' ? '未处理' : '未知', // 处理状态(根据实际枚举调整)
|
||||
processRemark: item.reason || '-', // 处理原因
|
||||
processUserName: item.userName || '-', // 处理人
|
||||
processTime: dayjs(item.processAt).format('YYYY-MM-DD HH:mm:ss'), // 处理时间
|
||||
serviceAddress: item.detailAddress || '-', // 服务地址
|
||||
// 原始数据保留,便于后续操作(如提交处理时用 id)
|
||||
raw: item,
|
||||
}))
|
||||
|
||||
listData.value = mappedData
|
||||
paginationState.total = total
|
||||
hideLoading()
|
||||
if (config('http.code.success') === success) {
|
||||
data.forEach((item) => {
|
||||
item.name = t(item.code) || item.name
|
||||
})
|
||||
listData.value = data
|
||||
paginationState.total = total
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取工单列表失败:', error)
|
||||
hideLoading()
|
||||
message.error('获取数据失败')
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
||||
@ -170,25 +170,27 @@ getMenuList()
|
||||
async function getMenuList() {
|
||||
try {
|
||||
showLoading()
|
||||
// const { current } = paginationState
|
||||
const platform = storage.local.getItem('platform')
|
||||
const { data, success, total } = await apis.menu
|
||||
.getMenuList({
|
||||
...searchFormData.value,
|
||||
platform
|
||||
})
|
||||
.catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
hideLoading()
|
||||
const { pageSize, current } = paginationState
|
||||
const params = {
|
||||
pageSize,
|
||||
current,
|
||||
...searchFormData.value
|
||||
}
|
||||
|
||||
params.status = 'Invalid_WorkerOrder'
|
||||
|
||||
console.log("=====search params", params)
|
||||
|
||||
const { success, data, total } = await apis.workOrder.getWorkOrderList(params)
|
||||
|
||||
if (config('http.code.success') === success) {
|
||||
data.forEach((item) => {
|
||||
item.name = t(item.code) || item.name
|
||||
})
|
||||
listData.value = data
|
||||
paginationState.total = total
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取工单列表失败:', error)
|
||||
message.error('获取数据失败')
|
||||
} finally {
|
||||
hideLoading()
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,15 +41,15 @@
|
||||
</template>
|
||||
</x-search-bar>
|
||||
<a-card>
|
||||
<x-action-bar class="mb-8-2">
|
||||
<!-- <x-action-bar class="mb-8-2">
|
||||
<a-button v-action="'add'" type="primary" @click="$refs.editDialogRef.handleCreate()">
|
||||
<template #icon>
|
||||
<plus-outlined></plus-outlined>
|
||||
</template>
|
||||
{{ $t('pages.system.menu.add') }}
|
||||
</a-button>
|
||||
</x-action-bar>
|
||||
<a-table rowKey="id" :loading="loading" :pagination="true" :columns="columns" :data-source="listData">
|
||||
</x-action-bar> -->
|
||||
<a-table rowKey="id" :loading="loading" :pagination="true" :columns="columns" :data-source="listData" :scroll="{ x: 'max-content' }">
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="'menuType' === column.key">
|
||||
<!--菜单-->
|
||||
@ -123,21 +123,19 @@ defineOptions({
|
||||
})
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const columns = ref([
|
||||
{ title: '工单号', dataIndex: 'name', key: 'name', fixed: true, width: 280 },
|
||||
{ title: '服务对象', dataIndex: 'code', key: 'code', width: 240 },
|
||||
{ title: '身份证号', dataIndex: 'type', key: 'menuType', width: 240 },
|
||||
{ title: '联系方式1', dataIndex: 'status', key: 'statusType', width: 240 },
|
||||
{ title: '联系方式2', dataIndex: 'sequence', width: 240 },
|
||||
{ title: '计划服务时间', dataIndex: 'created_at', key: 'createAt', width: 240 },
|
||||
{ title: '计划服务时常(分钟)', dataIndex: 'created_at', key: 'createAt', width: 240 },
|
||||
{ title: '服务项目', dataIndex: 'created_at', key: 'createAt', width: 240 },
|
||||
{ title: '所属区域', dataIndex: 'created_at', key: 'createAt', width: 240 },
|
||||
{ title: '服务地址', dataIndex: 'created_at', key: 'createAt', width: 240 },
|
||||
{ title: '服务组织', dataIndex: 'created_at', key: 'createAt', width: 240 },
|
||||
{ title: '服务人员', dataIndex: 'created_at', key: 'createAt', width: 240 },
|
||||
{ title: '下单员', dataIndex: 'created_at', key: 'createAt', width: 240 },
|
||||
{ title: '下单时间', dataIndex: 'created_at', key: 'createAt', width: 240 },
|
||||
])
|
||||
{ title: '工单号', dataIndex: 'orderId', key: 'orderId', width: 180 },
|
||||
{ title: '服务对象', dataIndex: 'customerName', key: 'customerName', width: 150 },
|
||||
{ title: '身份证号', dataIndex: 'identityNo', key: 'identityNo', width: 300 },
|
||||
{ title: '联系方式1', dataIndex: 'contact1', key: 'contact1', width: 150 },
|
||||
{ title: '联系方式2', dataIndex: 'contact2', key: 'contact2', width: 150 },
|
||||
{ title: '计划服务时常(分钟)', dataIndex: 'workDuration', key: 'workDuration', width: 160 },
|
||||
{ title: '服务项目', dataIndex: 'itemNames', key: 'itemNames', width: 200 },
|
||||
{ title: '所属区域', dataIndex: 'areaLabels', key: 'areaLabels', width: 200, customRender: ({ text }) => text?.join('、') || '-' },
|
||||
{ title: '服务地址', dataIndex: 'serviceAddress', key: 'serviceAddress', width: 200 },
|
||||
{ title: '服务人员', dataIndex: 'serviceUserName', key: 'serviceUserName', width: 150 },
|
||||
{ title: '下单员', dataIndex: 'processUserName', key: 'processUserName', width: 150 },
|
||||
{ title: '下单时间', dataIndex: 'createAt', key: 'createAt', width: 180, customRender: ({ record }) => formatUtcDateTime(record.raw.createAt) },
|
||||
]);
|
||||
const { listData, loading, showLoading, hideLoading, searchFormData, paginationState, resetPagination } =
|
||||
usePagination()
|
||||
const { resetForm } = useForm()
|
||||
@ -152,26 +150,44 @@ getMenuList()
|
||||
async function getMenuList() {
|
||||
try {
|
||||
showLoading()
|
||||
// const { current } = paginationState
|
||||
const platform = storage.local.getItem('platform')
|
||||
const { data, success, total } = await apis.menu
|
||||
.getMenuList({
|
||||
...searchFormData.value,
|
||||
platform
|
||||
})
|
||||
.catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
const { pageSize, current } = paginationState
|
||||
|
||||
const { success, data, total } = await apis.workOrder.getMyWorkOrderList({
|
||||
pageSize,
|
||||
current: current,
|
||||
...searchFormData.value,
|
||||
})
|
||||
|
||||
// 字段映射
|
||||
const mappedData = data.map(item => {
|
||||
// 联系方式2:优先 otherPhone1,若为空则用 otherPhone2
|
||||
const contact2 = item.otherPhone1 || item.otherPhone2 || '-';
|
||||
|
||||
return {
|
||||
id: item.orderNum || item.customerIdCard, // 唯一标识,可调整
|
||||
orderId: item.orderNum || '-',
|
||||
customerName: item.customerName || '-',
|
||||
identityNo: item.customerIdCard || '-',
|
||||
contact1: item.contact1 || '-',
|
||||
contact2: contact2,
|
||||
workDuration: item.workDuration ? `${item.workDuration} 分钟` : '-',
|
||||
itemNames: item.projects?.map(p => p.name).join('、') || '-',
|
||||
areaLabels: item.areaLabels || [],
|
||||
serviceAddress: item.detailAddress || '-',
|
||||
serviceUserName: item.serviceName || '-',
|
||||
processUserName: item.userName || '-',
|
||||
createAt: item.createAt, // 保留原始时间用于格式化
|
||||
raw: item, // 保留原始数据
|
||||
};
|
||||
});
|
||||
|
||||
listData.value = mappedData
|
||||
paginationState.total = total
|
||||
hideLoading()
|
||||
if (config('http.code.success') === success) {
|
||||
data.forEach((item) => {
|
||||
item.name = t(item.code) || item.name
|
||||
})
|
||||
listData.value = data
|
||||
paginationState.total = total
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取工单列表失败:', error)
|
||||
hideLoading()
|
||||
message.error('获取数据失败')
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
||||
@ -138,7 +138,8 @@
|
||||
<!-- 表格区域 -->
|
||||
<a-card style="margin-top: 16px;">
|
||||
<x-action-bar class="mb-8-2">
|
||||
<a-button v-action="'add'" type="primary" @click="$refs.editDialogRef.handleCreate()" style="margin-right: 20px;">
|
||||
<a-button v-action="'add'" type="primary" @click="$refs.editDialogRef.handleCreate()"
|
||||
style="margin-right: 20px;">
|
||||
<template #icon>
|
||||
<!-- <plus-outlined /> -->
|
||||
</template>
|
||||
@ -153,7 +154,8 @@
|
||||
</a-button>
|
||||
</x-action-bar>
|
||||
|
||||
<a-table rowKey="id" :loading="loading" :pagination="true" :columns="currentColumns" :data-source="listData">
|
||||
<a-table rowKey="id" :loading="loading" :pagination="true" :columns="currentColumns" :data-source="listData"
|
||||
:scroll="{ x: 'max-content' }">
|
||||
<!-- 表格列渲染逻辑保持不变 -->
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="'menuType' === column.key">
|
||||
@ -182,14 +184,14 @@
|
||||
<template v-if="['all', 'initialization', 'pendingCheckin'].includes(activeTabKey)">
|
||||
<x-action-button @click="$refs.cancelDialogRef.showCancelModal(record)">
|
||||
<a-tooltip><template #title>
|
||||
{{ '作废' }}</template>作废
|
||||
{{ '作废' }}</template>作废
|
||||
</a-tooltip>
|
||||
</x-action-button>
|
||||
</template>
|
||||
|
||||
<template v-if="['all', 'initialization'].includes(activeTabKey)">
|
||||
<x-action-button @click="$refs.editDialogRef.showEditModal(record)">
|
||||
<a-tooltip><template #title>编辑</template>编辑</a-tooltip>
|
||||
<a-tooltip><template #title>编辑</template>编辑</a-tooltip>
|
||||
</x-action-button>
|
||||
</template>
|
||||
|
||||
@ -199,8 +201,8 @@
|
||||
</x-action-button>
|
||||
</template>
|
||||
|
||||
<template v-if="['all','expiredUncheckedIn', 'expiredUncheckedOut'].includes(activeTabKey)">
|
||||
<x-action-button @click="$refs.checkDialogRef.showCheckModal(record)" >
|
||||
<template v-if="['all', 'expiredUncheckedIn', 'expiredUncheckedOut'].includes(activeTabKey)">
|
||||
<x-action-button @click="$refs.checkDialogRef.showCheckModal(record)">
|
||||
<a-tooltip><template #title>待签入</template>待签入</a-tooltip>
|
||||
</x-action-button>
|
||||
</template>
|
||||
@ -213,7 +215,7 @@
|
||||
<CancelWorkOrder @ok="onOk" ref="cancelDialogRef" />
|
||||
<view-dialog @ok="onOk" ref="viewDialogRef" />
|
||||
<check-dialog @ok="onOk" ref="checkDialogRef" />
|
||||
|
||||
|
||||
<!-- 作废确认模态 框 -->
|
||||
<!-- <a-modal
|
||||
v-model:open="cancelModalVisible"
|
||||
@ -246,6 +248,7 @@ import CheckDialog from './components/CheckDialog.vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import storage from '@/utils/storage'
|
||||
import AreaCascader from '@/components/AreaCascader/index.vue'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
defineOptions({
|
||||
name: 'menu',
|
||||
@ -262,14 +265,68 @@ const cancelReason = ref('')
|
||||
// 不同标签页对应的表格列配置
|
||||
const columnConfigs = ref({
|
||||
all: [
|
||||
{ title: '工单号', dataIndex: 'name', key: 'name', fixed: true, width: 280 },
|
||||
{ title: '服务对象', dataIndex: 'code', key: 'code', width: 240 },
|
||||
{ title: '身份证号', dataIndex: 'idCard', key: 'idCard', width: 240 },
|
||||
{ title: '联系方式1', dataIndex: 'phone1', key: 'phone1', width: 240 },
|
||||
{ title: '联系方式2', dataIndex: 'phone2', key: 'phone2', width: 240 },
|
||||
{ title: '计划服务时间', dataIndex: 'scheduledTime', key: 'scheduledTime', width: 240 },
|
||||
{ title: '服务状态', dataIndex: 'status', key: 'statusType', width: 180 },
|
||||
|
||||
// { 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' }
|
||||
|
||||
],
|
||||
initialization: [
|
||||
{ title: '工单号', dataIndex: 'name', key: 'name', fixed: true, width: 280 },
|
||||
@ -334,6 +391,15 @@ const viewDialogRef = ref()
|
||||
const checkDialogRef = ref()
|
||||
// 控制高级查询面板是否展开
|
||||
const advancedSearchVisible = ref([]) // 默认收起
|
||||
const tabKeyToStatusMap = {
|
||||
all: undefined, // 全部不传 status
|
||||
initialization: 'Initialize',
|
||||
pendingCheckin: 'Pending_Check-in',
|
||||
completed: 'Closed',
|
||||
cancelled: 'Cancelled',
|
||||
expiredUncheckedIn: 'Overdue_Unchecked-in',
|
||||
expiredUncheckedOut: 'Overdue_Unchecked-out'
|
||||
}
|
||||
|
||||
// 初始加载数据
|
||||
getMenuList()
|
||||
@ -345,25 +411,34 @@ getMenuList()
|
||||
async function getMenuList() {
|
||||
try {
|
||||
showLoading()
|
||||
const platform = storage.local.getItem('platform')
|
||||
const { data, success, total } = await apis.menu
|
||||
.getMenuList({
|
||||
...searchFormData.value,
|
||||
status: activeTabKey.value, // 将标签页key作为状态参数传递
|
||||
platform
|
||||
})
|
||||
.catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
hideLoading()
|
||||
const { pageSize, current } = paginationState
|
||||
|
||||
// 获取当前 tab 对应的 status
|
||||
const status = tabKeyToStatusMap[activeTabKey.value]
|
||||
|
||||
const params = {
|
||||
pageSize,
|
||||
current,
|
||||
...searchFormData.value
|
||||
}
|
||||
|
||||
// 只有 status 不为 undefined 时才加入参数
|
||||
if (status !== undefined) {
|
||||
params.status = status
|
||||
}
|
||||
|
||||
console.log("=====search params", params)
|
||||
|
||||
const { success, data, total } = await apis.workOrder.getWorkOrderList(params)
|
||||
|
||||
if (config('http.code.success') === success) {
|
||||
data.forEach((item) => {
|
||||
item.name = t(item.code) || item.name
|
||||
})
|
||||
listData.value = data
|
||||
paginationState.total = total
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取工单列表失败:', error)
|
||||
message.error('获取数据失败')
|
||||
} finally {
|
||||
hideLoading()
|
||||
}
|
||||
}
|
||||
@ -371,7 +446,18 @@ async function getMenuList() {
|
||||
/**
|
||||
* 标签页切换事件
|
||||
*/
|
||||
|
||||
|
||||
function handleTabChange(key) {
|
||||
// 全部不用传
|
||||
// 初始化 Initialize
|
||||
// 待签入 Pending_Check-in
|
||||
// 待签出 Pending_Check-out
|
||||
// 已结单 Closed
|
||||
// 已作废 Cancelled
|
||||
// 过期未签入 Overdue_Unchecked-in
|
||||
// 过期未签出 Overdue_Unchecked-out
|
||||
console.log('active tab key:', key)
|
||||
activeTabKey.value = key
|
||||
resetPagination()
|
||||
getMenuList() // 切换标签页时重新加载数据
|
||||
@ -408,7 +494,7 @@ function showCancelModal(record) {
|
||||
*/
|
||||
async function confirmCancel() {
|
||||
if (!cancelRecord.value) return
|
||||
|
||||
|
||||
try {
|
||||
const { success } = await apis.menu.cancelMenu({
|
||||
id: cancelRecord.value.id,
|
||||
@ -416,7 +502,7 @@ async function confirmCancel() {
|
||||
}).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
|
||||
|
||||
if (config('http.code.success') === success) {
|
||||
message.success('工单已作废')
|
||||
cancelModalVisible.value = false
|
||||
@ -479,7 +565,7 @@ function onAreaChange(value) {
|
||||
|
||||
// 切换高级查询
|
||||
function toggleAdvancedSearch() {
|
||||
advancedSearchVisible.value = advancedSearchVisible.value.length ? [] : ['1']
|
||||
advancedSearchVisible.value = advancedSearchVisible.value.length ? [] : ['1']
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -493,10 +579,7 @@ function toggleAdvancedSearch() {
|
||||
|
||||
// 在 style 中添加
|
||||
.ant-btn-link:hover {
|
||||
color: #0050b3;
|
||||
text-decoration: underline;
|
||||
color: #0050b3;
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
|
||||
@ -218,77 +218,22 @@ const detailRef = ref()
|
||||
// 控制高级查询面板是否展开
|
||||
const advancedSearchVisible = ref([]) // 默认收起
|
||||
|
||||
const treeData = ref([
|
||||
{
|
||||
title: 'Node1',
|
||||
value: '0-0',
|
||||
key: '0-0',
|
||||
children: [
|
||||
{
|
||||
value: '0-0-1',
|
||||
key: '0-0-1',
|
||||
slots: {
|
||||
title: 'title',
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'Child Node2',
|
||||
value: '0-0-2',
|
||||
key: '0-0-2',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'Node2',
|
||||
value: '0-1',
|
||||
key: '0-1',
|
||||
},
|
||||
]);
|
||||
const options = ref([
|
||||
{
|
||||
value: 'zhejiang',
|
||||
label: 'Zhejiang',
|
||||
children: [
|
||||
{
|
||||
value: 'hangzhou',
|
||||
label: 'Hangzhou',
|
||||
children: [
|
||||
{
|
||||
value: 'xihu',
|
||||
label: 'West Lake',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: 'jiangsu',
|
||||
label: 'Jiangsu',
|
||||
children: [
|
||||
{
|
||||
value: 'nanjing',
|
||||
label: 'Nanjing',
|
||||
children: [
|
||||
{
|
||||
value: 'zhonghuamen',
|
||||
label: 'Zhong Hua Men',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},])
|
||||
|
||||
getPageList()
|
||||
|
||||
async function getPageList() {
|
||||
console.log("===1")
|
||||
try {
|
||||
const { pageSize, current } = paginationState
|
||||
const { success, data, total } = await apis.serviceStaffList
|
||||
.getProjectList({
|
||||
const { success, data, total } = await apis.workOrder
|
||||
.getBackRecordList({
|
||||
pageSize,
|
||||
current: current,
|
||||
...searchFormData.value,
|
||||
})
|
||||
|
||||
listData.value = data
|
||||
paginationState.total = total
|
||||
console.log("===",data)
|
||||
.catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
|
||||
@ -124,9 +124,9 @@
|
||||
</template>
|
||||
</x-search-bar>
|
||||
|
||||
<a-row :gutter="8" :wrap="false">
|
||||
<a-row :gutter="8" :wrap="false" style="margin-top: 20px;">
|
||||
<a-col flex="auto">
|
||||
<a-card title="服务人员列表">
|
||||
<a-card title="回访列表">
|
||||
<div style="margin-bottom: 20px;">
|
||||
<a-space>
|
||||
<a-button type="primary">导入</a-button>
|
||||
@ -135,14 +135,23 @@
|
||||
<a-button type="primary">导出记录</a-button>
|
||||
</a-space>
|
||||
</div>
|
||||
<a-table :columns="columns" :data-source="listData" bordered :loading="loading"
|
||||
:pagination="paginationState" :scroll="{ x: 'max-content' }" @change="onTableChange">
|
||||
<template #bodyCell="{ index, column }">
|
||||
<a-table rowKey="id" :loading="loading" :pagination="true" :columns="columns" :data-source="listData"
|
||||
:scroll="{ x: 'max-content' }">
|
||||
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.key === 'serialNumber'">
|
||||
<span>{{ index + 1 }}</span>
|
||||
</template>
|
||||
|
||||
<template v-if="'action' === column.key">
|
||||
<template v-else-if="column.dataIndex === 'otherPhone1'">
|
||||
<span>{{ record.otherPhone1 || record.otherPhone2 || '—' }}</span>
|
||||
</template>
|
||||
|
||||
<template v-else-if="column.dataIndex === 'plannedServiceStartDate'">
|
||||
<span>{{ formatDate(record.plannedServiceStartDate) }}</span>
|
||||
</template>
|
||||
|
||||
<template v-else-if="column.key === 'action'">
|
||||
<x-action-button @click="$refs.editDialogRef.handleView(record)">
|
||||
<span>详情</span>
|
||||
</x-action-button>
|
||||
@ -150,8 +159,6 @@
|
||||
回访
|
||||
</x-action-button>
|
||||
</template>
|
||||
|
||||
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
@ -176,6 +183,7 @@ import { useDicsStore } from '@/store'
|
||||
import EditDialog from './components/EditDialog.vue'
|
||||
// 引入回访弹框组件
|
||||
import VisitDialog from './components/VisitDialog.vue'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
defineOptions({
|
||||
name: 'allocation',
|
||||
@ -186,18 +194,19 @@ const { t } = useI18n()
|
||||
|
||||
// 表格列
|
||||
const columns = [
|
||||
{ title: '序号', dataIndex: 'serialNumber', key: 'serialNumber', align: 'center', width: 80 },
|
||||
{ title: '姓名', dataIndex: 'name', key: 'name', align: 'center', width: 100 },
|
||||
{ title: '性别', dataIndex: 'gender', key: 'gender', align: 'center', width: 80 },
|
||||
{ title: '电话', dataIndex: 'phone', key: 'phone', align: 'center', width: 120 },
|
||||
{ title: '身份证号', dataIndex: 'idCard', key: 'idCard', align: 'center', width: 180 },
|
||||
{ title: '护理人员类型', dataIndex: 'serviceType', key: 'serviceType', align: 'center', width: 120 },
|
||||
{ title: '用工形式', dataIndex: 'workType', key: 'workType', align: 'center', width: 120 },
|
||||
{ title: '状态', dataIndex: 'status', key: 'status', align: 'center', width: 100 },
|
||||
{ title: '所属服务组织', dataIndex: 'stationName', key: 'stationName', align: 'center', width: 150 },
|
||||
{ title: '操作', key: 'action', width: 240, fixed: 'right', align: 'center' }
|
||||
{ title: '订单号', dataIndex: 'orderNum', key: 'orderNum', align: 'center', width: 80 },
|
||||
{ title: '服务对象姓名', dataIndex: 'customerName', key: 'customerName', align: 'center', width: 100 },
|
||||
{ title: '电话', dataIndex: 'contact1', key: 'contact1', align: 'center', width: 120 },
|
||||
{ title: '电话1', dataIndex: 'otherPhone1', key: 'otherPhone1', align: 'center', width: 120 },
|
||||
{ title: '电话2', dataIndex: 'otherPhone2', key: 'otherPhone2', align: 'center', width: 120 },
|
||||
{ title: '身份证号', dataIndex: 'customerIdCard', key: 'customerIdCard', align: 'center', width: 240 },
|
||||
{ title: '地址', dataIndex: 'detailAddress', key: 'detailAddress', align: 'center', width: 240 },
|
||||
{ title: '服务人员姓名', dataIndex: 'serviceName', key: 'serviceName', align: 'center', width: 120 },
|
||||
{ title: '服务项目名称', dataIndex: 'workType', key: 'workType', align: 'center', width: 120 },
|
||||
{ title: '计划服务开始时间', dataIndex: 'plannedServiceStartDate', key: 'plannedServiceStartDate', align: 'center', width: 100 },
|
||||
{ title: '状态', dataIndex: 'status', key: 'status', align: 'center', width: 150 },
|
||||
{ title: '操作', key: 'action', width: 140, fixed: 'right' }
|
||||
]
|
||||
|
||||
// 分页与搜索数据
|
||||
const {
|
||||
listData,
|
||||
@ -227,44 +236,25 @@ const detailRef = ref()
|
||||
const advancedSearchVisible = ref([]) // 高级查询默认收起
|
||||
// 回访弹框引用
|
||||
const visitDialogRef = ref()
|
||||
// 计算所有列宽度总和
|
||||
const totalWidth = columns.reduce((sum, col) => sum + (col.width || 100), 0);
|
||||
|
||||
// 获取列表(mock 数据)
|
||||
async function getPageList() {
|
||||
loading.value = true
|
||||
try {
|
||||
// ========== 临时 mock 数据 ==========
|
||||
const mockData = [
|
||||
{
|
||||
serialNumber: 1,
|
||||
name: '张三',
|
||||
gender: '男',
|
||||
phone: '13800138000',
|
||||
idCard: '110101199003077890',
|
||||
serviceType: '全职护理员',
|
||||
workType: '劳动合同',
|
||||
status: '在职',
|
||||
stationName: '朝阳区居家养老服务中心',
|
||||
}
|
||||
]
|
||||
listData.value = mockData
|
||||
paginationState.total = 1
|
||||
// ==================================
|
||||
|
||||
// ====== 未来替换为真实接口 ======
|
||||
// const { pageSize, current } = paginationState
|
||||
// const params = {
|
||||
// pageSize,
|
||||
// current,
|
||||
// ...searchFormData.value,
|
||||
// }
|
||||
// if (Array.isArray(params.plannedDate) && params.plannedDate.length === 0) {
|
||||
// delete params.plannedDate
|
||||
// }
|
||||
// const { success, data, total } = await apis.serviceStaffList.getProjectList(params)
|
||||
// if (config('http.code.success') === success) {
|
||||
// listData.value = data
|
||||
// paginationState.total = total
|
||||
// }
|
||||
const { pageSize, current } = paginationState
|
||||
const params = {
|
||||
pageSize,
|
||||
current,
|
||||
...searchFormData.value,
|
||||
}
|
||||
if (Array.isArray(params.plannedDate) && params.plannedDate.length === 0) {
|
||||
delete params.plannedDate
|
||||
}
|
||||
const { success, data, total } = await apis.workOrder.getBackWorkOrderList(params)
|
||||
listData.value = data
|
||||
paginationState.total = total
|
||||
} catch (error) {
|
||||
console.error('获取列表失败:', error)
|
||||
message.error('加载数据失败')
|
||||
@ -326,14 +316,14 @@ function handleDetail(record) {
|
||||
|
||||
// 操作:回访(点击行内“回访”按钮时触发)
|
||||
function handleVisit(record) {
|
||||
visitDialogRef.value.handleOpen(record) // 打开回访弹框
|
||||
visitDialogRef.value.handleOpen(record) // 打开回访弹框
|
||||
}
|
||||
|
||||
// 回访提交成功后的回调
|
||||
function onVisitOk(formData) {
|
||||
console.log('回访表单数据:', formData)
|
||||
message.success('回访提交成功')
|
||||
getPageList() // 重新获取列表,更新状态
|
||||
console.log('回访表单数据:', formData)
|
||||
message.success('回访提交成功')
|
||||
getPageList() // 重新获取列表,更新状态
|
||||
}
|
||||
|
||||
// 页面初始化
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user