提交已修改的代码

This commit is contained in:
zlwu committed 2025-06-30 04:25:12 +08:00
1 parent 65d2d71469
commit 60cb1b09f8
32 files changed
+10359 -4786

No files matched your search

+9 -2
View File
@@ -11,11 +11,18 @@ const clientId = import.meta.env.VITE_APP_CLIENT_ID;
* @returns
*/
export function login(data: LoginData): AxiosPromise<LoginResult> {
// 构建完全不包含验证码字段的登录参数
const params = {
...data,
clientId: data.clientId || clientId,
tenantId: data.tenantId,
username: data.username,
password: data.password,
clientId: data.clientId || clientId || 'e5cd7e4891bf95d1d19206ce24a7b32e',
grantType: data.grantType || 'password'
};
// 调试:打印登录参数(生产环境应移除)
console.log('登录请求参数:', params);
return request({
url: '/auth/login',
headers: {
+12
View File
@@ -0,0 +1,12 @@
/**
* 物业报修模块 API 接口入口
*/
// 报修工单相关接口
export * from './repairOrder';
// 维修类型相关接口
export * from './repairCategory';
// 类型定义
export * from './types';
+513
View File
@@ -0,0 +1,513 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { RepairCategoryVO, RepairCategoryForm, RepairCategoryQuery } from '@/api/pm/types';
/**
* 查询维修类型列表
* @param query 查询参数
*/
export const listRepairCategory = (query?: RepairCategoryQuery): AxiosPromise<RepairCategoryVO[]> => {
return new Promise((resolve) => {
setTimeout(() => {
const mockData = {
code: 200,
msg: '操作成功',
data: [
{
id: '1',
categoryName: '电路维修',
categoryCode: 'ELECTRIC',
categoryDescription: '电路故障、插座开关维修等',
parentId: '0',
ancestorIds: '0',
levelDepth: 1,
childrenCount: 3,
requiredSkills: '电工基础知识、安全操作规范',
skillLevel: '2',
estimatedDuration: 60,
standardCost: 50.00,
iconUrl: '/icons/electric.svg',
colorCode: '#FFB020',
sortOrder: 1,
status: '1',
usageCount: 45,
lastUsedTime: '2025-01-22 15:30:00',
remark: null,
createTime: '2024-12-01 10:00:00',
children: [
{
id: '11',
categoryName: '照明设备',
categoryCode: 'ELECTRIC_LIGHT',
categoryDescription: '灯具、照明线路维修',
parentId: '1',
ancestorIds: '0,1',
levelDepth: 2,
childrenCount: 0,
requiredSkills: '电工基础、照明设备知识',
skillLevel: '1',
estimatedDuration: 30,
standardCost: 30.00,
iconUrl: '/icons/light.svg',
colorCode: '#FFB020',
sortOrder: 1,
status: '1',
usageCount: 18,
lastUsedTime: '2025-01-22 09:15:00',
remark: null,
createTime: '2024-12-01 10:30:00'
},
{
id: '12',
categoryName: '插座开关',
categoryCode: 'ELECTRIC_SOCKET',
categoryDescription: '插座、开关面板维修更换',
parentId: '1',
ancestorIds: '0,1',
levelDepth: 2,
childrenCount: 0,
requiredSkills: '电工基础、安全操作',
skillLevel: '1',
estimatedDuration: 20,
standardCost: 25.00,
iconUrl: '/icons/socket.svg',
colorCode: '#FFB020',
sortOrder: 2,
status: '1',
usageCount: 15,
lastUsedTime: '2025-01-21 14:20:00',
remark: null,
createTime: '2024-12-01 10:45:00'
},
{
id: '13',
categoryName: '配电设备',
categoryCode: 'ELECTRIC_POWER',
categoryDescription: '配电箱、电表等设备维修',
parentId: '1',
ancestorIds: '0,1',
levelDepth: 2,
childrenCount: 0,
requiredSkills: '高级电工、配电知识',
skillLevel: '3',
estimatedDuration: 120,
standardCost: 80.00,
iconUrl: '/icons/power.svg',
colorCode: '#FFB020',
sortOrder: 3,
status: '1',
usageCount: 12,
lastUsedTime: '2025-01-20 16:45:00',
remark: null,
createTime: '2024-12-01 11:00:00'
}
]
},
{
id: '2',
categoryName: '水暖维修',
categoryCode: 'PLUMBING',
categoryDescription: '管道、水龙头、暖气等维修',
parentId: '0',
ancestorIds: '0',
levelDepth: 1,
childrenCount: 3,
requiredSkills: '管工基础知识、焊接技能',
skillLevel: '2',
estimatedDuration: 90,
standardCost: 60.00,
iconUrl: '/icons/plumbing.svg',
colorCode: '#4FC3F7',
sortOrder: 2,
status: '1',
usageCount: 38,
lastUsedTime: '2025-01-23 10:30:00',
remark: null,
createTime: '2024-12-01 10:15:00',
children: [
{
id: '21',
categoryName: '给水设备',
categoryCode: 'PLUMBING_WATER',
categoryDescription: '水龙头、阀门、管道维修',
parentId: '2',
ancestorIds: '0,2',
levelDepth: 2,
childrenCount: 0,
requiredSkills: '管工基础、维修工具使用',
skillLevel: '2',
estimatedDuration: 60,
standardCost: 40.00,
iconUrl: '/icons/water.svg',
colorCode: '#4FC3F7',
sortOrder: 1,
status: '1',
usageCount: 22,
lastUsedTime: '2025-01-23 10:30:00',
remark: null,
createTime: '2024-12-01 10:30:00'
},
{
id: '22',
categoryName: '排水设备',
categoryCode: 'PLUMBING_DRAIN',
categoryDescription: '下水道、地漏疏通维修',
parentId: '2',
ancestorIds: '0,2',
levelDepth: 2,
childrenCount: 0,
requiredSkills: '管道疏通、清洁设备使用',
skillLevel: '1',
estimatedDuration: 45,
standardCost: 35.00,
iconUrl: '/icons/drain.svg',
colorCode: '#4FC3F7',
sortOrder: 2,
status: '1',
usageCount: 10,
lastUsedTime: '2025-01-22 08:45:00',
remark: null,
createTime: '2024-12-01 10:45:00'
},
{
id: '23',
categoryName: '供暖设备',
categoryCode: 'PLUMBING_HEATING',
categoryDescription: '暖气片、供暖管道维修',
parentId: '2',
ancestorIds: '0,2',
levelDepth: 2,
childrenCount: 0,
requiredSkills: '供暖系统知识、焊接技能',
skillLevel: '3',
estimatedDuration: 150,
standardCost: 100.00,
iconUrl: '/icons/heating.svg',
colorCode: '#4FC3F7',
sortOrder: 3,
status: '1',
usageCount: 6,
lastUsedTime: '2025-01-18 13:20:00',
remark: null,
createTime: '2024-12-01 11:00:00'
}
]
},
{
id: '3',
categoryName: '土建维修',
categoryCode: 'CONSTRUCTION',
categoryDescription: '墙面、地面、门窗等土建维修',
parentId: '0',
ancestorIds: '0',
levelDepth: 1,
childrenCount: 2,
requiredSkills: '泥工、油漆工基础技能',
skillLevel: '2',
estimatedDuration: 180,
standardCost: 80.00,
iconUrl: '/icons/construction.svg',
colorCode: '#8BC34A',
sortOrder: 3,
status: '1',
usageCount: 28,
lastUsedTime: '2025-01-21 11:15:00',
remark: null,
createTime: '2024-12-01 10:30:00',
children: [
{
id: '31',
categoryName: '墙面修缮',
categoryCode: 'CONSTRUCTION_WALL',
categoryDescription: '墙面粉刷、裂缝修补',
parentId: '3',
ancestorIds: '0,3',
levelDepth: 2,
childrenCount: 0,
requiredSkills: '油漆工、简单泥工技能',
skillLevel: '2',
estimatedDuration: 120,
standardCost: 60.00,
iconUrl: '/icons/wall.svg',
colorCode: '#8BC34A',
sortOrder: 1,
status: '1',
usageCount: 16,
lastUsedTime: '2025-01-21 11:15:00',
remark: null,
createTime: '2024-12-01 11:15:00'
},
{
id: '32',
categoryName: '门窗维修',
categoryCode: 'CONSTRUCTION_DOOR',
categoryDescription: '门窗锁具、玻璃更换维修',
parentId: '3',
ancestorIds: '0,3',
levelDepth: 2,
childrenCount: 0,
requiredSkills: '木工基础、五金安装',
skillLevel: '2',
estimatedDuration: 90,
standardCost: 45.00,
iconUrl: '/icons/door.svg',
colorCode: '#8BC34A',
sortOrder: 2,
status: '1',
usageCount: 12,
lastUsedTime: '2025-01-19 15:30:00',
remark: null,
createTime: '2024-12-01 11:30:00'
}
]
},
{
id: '4',
categoryName: '设备维修',
categoryCode: 'EQUIPMENT',
categoryDescription: '各类设备故障维修',
parentId: '0',
ancestorIds: '0',
levelDepth: 1,
childrenCount: 2,
requiredSkills: '机电维修、设备操作',
skillLevel: '3',
estimatedDuration: 120,
standardCost: 100.00,
iconUrl: '/icons/equipment.svg',
colorCode: '#FF7043',
sortOrder: 4,
status: '1',
usageCount: 32,
lastUsedTime: '2025-01-23 09:15:00',
remark: null,
createTime: '2024-12-01 10:45:00',
children: [
{
id: '41',
categoryName: '空调设备',
categoryCode: 'EQUIPMENT_AC',
categoryDescription: '空调安装、维修、清洗',
parentId: '4',
ancestorIds: '0,4',
levelDepth: 2,
childrenCount: 0,
requiredSkills: '制冷设备维修、安全操作',
skillLevel: '3',
estimatedDuration: 150,
standardCost: 120.00,
iconUrl: '/icons/ac.svg',
colorCode: '#FF7043',
sortOrder: 1,
status: '1',
usageCount: 20,
lastUsedTime: '2025-01-22 17:30:00',
remark: null,
createTime: '2024-12-01 11:45:00'
},
{
id: '42',
categoryName: '教学设备',
categoryCode: 'EQUIPMENT_TEACHING',
categoryDescription: '投影仪、音响、电脑等设备维修',
parentId: '4',
ancestorIds: '0,4',
levelDepth: 2,
childrenCount: 0,
requiredSkills: '电子设备维修、计算机知识',
skillLevel: '3',
estimatedDuration: 90,
standardCost: 80.00,
iconUrl: '/icons/teaching.svg',
colorCode: '#FF7043',
sortOrder: 2,
status: '1',
usageCount: 12,
lastUsedTime: '2025-01-23 09:15:00',
remark: null,
createTime: '2024-12-01 12:00:00'
}
]
},
{
id: '5',
categoryName: '园林维修',
categoryCode: 'GARDEN',
categoryDescription: '绿化养护、园林设施维修',
parentId: '0',
ancestorIds: '0',
levelDepth: 1,
childrenCount: 0,
requiredSkills: '园艺知识、植物养护',
skillLevel: '1',
estimatedDuration: 240,
standardCost: 40.00,
iconUrl: '/icons/garden.svg',
colorCode: '#66BB6A',
sortOrder: 5,
status: '1',
usageCount: 8,
lastUsedTime: '2025-01-15 14:20:00',
remark: null,
createTime: '2024-12-01 11:00:00'
},
{
id: '6',
categoryName: '清洁维护',
categoryCode: 'CLEANING',
categoryDescription: '清洁卫生、环境维护',
parentId: '0',
ancestorIds: '0',
levelDepth: 1,
childrenCount: 0,
requiredSkills: '清洁知识、环保意识',
skillLevel: '1',
estimatedDuration: 120,
standardCost: 30.00,
iconUrl: '/icons/cleaning.svg',
colorCode: '#42A5F5',
sortOrder: 6,
status: '1',
usageCount: 5,
lastUsedTime: '2025-01-16 10:45:00',
remark: null,
createTime: '2024-12-01 11:15:00'
}
]
};
resolve(mockData as any);
}, 300);
});
};
/**
* 查询维修类型详细信息
* @param id 类型ID
*/
export const getRepairCategory = (id: string | number): AxiosPromise<RepairCategoryVO> => {
return new Promise((resolve) => {
setTimeout(() => {
const mockData = {
code: 200,
msg: '操作成功',
data: {
id: id,
categoryName: '电路维修',
categoryCode: 'ELECTRIC',
categoryDescription: '电路故障、插座开关维修等',
parentId: '0',
ancestorIds: '0',
levelDepth: 1,
childrenCount: 3,
requiredSkills: '电工基础知识、安全操作规范',
skillLevel: '2',
estimatedDuration: 60,
standardCost: 50.00,
iconUrl: '/icons/electric.svg',
colorCode: '#FFB020',
sortOrder: 1,
status: '1',
usageCount: 45,
lastUsedTime: '2025-01-22 15:30:00',
remark: null,
createTime: '2024-12-01 10:00:00'
}
};
resolve(mockData as any);
}, 200);
});
};
/**
* 新增维修类型
* @param data 类型数据
*/
export const addRepairCategory = (data: RepairCategoryForm) => {
return new Promise((resolve) => {
setTimeout(() => {
const mockData = {
code: 200,
msg: '新增成功',
data: {
id: Date.now(),
categoryCode: data.categoryCode
}
};
resolve(mockData);
}, 600);
});
};
/**
* 修改维修类型
* @param data 类型数据
*/
export const updateRepairCategory = (data: RepairCategoryForm) => {
return new Promise((resolve) => {
setTimeout(() => {
const mockData = {
code: 200,
msg: '修改成功',
data: null
};
resolve(mockData);
}, 500);
});
};
/**
* 删除维修类型
* @param id 类型ID
*/
export const delRepairCategory = (id: string | number | Array<string | number>) => {
return new Promise((resolve) => {
setTimeout(() => {
const mockData = {
code: 200,
msg: '删除成功',
data: null
};
resolve(mockData);
}, 400);
});
};
/**
* 获取维修类型树形结构
*/
export const getRepairCategoryTree = (): AxiosPromise<RepairCategoryVO[]> => {
return listRepairCategory();
};
/**
* 获取维修类型下拉选项
*/
export const getRepairCategoryOptions = (): AxiosPromise<Array<{value: string | number, label: string}>> => {
return new Promise((resolve) => {
setTimeout(() => {
const mockData = {
code: 200,
msg: '操作成功',
data: [
{ value: '1', label: '电路维修' },
{ value: '11', label: '- 照明设备' },
{ value: '12', label: '- 插座开关' },
{ value: '13', label: '- 配电设备' },
{ value: '2', label: '水暖维修' },
{ value: '21', label: '- 给水设备' },
{ value: '22', label: '- 排水设备' },
{ value: '23', label: '- 供暖设备' },
{ value: '3', label: '土建维修' },
{ value: '31', label: '- 墙面修缮' },
{ value: '32', label: '- 门窗维修' },
{ value: '4', label: '设备维修' },
{ value: '41', label: '- 空调设备' },
{ value: '42', label: '- 教学设备' },
{ value: '5', label: '园林维修' },
{ value: '6', label: '清洁维护' }
]
};
resolve(mockData as any);
}, 200);
});
};
+650
View File
@@ -0,0 +1,650 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import {
RepairOrderVO,
RepairOrderForm,
RepairOrderQuery,
RepairAttachmentVO,
RepairProgressVO,
AssignOrderForm,
ProgressUpdateForm,
RepairStatisticsVO
} from '@/api/pm/types';
/**
* 查询报修工单列表
* @param query 查询参数
*/
// 生成模拟数据的函数
const generateMockData = () => {
const baseData = [
{
id: '1',
tenantId: '000000',
orderNo: 'RO20250123001',
title: '宿舍A304水龙头漏水',
description: '水龙头一直滴水,影响正常使用,需要及时维修',
repairLocation: '学生宿舍A栋304室',
categoryId: '2',
categoryName: '水暖维修',
priorityLevel: 2,
expectedFinishTime: '2025-01-24 18:00:00',
reporterId: '1001',
reporterName: '张小明',
reporterPhone: '13800138001',
reporterDept: '计算机学院',
orderStatus: '1',
assignTime: null,
assigneeId: null,
assigneeName: null,
assignRemark: null,
startTime: null,
finishTime: null,
totalDuration: null,
repairResult: null,
usedMaterials: null,
followSuggestions: null,
evaluationScore: null,
evaluationTime: null,
attachmentCount: 2,
progressCount: 1,
cancelReason: null,
remark: null,
createTime: '2025-01-23 10:30:00',
updateTime: '2025-01-23 10:30:00'
},
{
id: '2',
tenantId: '000000',
orderNo: 'RO20250123002',
title: '教学楼B201投影仪故障',
description: '投影仪无法正常开机,影响教学活动',
repairLocation: '教学楼B栋201教室',
categoryId: '4',
categoryName: '设备维修',
priorityLevel: 1,
expectedFinishTime: '2025-01-23 16:00:00',
reporterId: '1002',
reporterName: '李老师',
reporterPhone: '13800138002',
reporterDept: '电子工程学院',
orderStatus: '2',
assignTime: '2025-01-23 11:00:00',
assigneeId: '2001',
assigneeName: '王师傅',
assignRemark: '紧急处理,明天有重要课程',
startTime: null,
finishTime: null,
totalDuration: null,
repairResult: null,
usedMaterials: null,
followSuggestions: null,
evaluationScore: null,
evaluationTime: null,
attachmentCount: 1,
progressCount: 2,
cancelReason: null,
remark: null,
createTime: '2025-01-23 09:15:00',
updateTime: '2025-01-23 11:00:00'
},
{
id: '3',
tenantId: '000000',
orderNo: 'RO20250122003',
title: '图书馆空调不制热',
description: '阅览室空调无法制热,温度较低影响学习',
repairLocation: '图书馆一楼阅览室',
categoryId: '4',
categoryName: '设备维修',
priorityLevel: 3,
expectedFinishTime: '2025-01-24 12:00:00',
reporterId: '1003',
reporterName: '赵管理员',
reporterPhone: '13800138003',
reporterDept: '图书馆',
orderStatus: '4',
assignTime: '2025-01-22 14:30:00',
assigneeId: '2002',
assigneeName: '刘师傅',
assignRemark: '检查空调系统',
startTime: '2025-01-22 15:00:00',
finishTime: '2025-01-22 17:30:00',
totalDuration: 150,
repairResult: '空调滤网堵塞,已清洗并更换新滤网,制热功能恢复正常',
usedMaterials: '空调滤网 x1',
followSuggestions: '建议每季度清洗一次滤网',
evaluationScore: null,
evaluationTime: null,
attachmentCount: 3,
progressCount: 5,
cancelReason: null,
remark: null,
createTime: '2025-01-22 13:45:00',
updateTime: '2025-01-22 17:30:00'
}
];
// 模拟数据生成器参数
const categories = [
{ id: '1', name: '电路维修' },
{ id: '2', name: '水暖维修' },
{ id: '3', name: '土建维修' },
{ id: '4', name: '设备维修' },
{ id: '5', name: '园林维修' },
{ id: '6', name: '清洁维护' }
];
const locations = [
'学生宿舍A栋', '学生宿舍B栋', '学生宿舍C栋', '教学楼A栋', '教学楼B栋', '教学楼C栋',
'图书馆', '实验楼', '行政楼', '食堂', '体育馆', '医务室', '校园广场', '停车场',
'学术报告厅', '会议室', '办公楼', '研究生楼', '国际交流中心', '创新创业中心'
];
const reporters = [
{ name: '张三', phone: '13800138001', dept: '计算机学院' },
{ name: '李四', phone: '13800138002', dept: '电子工程学院' },
{ name: '王五', phone: '13800138003', dept: '机械工程学院' },
{ name: '赵六', phone: '13800138004', dept: '化学工程学院' },
{ name: '钱七', phone: '13800138005', dept: '材料科学学院' },
{ name: '孙八', phone: '13800138006', dept: '环境工程学院' },
{ name: '周九', phone: '13800138007', dept: '生物工程学院' },
{ name: '吴十', phone: '13800138008', dept: '数学学院' },
{ name: '郑管理员', phone: '13800138009', dept: '后勤管理处' },
{ name: '王老师', phone: '13800138010', dept: '物理学院' }
];
const assignees = [
{ id: '2001', name: '王师傅' },
{ id: '2002', name: '刘师傅' },
{ id: '2003', name: '张师傅' },
{ id: '2004', name: '李师傅' }
];
const titles = [
'水龙头漏水', '灯泡不亮', '门锁损坏', '窗户关不严', '空调不制冷', '投影仪故障',
'网络故障', '桌椅损坏', '黑板擦不干净', '卫生间堵塞', '暖气不热', '电梯故障',
'监控设备故障', '音响设备异常', '打印机故障', '饮水机不工作', '垃圾桶损坏',
'路灯不亮', '草坪需修剪', '花坛清理', '墙面脱落', '地板破损', '天花板漏水'
];
// 生成100条新数据
const additionalData = [];
for (let i = 4; i <= 103; i++) {
const category = categories[Math.floor(Math.random() * categories.length)];
const location = locations[Math.floor(Math.random() * locations.length)];
const reporter = reporters[Math.floor(Math.random() * reporters.length)];
const title = titles[Math.floor(Math.random() * titles.length)];
const priorityLevel = Math.floor(Math.random() * 5) + 1;
const status = ['1', '2', '3', '4', '5', '6', '9'][Math.floor(Math.random() * 7)];
// 根据状态生成相应的时间和其他字段
const createTime = new Date(2025, 0, Math.floor(Math.random() * 23) + 1, Math.floor(Math.random() * 24), Math.floor(Math.random() * 60));
const assignTime = status !== '1' ? new Date(createTime.getTime() + Math.random() * 24 * 60 * 60 * 1000) : null;
const startTime = ['3', '4', '5', '6'].includes(status) ? new Date(assignTime!.getTime() + Math.random() * 4 * 60 * 60 * 1000) : null;
const finishTime = ['4', '5', '6'].includes(status) ? new Date(startTime!.getTime() + Math.random() * 8 * 60 * 60 * 1000) : null;
const assignee = status !== '1' ? assignees[Math.floor(Math.random() * assignees.length)] : null;
const roomNumber = Math.floor(Math.random() * 500) + 100;
const fullLocation = `${location}${roomNumber}室`;
additionalData.push({
id: i.toString(),
tenantId: '000000',
orderNo: `RO${createTime.getFullYear()}${String(createTime.getMonth() + 1).padStart(2, '0')}${String(createTime.getDate()).padStart(2, '0')}${String(i).padStart(3, '0')}`,
title: `${fullLocation}${title}`,
description: `${fullLocation}发生${title}问题,需要及时处理。${Math.random() > 0.5 ? '影响正常使用。' : '请尽快安排维修。'}`,
repairLocation: fullLocation,
categoryId: category.id,
categoryName: category.name,
priorityLevel,
expectedFinishTime: new Date(createTime.getTime() + Math.random() * 7 * 24 * 60 * 60 * 1000).toISOString().slice(0, 19).replace('T', ' '),
reporterId: (1000 + (i % 50)).toString(),
reporterName: reporter.name,
reporterPhone: reporter.phone,
reporterDept: reporter.dept,
orderStatus: status,
assignTime: assignTime?.toISOString().slice(0, 19).replace('T', ' ') || null,
assigneeId: assignee?.id || null,
assigneeName: assignee?.name || null,
assignRemark: status !== '1' ? (Math.random() > 0.5 ? '请及时处理' : '优先处理此工单') : null,
startTime: startTime?.toISOString().slice(0, 19).replace('T', ' ') || null,
finishTime: finishTime?.toISOString().slice(0, 19).replace('T', ' ') || null,
totalDuration: finishTime && startTime ? Math.floor((finishTime.getTime() - startTime.getTime()) / 60000) : null,
repairResult: ['4', '5', '6'].includes(status) ? `已完成${title}维修,功能恢复正常` : null,
usedMaterials: ['4', '5', '6'].includes(status) && Math.random() > 0.5 ? '维修材料若干' : null,
followSuggestions: ['4', '5', '6'].includes(status) && Math.random() > 0.7 ? '建议定期检查维护' : null,
evaluationScore: status === '5' ? Math.round((Math.random() * 2 + 3) * 10) / 10 : null,
evaluationTime: status === '5' ? new Date(finishTime!.getTime() + Math.random() * 24 * 60 * 60 * 1000).toISOString().slice(0, 19).replace('T', ' ') : null,
attachmentCount: Math.floor(Math.random() * 4),
progressCount: status === '1' ? 1 : Math.floor(Math.random() * 5) + 1,
cancelReason: status === '9' ? '用户取消申请' : null,
remark: Math.random() > 0.8 ? '备注信息' : null,
createTime: createTime.toISOString().slice(0, 19).replace('T', ' '),
updateTime: (finishTime || assignTime || createTime).toISOString().slice(0, 19).replace('T', ' ')
});
}
return [...baseData, ...additionalData];
};
export const listRepairOrder = (query?: RepairOrderQuery): AxiosPromise<RepairOrderVO[]> => {
// 暂时返回模拟数据
return new Promise((resolve) => {
setTimeout(() => {
const allData = generateMockData();
// 应用查询过滤
let filteredData = allData;
if (query?.orderNo) {
filteredData = filteredData.filter(item => item.orderNo.includes(query.orderNo!));
}
if (query?.title) {
filteredData = filteredData.filter(item => item.title.includes(query.title!));
}
if (query?.orderStatus) {
filteredData = filteredData.filter(item => item.orderStatus === query.orderStatus);
}
if (query?.priorityLevel) {
filteredData = filteredData.filter(item => item.priorityLevel === query.priorityLevel);
}
if (query?.reporterName) {
filteredData = filteredData.filter(item => item.reporterName.includes(query.reporterName!));
}
if (query?.assigneeName) {
filteredData = filteredData.filter(item => item.assigneeName?.includes(query.assigneeName!));
}
if (query?.categoryId) {
filteredData = filteredData.filter(item => item.categoryId === query.categoryId);
}
// 分页处理
const pageNum = query?.pageNum || 1;
const pageSize = query?.pageSize || 10;
const startIndex = (pageNum - 1) * pageSize;
const endIndex = startIndex + pageSize;
const pageData = filteredData.slice(startIndex, endIndex);
const mockData = {
code: 200,
msg: '操作成功',
data: pageData,
total: filteredData.length
};
resolve(mockData as any);
}, 500);
});
};
/**
* 查询报修工单详细信息
* @param id 工单ID
*/
export const getRepairOrder = (id: string | number): AxiosPromise<RepairOrderVO> => {
return new Promise((resolve) => {
setTimeout(() => {
const mockData = {
code: 200,
msg: '操作成功',
data: {
id: id,
tenantId: '000000',
orderNo: 'RO20250123001',
title: '宿舍A304水龙头漏水',
description: '水龙头一直滴水,影响正常使用,需要及时维修',
repairLocation: '学生宿舍A栋304室',
categoryId: '2',
categoryName: '水暖维修',
priorityLevel: 2,
expectedFinishTime: '2025-01-24 18:00:00',
reporterId: '1001',
reporterName: '张小明',
reporterPhone: '13800138001',
reporterDept: '计算机学院',
orderStatus: '1',
assignTime: null,
assigneeId: null,
assigneeName: null,
assignRemark: null,
startTime: null,
finishTime: null,
totalDuration: null,
repairResult: null,
usedMaterials: null,
followSuggestions: null,
evaluationScore: null,
evaluationTime: null,
attachmentCount: 2,
progressCount: 1,
cancelReason: null,
remark: null,
createTime: '2025-01-23 10:30:00',
updateTime: '2025-01-23 10:30:00'
}
};
resolve(mockData as any);
}, 300);
});
};
/**
* 新增报修工单
* @param data 工单数据
*/
export const addRepairOrder = (data: RepairOrderForm) => {
return new Promise((resolve) => {
setTimeout(() => {
const mockData = {
code: 200,
msg: '报修申请提交成功',
data: {
id: Date.now(),
orderNo: `RO${new Date().toISOString().slice(0, 10).replace(/-/g, '')}${String(Date.now()).slice(-3)}`
}
};
resolve(mockData);
}, 800);
});
};
/**
* 修改报修工单
* @param data 工单数据
*/
export const updateRepairOrder = (data: RepairOrderForm) => {
return new Promise((resolve) => {
setTimeout(() => {
const mockData = {
code: 200,
msg: '修改成功',
data: null
};
resolve(mockData);
}, 600);
});
};
/**
* 删除报修工单
* @param id 工单ID
*/
export const delRepairOrder = (id: string | number | Array<string | number>) => {
return new Promise((resolve) => {
setTimeout(() => {
const mockData = {
code: 200,
msg: '删除成功',
data: null
};
resolve(mockData);
}, 500);
});
};
/**
* 分派工单
* @param data 分派数据
*/
export const assignRepairOrder = (data: AssignOrderForm) => {
return new Promise((resolve) => {
setTimeout(() => {
const mockData = {
code: 200,
msg: '工单分派成功',
data: null
};
resolve(mockData);
}, 700);
});
};
/**
* 接收工单
* @param orderId 工单ID
*/
export const acceptRepairOrder = (orderId: string | number) => {
return new Promise((resolve) => {
setTimeout(() => {
const mockData = {
code: 200,
msg: '工单接收成功',
data: null
};
resolve(mockData);
}, 500);
});
};
/**
* 拒绝工单
* @param orderId 工单ID
* @param reason 拒绝原因
*/
export const rejectRepairOrder = (orderId: string | number, reason: string) => {
return new Promise((resolve) => {
setTimeout(() => {
const mockData = {
code: 200,
msg: '工单拒绝成功',
data: null
};
resolve(mockData);
}, 500);
});
};
/**
* 更新维修进度
* @param data 进度数据
*/
export const updateRepairProgress = (data: ProgressUpdateForm) => {
return new Promise((resolve) => {
setTimeout(() => {
const mockData = {
code: 200,
msg: '进度更新成功',
data: null
};
resolve(mockData);
}, 600);
});
};
/**
* 完成工单
* @param orderId 工单ID
* @param data 完成数据
*/
export const completeRepairOrder = (orderId: string | number, data: any) => {
return new Promise((resolve) => {
setTimeout(() => {
const mockData = {
code: 200,
msg: '工单完成成功',
data: null
};
resolve(mockData);
}, 700);
});
};
/**
* 取消工单
* @param orderId 工单ID
* @param reason 取消原因
*/
export const cancelRepairOrder = (orderId: string | number, reason: string) => {
return new Promise((resolve) => {
setTimeout(() => {
const mockData = {
code: 200,
msg: '工单取消成功',
data: null
};
resolve(mockData);
}, 500);
});
};
/**
* 获取工单附件列表
* @param orderId 工单ID
*/
export const getRepairAttachments = (orderId: string | number): AxiosPromise<RepairAttachmentVO[]> => {
return new Promise((resolve) => {
setTimeout(() => {
const mockData = {
code: 200,
msg: '操作成功',
data: [
{
id: '1',
orderId: orderId,
fileName: '水龙头漏水现场图1.jpg',
filePath: '/uploads/repair/images/2025/01/23/leak1.jpg',
fileSize: 245678,
fileType: 'image',
fileExtension: 'jpg',
fileMimeType: 'image/jpeg',
uploadStage: '1',
uploaderId: '1001',
uploaderName: '张小明',
thumbnailPath: '/uploads/repair/thumbs/2025/01/23/leak1_thumb.jpg',
duration: null,
resolution: '1920x1080',
description: '水龙头漏水现场照片',
sortOrder: 1,
createTime: '2025-01-23 10:30:00'
},
{
id: '2',
orderId: orderId,
fileName: '水龙头漏水视频.mp4',
filePath: '/uploads/repair/videos/2025/01/23/leak_video.mp4',
fileSize: 5234567,
fileType: 'video',
fileExtension: 'mp4',
fileMimeType: 'video/mp4',
uploadStage: '1',
uploaderId: '1001',
uploaderName: '张小明',
thumbnailPath: '/uploads/repair/thumbs/2025/01/23/leak_video_thumb.jpg',
duration: 15,
resolution: '1920x1080',
description: '漏水情况视频记录',
sortOrder: 2,
createTime: '2025-01-23 10:32:00'
}
]
};
resolve(mockData as any);
}, 300);
});
};
/**
* 获取工单进度列表
* @param orderId 工单ID
*/
export const getRepairProgress = (orderId: string | number): AxiosPromise<RepairProgressVO[]> => {
return new Promise((resolve) => {
setTimeout(() => {
const mockData = {
code: 200,
msg: '操作成功',
data: [
{
id: '1',
orderId: orderId,
progressType: '1',
progressStatus: '工单已创建',
progressDetail: '用户提交报修申请,工单已生成,等待管理员分派',
operatorId: '1001',
operatorName: '张小明',
operatorRole: 'user',
locationInfo: '学生宿舍A栋304室',
gpsLatitude: 31.230416,
gpsLongitude: 121.473701,
operationTime: '2025-01-23 10:30:00',
estimatedDuration: null,
attachmentIds: '1,2',
nextStep: '等待管理员分派维修员',
issuesEncountered: null,
materialsNeeded: null,
remark: null,
createTime: '2025-01-23 10:30:00'
}
]
};
resolve(mockData as any);
}, 300);
});
};
/**
* 获取报修统计数据
*/
export const getRepairStatistics = (): AxiosPromise<RepairStatisticsVO> => {
return new Promise((resolve) => {
setTimeout(() => {
const mockData = {
code: 200,
msg: '操作成功',
data: {
totalOrders: 156,
pendingAssign: 8,
inProgress: 12,
completed: 132,
cancelled: 4,
avgProcessTime: 4.5,
avgEvaluationScore: 4.3,
monthlyNewOrders: 23,
monthlyCompletedOrders: 19,
statusDistribution: [
{ status: '1', count: 8, percentage: 5.1 },
{ status: '2', count: 3, percentage: 1.9 },
{ status: '3', count: 9, percentage: 5.8 },
{ status: '4', count: 2, percentage: 1.3 },
{ status: '5', count: 1, percentage: 0.6 },
{ status: '6', count: 129, percentage: 82.7 },
{ status: '9', count: 4, percentage: 2.6 }
],
categoryDistribution: [
{ categoryName: '电路维修', count: 45, percentage: 28.8 },
{ categoryName: '水暖维修', count: 38, percentage: 24.4 },
{ categoryName: '土建维修', count: 28, percentage: 17.9 },
{ categoryName: '设备维修', count: 32, percentage: 20.5 },
{ categoryName: '园林维修', count: 8, percentage: 5.1 },
{ categoryName: '清洁维护', count: 5, percentage: 3.2 }
],
priorityDistribution: [
{ priorityLevel: 1, count: 12, percentage: 7.7 },
{ priorityLevel: 2, count: 28, percentage: 17.9 },
{ priorityLevel: 3, count: 89, percentage: 57.1 },
{ priorityLevel: 4, count: 21, percentage: 13.5 },
{ priorityLevel: 5, count: 6, percentage: 3.8 }
]
}
};
resolve(mockData as any);
}, 400);
});
};
/**
* 导出工单数据
* @param query 查询参数
*/
export const exportRepairOrders = (query?: RepairOrderQuery) => {
return new Promise((resolve) => {
setTimeout(() => {
const mockData = {
code: 200,
msg: '导出成功',
data: null
};
resolve(mockData);
}, 1000);
});
};
File diff suppressed because it is too large. Load diff