feat(dms): 支持查询工单和巡检记录列表(不分页),完善生命周期数据加载

- 新增接口函数 listAllDmsBillsFaultInstance、listAllDmsBillsMaintInstance、listAllDmsRecordInspect,支持获取不分页列表
- 修改生命周期组件,根据设备code调用新增接口并动态加载真实数据
- 修正设备创建时间字段名称由 createTime 改为 createdTime,统一显示和计算逻辑
- 优化生命周期时间轴事件数据结构,完善状态映射和标签显示
- 并行请求各生命周期数据,提高加载性能和体验
- 增加对停机和维修记录的真实数据支持,增强生命周期完整性
master
zangch@mesnac.com 4 days ago
parent d3088aec39
commit 772e29ad6f

@ -8,6 +8,15 @@ export function listDmsBillsFaultInstance(query) {
params: query
})
}
// 查询检修工单列表(不分页)
export function listAllDmsBillsFaultInstance(query) {
return request({
url: '/dms/dmsBillsFaultInstance/listAll',
method: 'get',
params: query
})
}
export function getDmsPartsList(query) {
return request({
url: '/dms/dmsBillsFaultInstance/getDmsPartsList',

@ -9,6 +9,15 @@ export function listDmsBillsMaintInstance(query) {
})
}
// 查询保养工单列表(不分页)
export function listAllDmsBillsMaintInstance(query) {
return request({
url: '/dms/dmsBillsMaintInstance/listAll',
method: 'get',
params: query
})
}
// 查询保养工单详细
export function getDmsBillsMaintInstance(maintInstanceId) {
return request({

@ -9,6 +9,15 @@ export function listDmsRecordInspect(query) {
})
}
// 查询巡检记录列表(不分页)
export function listAllDmsRecordInspect(query) {
return request({
url: '/dms/dmsRecordInspect/listAll',
method: 'get',
params: query
})
}
// 查询巡检记录详细
export function getDmsRecordInspect(recordInspectId) {
return request({

@ -9,6 +9,15 @@ export function listRepairRecord(query) {
})
}
// 查询维修记录列表(不分页)
export function listAllRepairRecord(query) {
return request({
url: '/dms/repairRecord/listAll',
method: 'get',
params: query
})
}
// 查询维修记录详细
export function getRepairRecord(recordId) {
return request({

@ -9,6 +9,15 @@ export function listShutDown(query) {
})
}
// 查询停机记录列表(不分页)
export function listAllShutDown(query) {
return request({
url: '/dms/shutDown/listAll',
method: 'get',
params: query
})
}
// 查询停机记录详细
export function getShutDown(recordShutDownId) {
return request({

File diff suppressed because it is too large Load Diff

@ -116,7 +116,7 @@
</div>
<div class="meta-item">
<i class="el-icon-time"></i>
<span>建立 {{ calculateRunDays(machine.createTime) }} </span>
<span>建立 {{ calculateRunDays(machine.createdTime) }} </span>
</div>
</div>
</div>
@ -144,9 +144,9 @@
<dict-tag :options="machine_status" :value="String(scope.row.deviceStatus)" />
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" min-width="160">
<el-table-column label="创建时间" align="center" prop="createdTime" min-width="160">
<template slot-scope="scope">
<span>{{ formatDate(scope.row.createTime) }}</span>
<span>{{ formatDate(scope.row.createdTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="320" fixed="right">
@ -239,7 +239,7 @@
<div class="overview-stats">
<div class="stat">
<span class="stat-label">建立天数</span>
<span class="stat-value">{{ calculateRunDays(selectedMachine.createTime) }}</span>
<span class="stat-value">{{ calculateRunDays(selectedMachine.createdTime) }}</span>
</div>
</div>
</div>
@ -307,7 +307,7 @@
<el-descriptions-item label="设备状态">
<dict-tag :options="machine_status" :value="String(selectedMachine ? (selectedMachine.deviceStatus || '') : '')" />
</el-descriptions-item>
<el-descriptions-item label="创建时间">{{ selectedMachine ? formatDateTime(selectedMachine.createTime) : '' }}</el-descriptions-item>
<el-descriptions-item label="创建时间">{{ selectedMachine ? formatDateTime(selectedMachine.createdTime) : '' }}</el-descriptions-item>
</el-descriptions>
</el-card>
</el-col>
@ -321,6 +321,11 @@
<script>
import { listDeviceLedger } from '@/api/base/deviceLedger';
import { listAllDmsBillsMaintInstance } from '@/api/dms/dmsBillsMaintInstance';
import { listAllDmsRecordInspect } from '@/api/dms/dmsRecordInspect';
import { listAllShutDown } from '@/api/dms/shutDown';
import { listAllDmsBillsFaultInstance } from '@/api/dms/dmsBillsFaultInstance';
import { listAllRepairRecord } from '@/api/dms/repairRecord';
import pagination from '@/components/Pagination';
export default {
@ -616,25 +621,33 @@ export default {
},
async loadLifecycleTypes() {
if (!this.selectedMachine) return;
const objId = this.selectedMachine.objId;
const deviceCode = this.selectedMachine.deviceCode;
try {
// 使3
//
const [maintRes, inspectRes, shutdownRes, faultRes, repairRes] = await Promise.all([
listAllDmsBillsMaintInstance({ deviceCode }).catch(() => ({ data: [] })),
listAllDmsRecordInspect({ deviceCode }).catch(() => ({ data: [] })),
listAllShutDown({ deviceCode }).catch(() => ({ data: [] })),
listAllDmsBillsFaultInstance({ deviceCode }).catch(() => ({ data: [] })),
listAllRepairRecord({ deviceCode }).catch(() => ({ data: [] }))
]);
//
this.lifecycleTypes.forEach(type => {
switch (type.value) {
case 'maintenance':
type.count = 3; // 3
type.count = (maintRes.data || []).length;
break;
case 'inspection':
type.count = 3; // 3
type.count = (inspectRes.data || []).length;
break;
case 'downtime':
type.count = 2; // 2
type.count = (shutdownRes.data || []).length;
break;
case 'fault':
type.count = 3; // 3
type.count = (faultRes.data || []).length;
break;
case 'repair':
type.count = 3; // 3
type.count = (repairRes.data || []).length;
break;
default:
type.count = 0;
@ -652,104 +665,122 @@ export default {
const reqId = ++this.lifecycleRequestId;
this.lifecycleLoading = true;
const events = [];
const objId = this.selectedMachine.objId;
const deviceCode = this.selectedMachine.deviceCode;
try {
//
//
const promises = [];
this.selectedLifecycleTypes.forEach(type => {
switch (type) {
case 'maintenance':
// 3
for (let i = 0; i < 3; i++) {
const maintenanceTypes = ['日常保养', '定期保养', '一级保养'];
const maintenancePersons = ['张三', '李四', '王五'];
events.push({
id: `maint-${i}`,
type: 'maintenance',
title: maintenanceTypes[i],
description: `保养单号: BY-${String(202401001 + i).padStart(9, '0')} | 保养人员: ${maintenancePersons[i]} | 状态: 已完成`,
time: new Date(Date.now() - (30 - i * 10) * 24 * 60 * 60 * 1000),
iconClass: 'el-icon-setting',
color: '#4facfe',
tags: ['保养', '已完成']
});
}
promises.push(
listAllDmsBillsMaintInstance({ deviceCode }).then(res => {
(res.data || []).forEach((item, i) => {
const statusMap = { 1: '待保养', 2: '保养中', 3: '已完成' };
const statusText = statusMap[item.maintStatus] || '未知';
events.push({
id: `maint-${item.maintInstanceId || i}`,
type: 'maintenance',
title: item.maintLevelName || '设备保养',
description: `保养单号: ${item.billsMaintCode || '-'} | 保养人员: ${item.maintSupervisor || '-'} | 状态: ${statusText}`,
time: item.realEndTime || item.realBeginTime || item.planBeginTime || item.createTime,
iconClass: 'el-icon-setting',
color: '#4facfe',
tags: ['保养', statusText]
});
});
}).catch(() => {})
);
break;
case 'inspection':
// 3
for (let i = 0; i < 3; i++) {
const inspectionStatus = ['正常', '异常', '正常'];
const inspectionPersons = ['张三', '李四', '王五'];
const statusTag = inspectionStatus[i] === '正常' ? '正常' : '异常';
events.push({
id: `inspect-${i}`,
type: 'inspection',
title: '设备点检',
description: `点检单号: DJ-${String(202401001 + i).padStart(9, '0')} | 点检人: ${inspectionPersons[i]} | 结果: ${inspectionStatus[i]}`,
time: new Date(Date.now() - (25 - i * 8) * 24 * 60 * 60 * 1000),
iconClass: 'el-icon-view',
color: inspectionStatus[i] === '正常' ? '#30cfd0' : '#ff7675',
tags: ['点检', statusTag]
});
}
promises.push(
listAllDmsRecordInspect({ deviceCode }).then(res => {
(res.data || []).forEach((item, i) => {
const statusMap = { 1: '待巡检', 2: '巡检中', 3: '完成' };
const statusText = statusMap[item.inspectStatus] || '未知';
const inspectTypeText = item.inspectType === '1' ? '巡检' : '点检';
events.push({
id: `inspect-${item.recordInspectId || i}`,
type: 'inspection',
title: inspectTypeText,
description: `巡检单号: ${item.billsInspectCode || '-'} | 执行人: ${item.performer || '-'} | 状态: ${statusText}`,
time: item.realEndTime || item.realBeginTime || item.planBeginTime || item.createTime,
iconClass: 'el-icon-view',
color: statusText === '完成' ? '#30cfd0' : '#ff7675',
tags: [inspectTypeText, statusText]
});
});
}).catch(() => {})
);
break;
case 'downtime':
// 2
for (let i = 0; i < 2; i++) {
const downtimeReasons = ['计划停机-保养', '故障停机'];
const downtimeDurations = ['2小时', '4小时'];
events.push({
id: `downtime-${i}`,
type: 'downtime',
title: '设备停机',
description: `停机单号: TJ-${String(202401001 + i).padStart(9, '0')} | 原因: ${downtimeReasons[i]} | 时长: ${downtimeDurations[i]}`,
time: new Date(Date.now() - (20 - i * 8) * 24 * 60 * 60 * 1000),
iconClass: 'el-icon-warning-outline',
color: '#ffeaa7',
tags: ['停机', downtimeReasons[i].includes('计划') ? '计划' : '非计划']
});
}
promises.push(
listAllShutDown({ deviceCode }).then(res => {
(res.data || []).forEach((item, i) => {
const shutTimeText = item.shutTime ? `${item.shutTime}小时` : '-';
events.push({
id: `downtime-${item.recordShutDownId || i}`,
type: 'downtime',
title: '设备停机',
description: `原因: ${item.shutReason || '-'} | 时长: ${shutTimeText}`,
time: item.shutBeginTime || item.createTime,
iconClass: 'el-icon-warning-outline',
color: '#ffeaa7',
tags: ['停机', item.shutReason ? (item.shutReason.includes('计划') ? '计划' : '非计划') : '非计划']
});
});
}).catch(() => {})
);
break;
case 'fault':
// 3
for (let i = 0; i < 3; i++) {
const faultTypes = ['电气故障', '机械故障', '液压故障'];
const faultLevels = ['一般', '严重', '一般'];
const faultPersons = ['张三', '李四', '王五'];
events.push({
id: `fault-${i}`,
type: 'fault',
title: faultTypes[i],
description: `故障单号: GZ-${String(202401001 + i).padStart(9, '0')} | 等级: ${faultLevels[i]} | 报修人: ${faultPersons[i]} | 状态: 已处理`,
time: new Date(Date.now() - (15 - i * 5) * 24 * 60 * 60 * 1000),
iconClass: 'el-icon-circle-close',
color: '#fa709a',
tags: ['故障', faultLevels[i]]
});
}
promises.push(
listAllDmsBillsFaultInstance({ deviceCode }).then(res => {
(res.data || []).forEach((item, i) => {
const statusMap = { '0': '待维修', '1': '维修中', '2': '维修完成', '3': '待检修', '4': '检修中', '5': '检修完成' };
const statusText = statusMap[item.billsStatus] || '未知';
const faultLevelMap = { '1': '一般', '2': '紧急', '3': '严重' };
const levelText = faultLevelMap[item.faultLevel] || '一般';
events.push({
id: `fault-${item.repairInstanceId || i}`,
type: 'fault',
title: item.faultType || '设备故障',
description: `故障单号: ${item.billsFaultCode || '-'} | 等级: ${levelText} | 报修人: ${item.applyUser || '-'} | 状态: ${statusText}`,
time: item.applyTime || item.createTime,
iconClass: 'el-icon-circle-close',
color: '#fa709a',
tags: ['故障', levelText]
});
});
}).catch(() => {})
);
break;
case 'repair':
// 3
for (let i = 0; i < 3; i++) {
const repairTypes = ['预防性维修', '故障维修', '改进性维修'];
const repairStatus = ['已完成', '已完成', '进行中'];
const repairPersons = ['张三', '李四', '王五'];
events.push({
id: `repair-${i}`,
type: 'repair',
title: repairTypes[i],
description: `维修单号: WX-${String(202401001 + i).padStart(9, '0')} | 维修人: ${repairPersons[i]} | 状态: ${repairStatus[i]}`,
time: new Date(Date.now() - (12 - i * 4) * 24 * 60 * 60 * 1000),
iconClass: 'el-icon-tools',
color: '#667eea',
tags: ['维修', repairStatus[i]]
});
}
promises.push(
listAllRepairRecord({ deviceCode }).then(res => {
(res.data || []).forEach((item, i) => {
const resultMap = { '1': '成功', '2': '失败', '3': '部分完成' };
const resultText = resultMap[item.repairResult] || '未知';
events.push({
id: `repair-${item.recordId || i}`,
type: 'repair',
title: item.faultPhenomenon || '设备维修',
description: `工单编号: ${item.workOrderCode || '-'} | 维修人: ${item.repairerName || '-'} | 结果: ${resultText}`,
time: item.endTime || item.startTime || item.createTime,
iconClass: 'el-icon-tools',
color: '#667eea',
tags: ['维修', resultText]
});
});
}).catch(() => {})
);
break;
}
});
await Promise.all(promises);
if (reqId === this.lifecycleRequestId) {
this.lifecycleEvents = events.sort((a, b) => {
return new Date(b.time).getTime() - new Date(a.time).getTime();
const timeA = a.time ? new Date(a.time).getTime() : 0;
const timeB = b.time ? new Date(b.time).getTime() : 0;
return timeB - timeA;
});
this.lifecycleLoading = false;
}

Loading…
Cancel
Save