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"
|
:columns="columns"
|
||||||
:data-source="listData"
|
:data-source="listData"
|
||||||
:row-selection="rowSelection"
|
:row-selection="rowSelection"
|
||||||
|
:scroll="{ x: 'max-content' }"
|
||||||
>
|
>
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record }">
|
||||||
<template v-if="'menuType' === column.key">
|
<template v-if="'menuType' === column.key">
|
||||||
@ -147,6 +148,7 @@ import ViewDialog from './components/viewDialog.vue'
|
|||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import storage from '@/utils/storage'
|
import storage from '@/utils/storage'
|
||||||
import AreaCascader from '@/components/AreaCascader/index.vue'
|
import AreaCascader from '@/components/AreaCascader/index.vue'
|
||||||
|
import dayjs from 'dayjs'
|
||||||
defineOptions({
|
defineOptions({
|
||||||
// eslint-disable-next-line vue/no-reserved-component-names
|
// eslint-disable-next-line vue/no-reserved-component-names
|
||||||
name: 'menu',
|
name: 'menu',
|
||||||
@ -222,29 +224,44 @@ getMenuList()
|
|||||||
* 获取菜单列表
|
* 获取菜单列表
|
||||||
* @return {Promise<void>}
|
* @return {Promise<void>}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
async function getMenuList() {
|
async function getMenuList() {
|
||||||
try {
|
try {
|
||||||
showLoading()
|
showLoading()
|
||||||
// const { current } = paginationState
|
const { pageSize, current } = paginationState
|
||||||
const platform = storage.local.getItem('platform')
|
|
||||||
const { data, success, total } = await apis.menu
|
const { success, data, total } = await apis.workOrder.getAbnormalWorkOrderList({
|
||||||
.getMenuList({
|
pageSize,
|
||||||
|
current: current,
|
||||||
...searchFormData.value,
|
...searchFormData.value,
|
||||||
platform
|
|
||||||
})
|
})
|
||||||
.catch(() => {
|
|
||||||
throw new Error()
|
// 字段映射
|
||||||
})
|
const mappedData = data.map(item => ({
|
||||||
hideLoading()
|
id: item.orderNum || item.id, // 如果没有 id,可以用 orderNum 代替,或后端补充
|
||||||
if (config('http.code.success') === success) {
|
orderId: item.orderNum || '-', // 工单号
|
||||||
data.forEach((item) => {
|
customerName: item.customerName || '-', // 姓名
|
||||||
item.name = t(item.code) || item.name
|
identityNo: item.customerIdCard || '-', // 身份证号
|
||||||
})
|
serviceUserName: item.serviceName || '-', // 服务人员
|
||||||
listData.value = data
|
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
|
paginationState.total = total
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
hideLoading()
|
hideLoading()
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取工单列表失败:', error)
|
||||||
|
hideLoading()
|
||||||
|
message.error('获取数据失败')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -170,25 +170,27 @@ getMenuList()
|
|||||||
async function getMenuList() {
|
async function getMenuList() {
|
||||||
try {
|
try {
|
||||||
showLoading()
|
showLoading()
|
||||||
// const { current } = paginationState
|
const { pageSize, current } = paginationState
|
||||||
const platform = storage.local.getItem('platform')
|
const params = {
|
||||||
const { data, success, total } = await apis.menu
|
pageSize,
|
||||||
.getMenuList({
|
current,
|
||||||
...searchFormData.value,
|
...searchFormData.value
|
||||||
platform
|
}
|
||||||
})
|
|
||||||
.catch(() => {
|
params.status = 'Invalid_WorkerOrder'
|
||||||
throw new Error()
|
|
||||||
})
|
console.log("=====search params", params)
|
||||||
hideLoading()
|
|
||||||
|
const { success, data, total } = await apis.workOrder.getWorkOrderList(params)
|
||||||
|
|
||||||
if (config('http.code.success') === success) {
|
if (config('http.code.success') === success) {
|
||||||
data.forEach((item) => {
|
|
||||||
item.name = t(item.code) || item.name
|
|
||||||
})
|
|
||||||
listData.value = data
|
listData.value = data
|
||||||
paginationState.total = total
|
paginationState.total = total
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error('获取工单列表失败:', error)
|
||||||
|
message.error('获取数据失败')
|
||||||
|
} finally {
|
||||||
hideLoading()
|
hideLoading()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,15 +41,15 @@
|
|||||||
</template>
|
</template>
|
||||||
</x-search-bar>
|
</x-search-bar>
|
||||||
<a-card>
|
<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()">
|
<a-button v-action="'add'" type="primary" @click="$refs.editDialogRef.handleCreate()">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<plus-outlined></plus-outlined>
|
<plus-outlined></plus-outlined>
|
||||||
</template>
|
</template>
|
||||||
{{ $t('pages.system.menu.add') }}
|
{{ $t('pages.system.menu.add') }}
|
||||||
</a-button>
|
</a-button>
|
||||||
</x-action-bar>
|
</x-action-bar> -->
|
||||||
<a-table rowKey="id" :loading="loading" :pagination="true" :columns="columns" :data-source="listData">
|
<a-table rowKey="id" :loading="loading" :pagination="true" :columns="columns" :data-source="listData" :scroll="{ x: 'max-content' }">
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record }">
|
||||||
<template v-if="'menuType' === column.key">
|
<template v-if="'menuType' === column.key">
|
||||||
<!--菜单-->
|
<!--菜单-->
|
||||||
@ -123,21 +123,19 @@ defineOptions({
|
|||||||
})
|
})
|
||||||
const { t } = useI18n() // 解构出t方法
|
const { t } = useI18n() // 解构出t方法
|
||||||
const columns = ref([
|
const columns = ref([
|
||||||
{ title: '工单号', dataIndex: 'name', key: 'name', fixed: true, width: 280 },
|
{ title: '工单号', dataIndex: 'orderId', key: 'orderId', width: 180 },
|
||||||
{ title: '服务对象', dataIndex: 'code', key: 'code', width: 240 },
|
{ title: '服务对象', dataIndex: 'customerName', key: 'customerName', width: 150 },
|
||||||
{ title: '身份证号', dataIndex: 'type', key: 'menuType', width: 240 },
|
{ title: '身份证号', dataIndex: 'identityNo', key: 'identityNo', width: 300 },
|
||||||
{ title: '联系方式1', dataIndex: 'status', key: 'statusType', width: 240 },
|
{ title: '联系方式1', dataIndex: 'contact1', key: 'contact1', width: 150 },
|
||||||
{ title: '联系方式2', dataIndex: 'sequence', width: 240 },
|
{ title: '联系方式2', dataIndex: 'contact2', key: 'contact2', width: 150 },
|
||||||
{ title: '计划服务时间', dataIndex: 'created_at', key: 'createAt', width: 240 },
|
{ title: '计划服务时常(分钟)', dataIndex: 'workDuration', key: 'workDuration', width: 160 },
|
||||||
{ title: '计划服务时常(分钟)', dataIndex: 'created_at', key: 'createAt', width: 240 },
|
{ title: '服务项目', dataIndex: 'itemNames', key: 'itemNames', width: 200 },
|
||||||
{ title: '服务项目', dataIndex: 'created_at', key: 'createAt', width: 240 },
|
{ title: '所属区域', dataIndex: 'areaLabels', key: 'areaLabels', width: 200, customRender: ({ text }) => text?.join('、') || '-' },
|
||||||
{ title: '所属区域', dataIndex: 'created_at', key: 'createAt', width: 240 },
|
{ title: '服务地址', dataIndex: 'serviceAddress', key: 'serviceAddress', width: 200 },
|
||||||
{ title: '服务地址', dataIndex: 'created_at', key: 'createAt', width: 240 },
|
{ title: '服务人员', dataIndex: 'serviceUserName', key: 'serviceUserName', width: 150 },
|
||||||
{ title: '服务组织', dataIndex: 'created_at', key: 'createAt', width: 240 },
|
{ title: '下单员', dataIndex: 'processUserName', key: 'processUserName', width: 150 },
|
||||||
{ title: '服务人员', dataIndex: 'created_at', key: 'createAt', width: 240 },
|
{ title: '下单时间', dataIndex: 'createAt', key: 'createAt', width: 180, customRender: ({ record }) => formatUtcDateTime(record.raw.createAt) },
|
||||||
{ title: '下单员', dataIndex: 'created_at', key: 'createAt', width: 240 },
|
]);
|
||||||
{ title: '下单时间', dataIndex: 'created_at', key: 'createAt', width: 240 },
|
|
||||||
])
|
|
||||||
const { listData, loading, showLoading, hideLoading, searchFormData, paginationState, resetPagination } =
|
const { listData, loading, showLoading, hideLoading, searchFormData, paginationState, resetPagination } =
|
||||||
usePagination()
|
usePagination()
|
||||||
const { resetForm } = useForm()
|
const { resetForm } = useForm()
|
||||||
@ -152,26 +150,44 @@ getMenuList()
|
|||||||
async function getMenuList() {
|
async function getMenuList() {
|
||||||
try {
|
try {
|
||||||
showLoading()
|
showLoading()
|
||||||
// const { current } = paginationState
|
const { pageSize, current } = paginationState
|
||||||
const platform = storage.local.getItem('platform')
|
|
||||||
const { data, success, total } = await apis.menu
|
const { success, data, total } = await apis.workOrder.getMyWorkOrderList({
|
||||||
.getMenuList({
|
pageSize,
|
||||||
|
current: current,
|
||||||
...searchFormData.value,
|
...searchFormData.value,
|
||||||
platform
|
|
||||||
})
|
})
|
||||||
.catch(() => {
|
|
||||||
throw new Error()
|
// 字段映射
|
||||||
})
|
const mappedData = data.map(item => {
|
||||||
hideLoading()
|
// 联系方式2:优先 otherPhone1,若为空则用 otherPhone2
|
||||||
if (config('http.code.success') === success) {
|
const contact2 = item.otherPhone1 || item.otherPhone2 || '-';
|
||||||
data.forEach((item) => {
|
|
||||||
item.name = t(item.code) || item.name
|
return {
|
||||||
})
|
id: item.orderNum || item.customerIdCard, // 唯一标识,可调整
|
||||||
listData.value = data
|
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
|
paginationState.total = total
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
hideLoading()
|
hideLoading()
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取工单列表失败:', error)
|
||||||
|
hideLoading()
|
||||||
|
message.error('获取数据失败')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -138,7 +138,8 @@
|
|||||||
<!-- 表格区域 -->
|
<!-- 表格区域 -->
|
||||||
<a-card style="margin-top: 16px;">
|
<a-card style="margin-top: 16px;">
|
||||||
<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()" style="margin-right: 20px;">
|
<a-button v-action="'add'" type="primary" @click="$refs.editDialogRef.handleCreate()"
|
||||||
|
style="margin-right: 20px;">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<!-- <plus-outlined /> -->
|
<!-- <plus-outlined /> -->
|
||||||
</template>
|
</template>
|
||||||
@ -153,7 +154,8 @@
|
|||||||
</a-button>
|
</a-button>
|
||||||
</x-action-bar>
|
</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 #bodyCell="{ column, record }">
|
||||||
<template v-if="'menuType' === column.key">
|
<template v-if="'menuType' === column.key">
|
||||||
@ -246,6 +248,7 @@ import CheckDialog from './components/CheckDialog.vue'
|
|||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import storage from '@/utils/storage'
|
import storage from '@/utils/storage'
|
||||||
import AreaCascader from '@/components/AreaCascader/index.vue'
|
import AreaCascader from '@/components/AreaCascader/index.vue'
|
||||||
|
import dayjs from 'dayjs'
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'menu',
|
name: 'menu',
|
||||||
@ -262,14 +265,68 @@ const cancelReason = ref('')
|
|||||||
// 不同标签页对应的表格列配置
|
// 不同标签页对应的表格列配置
|
||||||
const columnConfigs = ref({
|
const columnConfigs = ref({
|
||||||
all: [
|
all: [
|
||||||
{ title: '工单号', dataIndex: 'name', key: 'name', fixed: true, width: 280 },
|
|
||||||
{ title: '服务对象', dataIndex: 'code', key: 'code', width: 240 },
|
// { title: '工单号', dataIndex: 'orderNum', key: 'orderNum', fixed: true, width: 280 },
|
||||||
{ title: '身份证号', dataIndex: 'idCard', key: 'idCard', width: 240 },
|
{ title: '服务对象', dataIndex: 'customerName', key: 'customerName', width: 140 },
|
||||||
{ title: '联系方式1', dataIndex: 'phone1', key: 'phone1', width: 240 },
|
{ title: '服务对象身份证', dataIndex: 'customerIdCard', key: 'customerIdCard', width: 240 },
|
||||||
{ title: '联系方式2', dataIndex: 'phone2', key: 'phone2', width: 240 },
|
{
|
||||||
{ title: '计划服务时间', dataIndex: 'scheduledTime', key: 'scheduledTime', width: 240 },
|
title: '服务对象分类', dataIndex: 'labels', key: 'labels', width: 140,
|
||||||
{ title: '服务状态', dataIndex: 'status', key: 'statusType', width: 180 },
|
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' }
|
{ title: '操作', key: 'action', width: 440, fixed: 'right' }
|
||||||
|
|
||||||
],
|
],
|
||||||
initialization: [
|
initialization: [
|
||||||
{ title: '工单号', dataIndex: 'name', key: 'name', fixed: true, width: 280 },
|
{ title: '工单号', dataIndex: 'name', key: 'name', fixed: true, width: 280 },
|
||||||
@ -334,6 +391,15 @@ const viewDialogRef = ref()
|
|||||||
const checkDialogRef = ref()
|
const checkDialogRef = ref()
|
||||||
// 控制高级查询面板是否展开
|
// 控制高级查询面板是否展开
|
||||||
const advancedSearchVisible = 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()
|
getMenuList()
|
||||||
@ -345,25 +411,34 @@ getMenuList()
|
|||||||
async function getMenuList() {
|
async function getMenuList() {
|
||||||
try {
|
try {
|
||||||
showLoading()
|
showLoading()
|
||||||
const platform = storage.local.getItem('platform')
|
const { pageSize, current } = paginationState
|
||||||
const { data, success, total } = await apis.menu
|
|
||||||
.getMenuList({
|
// 获取当前 tab 对应的 status
|
||||||
...searchFormData.value,
|
const status = tabKeyToStatusMap[activeTabKey.value]
|
||||||
status: activeTabKey.value, // 将标签页key作为状态参数传递
|
|
||||||
platform
|
const params = {
|
||||||
})
|
pageSize,
|
||||||
.catch(() => {
|
current,
|
||||||
throw new Error()
|
...searchFormData.value
|
||||||
})
|
}
|
||||||
hideLoading()
|
|
||||||
|
// 只有 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) {
|
if (config('http.code.success') === success) {
|
||||||
data.forEach((item) => {
|
|
||||||
item.name = t(item.code) || item.name
|
|
||||||
})
|
|
||||||
listData.value = data
|
listData.value = data
|
||||||
paginationState.total = total
|
paginationState.total = total
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error('获取工单列表失败:', error)
|
||||||
|
message.error('获取数据失败')
|
||||||
|
} finally {
|
||||||
hideLoading()
|
hideLoading()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -371,7 +446,18 @@ async function getMenuList() {
|
|||||||
/**
|
/**
|
||||||
* 标签页切换事件
|
* 标签页切换事件
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
function handleTabChange(key) {
|
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
|
activeTabKey.value = key
|
||||||
resetPagination()
|
resetPagination()
|
||||||
getMenuList() // 切换标签页时重新加载数据
|
getMenuList() // 切换标签页时重新加载数据
|
||||||
@ -497,6 +583,3 @@ function toggleAdvancedSearch() {
|
|||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -218,77 +218,22 @@ const detailRef = ref()
|
|||||||
// 控制高级查询面板是否展开
|
// 控制高级查询面板是否展开
|
||||||
const advancedSearchVisible = 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()
|
getPageList()
|
||||||
|
|
||||||
async function getPageList() {
|
async function getPageList() {
|
||||||
|
console.log("===1")
|
||||||
try {
|
try {
|
||||||
const { pageSize, current } = paginationState
|
const { pageSize, current } = paginationState
|
||||||
const { success, data, total } = await apis.serviceStaffList
|
const { success, data, total } = await apis.workOrder
|
||||||
.getProjectList({
|
.getBackRecordList({
|
||||||
pageSize,
|
pageSize,
|
||||||
current: current,
|
current: current,
|
||||||
...searchFormData.value,
|
...searchFormData.value,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
listData.value = data
|
||||||
|
paginationState.total = total
|
||||||
|
console.log("===",data)
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
throw new Error()
|
throw new Error()
|
||||||
})
|
})
|
||||||
|
|||||||
@ -124,9 +124,9 @@
|
|||||||
</template>
|
</template>
|
||||||
</x-search-bar>
|
</x-search-bar>
|
||||||
|
|
||||||
<a-row :gutter="8" :wrap="false">
|
<a-row :gutter="8" :wrap="false" style="margin-top: 20px;">
|
||||||
<a-col flex="auto">
|
<a-col flex="auto">
|
||||||
<a-card title="服务人员列表">
|
<a-card title="回访列表">
|
||||||
<div style="margin-bottom: 20px;">
|
<div style="margin-bottom: 20px;">
|
||||||
<a-space>
|
<a-space>
|
||||||
<a-button type="primary">导入</a-button>
|
<a-button type="primary">导入</a-button>
|
||||||
@ -135,14 +135,23 @@
|
|||||||
<a-button type="primary">导出记录</a-button>
|
<a-button type="primary">导出记录</a-button>
|
||||||
</a-space>
|
</a-space>
|
||||||
</div>
|
</div>
|
||||||
<a-table :columns="columns" :data-source="listData" bordered :loading="loading"
|
<a-table rowKey="id" :loading="loading" :pagination="true" :columns="columns" :data-source="listData"
|
||||||
:pagination="paginationState" :scroll="{ x: 'max-content' }" @change="onTableChange">
|
:scroll="{ x: 'max-content' }">
|
||||||
<template #bodyCell="{ index, column }">
|
|
||||||
|
<template #bodyCell="{ column, record, index }">
|
||||||
<template v-if="column.key === 'serialNumber'">
|
<template v-if="column.key === 'serialNumber'">
|
||||||
<span>{{ index + 1 }}</span>
|
<span>{{ index + 1 }}</span>
|
||||||
</template>
|
</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)">
|
<x-action-button @click="$refs.editDialogRef.handleView(record)">
|
||||||
<span>详情</span>
|
<span>详情</span>
|
||||||
</x-action-button>
|
</x-action-button>
|
||||||
@ -150,8 +159,6 @@
|
|||||||
回访
|
回访
|
||||||
</x-action-button>
|
</x-action-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
</a-table>
|
</a-table>
|
||||||
</a-card>
|
</a-card>
|
||||||
@ -176,6 +183,7 @@ import { useDicsStore } from '@/store'
|
|||||||
import EditDialog from './components/EditDialog.vue'
|
import EditDialog from './components/EditDialog.vue'
|
||||||
// 引入回访弹框组件
|
// 引入回访弹框组件
|
||||||
import VisitDialog from './components/VisitDialog.vue'
|
import VisitDialog from './components/VisitDialog.vue'
|
||||||
|
import dayjs from 'dayjs'
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'allocation',
|
name: 'allocation',
|
||||||
@ -186,18 +194,19 @@ const { t } = useI18n()
|
|||||||
|
|
||||||
// 表格列
|
// 表格列
|
||||||
const columns = [
|
const columns = [
|
||||||
{ title: '序号', dataIndex: 'serialNumber', key: 'serialNumber', align: 'center', width: 80 },
|
{ title: '订单号', dataIndex: 'orderNum', key: 'orderNum', align: 'center', width: 80 },
|
||||||
{ title: '姓名', dataIndex: 'name', key: 'name', align: 'center', width: 100 },
|
{ title: '服务对象姓名', dataIndex: 'customerName', key: 'customerName', align: 'center', width: 100 },
|
||||||
{ title: '性别', dataIndex: 'gender', key: 'gender', align: 'center', width: 80 },
|
{ title: '电话', dataIndex: 'contact1', key: 'contact1', align: 'center', width: 120 },
|
||||||
{ title: '电话', dataIndex: 'phone', key: 'phone', align: 'center', width: 120 },
|
{ title: '电话1', dataIndex: 'otherPhone1', key: 'otherPhone1', align: 'center', width: 120 },
|
||||||
{ title: '身份证号', dataIndex: 'idCard', key: 'idCard', align: 'center', width: 180 },
|
{ title: '电话2', dataIndex: 'otherPhone2', key: 'otherPhone2', align: 'center', width: 120 },
|
||||||
{ title: '护理人员类型', dataIndex: 'serviceType', key: 'serviceType', align: 'center', width: 120 },
|
{ title: '身份证号', dataIndex: 'customerIdCard', key: 'customerIdCard', align: 'center', width: 240 },
|
||||||
{ title: '用工形式', dataIndex: 'workType', key: 'workType', align: 'center', width: 120 },
|
{ title: '地址', dataIndex: 'detailAddress', key: 'detailAddress', align: 'center', width: 240 },
|
||||||
{ title: '状态', dataIndex: 'status', key: 'status', align: 'center', width: 100 },
|
{ title: '服务人员姓名', dataIndex: 'serviceName', key: 'serviceName', align: 'center', width: 120 },
|
||||||
{ title: '所属服务组织', dataIndex: 'stationName', key: 'stationName', align: 'center', width: 150 },
|
{ title: '服务项目名称', dataIndex: 'workType', key: 'workType', align: 'center', width: 120 },
|
||||||
{ title: '操作', key: 'action', width: 240, fixed: 'right', align: 'center' }
|
{ 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 {
|
const {
|
||||||
listData,
|
listData,
|
||||||
@ -227,44 +236,25 @@ const detailRef = ref()
|
|||||||
const advancedSearchVisible = ref([]) // 高级查询默认收起
|
const advancedSearchVisible = ref([]) // 高级查询默认收起
|
||||||
// 回访弹框引用
|
// 回访弹框引用
|
||||||
const visitDialogRef = ref()
|
const visitDialogRef = ref()
|
||||||
|
// 计算所有列宽度总和
|
||||||
|
const totalWidth = columns.reduce((sum, col) => sum + (col.width || 100), 0);
|
||||||
|
|
||||||
// 获取列表(mock 数据)
|
// 获取列表(mock 数据)
|
||||||
async function getPageList() {
|
async function getPageList() {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
// ========== 临时 mock 数据 ==========
|
const { pageSize, current } = paginationState
|
||||||
const mockData = [
|
const params = {
|
||||||
{
|
pageSize,
|
||||||
serialNumber: 1,
|
current,
|
||||||
name: '张三',
|
...searchFormData.value,
|
||||||
gender: '男',
|
|
||||||
phone: '13800138000',
|
|
||||||
idCard: '110101199003077890',
|
|
||||||
serviceType: '全职护理员',
|
|
||||||
workType: '劳动合同',
|
|
||||||
status: '在职',
|
|
||||||
stationName: '朝阳区居家养老服务中心',
|
|
||||||
}
|
}
|
||||||
]
|
if (Array.isArray(params.plannedDate) && params.plannedDate.length === 0) {
|
||||||
listData.value = mockData
|
delete params.plannedDate
|
||||||
paginationState.total = 1
|
}
|
||||||
// ==================================
|
const { success, data, total } = await apis.workOrder.getBackWorkOrderList(params)
|
||||||
|
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.serviceStaffList.getProjectList(params)
|
|
||||||
// if (config('http.code.success') === success) {
|
|
||||||
// listData.value = data
|
|
||||||
// paginationState.total = total
|
|
||||||
// }
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取列表失败:', error)
|
console.error('获取列表失败:', error)
|
||||||
message.error('加载数据失败')
|
message.error('加载数据失败')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user