diff --git a/src/api/iot/deviceOperationOverview/index.ts b/src/api/iot/deviceOperationOverview/index.ts index 335a0006..d6b962c1 100644 --- a/src/api/iot/deviceOperationOverview/index.ts +++ b/src/api/iot/deviceOperationOverview/index.ts @@ -41,6 +41,7 @@ export interface DeviceOperationOverviewTimelineRowVO { id: string name: string utilizationRate: number + totalWarningTime?: number segments: DeviceOperationOverviewTimelineSegmentVO[] } diff --git a/src/api/mes/deviceledger/index.ts b/src/api/mes/deviceledger/index.ts index c0795e3f..f5cffd62 100644 --- a/src/api/mes/deviceledger/index.ts +++ b/src/api/mes/deviceledger/index.ts @@ -103,8 +103,12 @@ export const DeviceLedgerApi = { exportDeviceLedger: async (params) => { return await request.download({ url: `/mes/device-ledger/export-excel`, params }) }, - exportSpareBased: async (params) => { - return await request.download({ url: `/mes/device-ledger/export-spare-based`, params }) + exportDeviceLedgerSpare: async (params: { deviceLedgerId: string | number }) => { + return await request.download({ url: `/mes/device-ledger/export-spare`, params }) + }, + + getDeviceLedgerSparePage: async (params: any) => { + return await request.get({ url: `/mes/device-ledger/spare-page`, params }) }, exportMold: async (params) => { diff --git a/src/locales/en.ts b/src/locales/en.ts index 297a2c76..5a61b794 100644 --- a/src/locales/en.ts +++ b/src/locales/en.ts @@ -419,7 +419,7 @@ export default { currentStatus: 'Status', runningTime: 'Running Time (Today)', standbyTime: 'Idle Time (Today)', - alarmTime: 'Alarm Time (Today)', + alarmTime: 'Alarm Time (Hours)', efficiency: 'Activation (Today)' }, empty: 'No device operation data' @@ -5681,7 +5681,7 @@ export default { tableRunningTimeColumn: 'Running Time (Hours)', tableStandbyTimeColumn: 'Standby Time (Hours)', tableFaultTimeColumn: 'Fault Time (Hours)', - tableWarningTimeColumn: 'Warning Time (Hours)', + tableWarningTimeColumn: 'Alarm Time (Hours)', tableUtilizationRateColumn: 'Utilization Rate', tableUtilizationRateTooltip: 'Power-on Rate = Online Time / Total Time\nOnline Time = Running Time + Standby Time + Fault Time\nUtilization Rate = Running Time / Online Time\nPower-on Rate = (Running Time + Standby Time + Fault Time) / Total Time', diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index 57bf3c1a..10586810 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -419,7 +419,7 @@ export default { currentStatus: '当前状态', runningTime: '运行时间(今日)', standbyTime: '空闲时间(今日)', - alarmTime: '报警时间(今日)', + alarmTime: '报警时间(小时)', efficiency: '稼动率(今日)' }, empty: '暂无设备运行数据' @@ -5575,7 +5575,7 @@ export default { tableRunningTimeColumn: '运行时间(小时)', tableStandbyTimeColumn: '待机时间(小时)', tableFaultTimeColumn: '故障时间(小时)', - tableWarningTimeColumn: '警告时间(小时)', + tableWarningTimeColumn: '报警时间(小时)', tableUtilizationRateColumn: '稼动率', tableUtilizationRateTooltip: '开机率 = 在线时间 / 总的时间\n在线时间 = 运行时间 + 空闲时间 + 故障时间\n稼动率 = 运行时间 / 在线时间\n开机率 =(运行时间 + 空闲时间 + 故障时间)/ 总的时间', diff --git a/src/views/iot/runReport/index.vue b/src/views/iot/runReport/index.vue index 3f84a639..578d8738 100644 --- a/src/views/iot/runReport/index.vue +++ b/src/views/iot/runReport/index.vue @@ -86,12 +86,12 @@ prop="totalFaultTime" min-width="140px" sortable /> - + sortable />
- - {{ t('action.export') }} - + + + + + + + + + + + + + + + + + + {{ t('common.query') }} + + + {{ t('common.reset') }} + + + {{ t('action.export') }} + + +
- + @@ -441,6 +511,12 @@ + @@ -455,13 +531,19 @@ {{ t('action.export') }} - + - + + @@ -497,7 +579,8 @@ import { dateFormatter, formatDate } from '@/utils/formatTime' import download from '@/utils/download' import { DeviceLedgerApi, DeviceLedgerVO } from '@/api/mes/deviceledger' import { DeviceTypeApi, DeviceTypeTreeVO } from '@/api/mes/devicetype' -import { CriticalComponentApi } from '@/api/mes/criticalComponent' +import { CriticalComponentApi, CriticalComponentVO } from '@/api/mes/criticalComponent' +import { ProductVO } from '@/api/erp/product/product' import { TicketManagementApi } from '@/api/mes/ticketManagement' import { DvRepairApi } from '@/api/mes/dvrepair' import QrcodeActionCard from '@/components/QrcodeActionCard/index.vue' @@ -522,6 +605,67 @@ const detailLoading = ref(false) const tableLoading = ref(false) const detailData = ref() const detailActiveTab = ref('check') +const criticalComponentLoading = ref(false) +const criticalComponentList = ref([]) +const criticalComponentTotal = ref(0) +const criticalComponentQueryFormRef = ref() +const criticalComponentQueryParams = reactive({ + pageNo: 1, + pageSize: 10, + deviceLedgerId: undefined as string | undefined, + code: undefined as string | undefined, + name: undefined as string | undefined, + description: undefined as string | undefined, + remark: undefined as string | undefined, + createTime: [] as string[] +}) +const spareLoading = ref(false) +const spareList = ref([]) +const spareTotal = ref(0) +const spareQueryParams = reactive({ + pageNo: 1, + pageSize: 10 +}) + +const getCriticalComponentList = async () => { + if (!deviceId.value) return + criticalComponentLoading.value = true + try { + const data = await CriticalComponentApi.getCriticalComponentPage({ + ...criticalComponentQueryParams, + deviceLedgerId: deviceId.value + }) + criticalComponentList.value = data.list ?? [] + criticalComponentTotal.value = data.total ?? 0 + } finally { + criticalComponentLoading.value = false + } +} + +const handleQueryCriticalComponent = async () => { + criticalComponentQueryParams.pageNo = 1 + await getCriticalComponentList() +} + +const resetCriticalComponentQuery = async () => { + criticalComponentQueryFormRef.value?.resetFields() + await handleQueryCriticalComponent() +} + +const getSpareList = async () => { + if (!deviceId.value) return + spareLoading.value = true + try { + const data = await DeviceLedgerApi.getDeviceLedgerSparePage({ + ...spareQueryParams, + deviceLedgerId: deviceId.value + }) + spareList.value = data.list ?? [] + spareTotal.value = data.total ?? 0 + } finally { + spareLoading.value = false + } +} const deviceTypeNameMap = ref>({}) @@ -965,7 +1109,7 @@ const handleExportSpareBased = async () => { try { await message.exportConfirm() spareExportLoading.value = true - const data = await DeviceLedgerApi.exportSpareBased({ id: deviceId.value }) + const data = await DeviceLedgerApi.exportDeviceLedgerSpare({ deviceLedgerId: deviceId.value }) download.excel(data, '备件.xls') } catch { } finally { @@ -999,6 +1143,8 @@ const getDetail = async () => { onMounted(async () => { await getTypeTreeForNameMap() await getDetail() + await getCriticalComponentList() + await getSpareList() }) @@ -1203,6 +1349,10 @@ onMounted(async () => { text-align: right; } +.device-ledger-critical-component-query { + text-align: left; +} + .device-ledger-history-items { display: flex; flex-direction: column; diff --git a/src/views/report/dashboardPage/dashboard1/dashboard3/index.vue b/src/views/report/dashboardPage/dashboard1/dashboard3/index.vue index 4744c1d5..35b08b23 100644 --- a/src/views/report/dashboardPage/dashboard1/dashboard3/index.vue +++ b/src/views/report/dashboardPage/dashboard1/dashboard3/index.vue @@ -50,7 +50,7 @@
{{ item.name }} - {{ t('AlarmBoard.alarmPrefix') }} {{ formatHours(item.alarmTime) }} + {{ t('AlarmBoard.alarmPrefix') }} {{ formatHours(item.totalWarningTime) }} {{ item.lastReportTime }}
@@ -69,7 +69,7 @@ {{ t('Detail.columns.currentStatus') }} 运行时间(小时) 待机时间(小时) - 故障时间(小时) + {{ t('Detail.columns.alarmTime') }} 稼动率
@@ -85,7 +85,7 @@ {{ formatHours(row.runningTime) }} {{ formatHours(row.standbyTime) }} - {{ formatHours(row.alarmTime) }} + {{ formatHours(row.totalWarningTime) }} {{ formatPercentText(row.utilizationRate) }}
@@ -158,7 +158,7 @@ interface DetailRow { status: RunStatus runningTime: number standbyTime: number - alarmTime: number + totalWarningTime: number utilizationRate: string lastReportTime: string } @@ -273,9 +273,9 @@ const detailRows = computed(() => { status, runningTime: Number(row.totalRunningTime) || 0, standbyTime: Number(row.totalStandbyTime) || 0, - alarmTime: Number(row.totalFaultTime) || 0, + totalWarningTime: Number(row.totalWarningTime) || 0, utilizationRate: row.utilizationRate || '0%', - lastReportTime: status === 'fault' || Number(row.totalFaultTime) > 0 ? lastUpdateTime.value || '-' : '-' + lastReportTime: status === 'fault' || Number(row.totalWarningTime) > 0 ? lastUpdateTime.value || '-' : '-' } }) }) @@ -296,8 +296,8 @@ const pagedRows = computed(() => { const detailPageText = computed(() => `${detailPage.value} / ${totalDetailPages.value}`) const alarmDevices = computed(() => { return detailRows.value - .filter((item) => item.status === 'fault' || item.alarmTime > 0) - .sort((a, b) => b.alarmTime - a.alarmTime) + .filter((item) => item.status === 'fault' || item.totalWarningTime > 0) + .sort((a, b) => b.totalWarningTime - a.totalWarningTime) .slice(0, 2) }) const hourlyRates = computed(() => { diff --git a/src/views/report/dashboardPage/dashboard3/index.vue b/src/views/report/dashboardPage/dashboard3/index.vue index 81167f64..cfa73dca 100644 --- a/src/views/report/dashboardPage/dashboard3/index.vue +++ b/src/views/report/dashboardPage/dashboard3/index.vue @@ -84,7 +84,7 @@ {{ formatMinutes(row.runningMinutes) }} {{ formatMinutes(row.standbyMinutes) }} - {{ formatMinutes(row.alarmMinutes) }} + {{ formatHours(row.totalWarningTime) }} {{ formatPercent(row.utilizationRate) }} @@ -140,7 +140,7 @@ interface DetailRow { status: RunStatus runningMinutes: number standbyMinutes: number - alarmMinutes: number + totalWarningTime: number utilizationRate: number lastReportTime: string } @@ -259,9 +259,9 @@ const detailRows = computed(() => { status, runningMinutes: minutes.running, standbyMinutes: minutes.standby, - alarmMinutes: minutes.fault, + totalWarningTime: Number(row.totalWarningTime) || 0, utilizationRate: Number(row.utilizationRate) || 0, - lastReportTime: status === 'fault' || minutes.fault > 0 ? lastUpdateTime.value || '-' : '-' + lastReportTime: status === 'fault' || Number(row.totalWarningTime) > 0 ? lastUpdateTime.value || '-' : '-' } }) }) @@ -283,8 +283,8 @@ const pagedRows = computed(() => { const detailPageText = computed(() => `${detailPage.value} / ${totalDetailPages.value}`) const alarmDevices = computed(() => { return detailRows.value - .filter((item) => item.status === 'fault' || item.alarmMinutes > 0) - .sort((a, b) => b.alarmMinutes - a.alarmMinutes) + .filter((item) => item.status === 'fault' || item.totalWarningTime > 0) + .sort((a, b) => b.totalWarningTime - a.totalWarningTime) .slice(0, 2) }) const hourlyRates = computed(() => @@ -310,6 +310,12 @@ const formatMinutes = (minutes: number) => { return t('Time.hourMinute', { hour: hours, minute: rest }) } +const formatHours = (value?: number) => { + const hours = Number(value) + const safeHours = Number.isFinite(hours) && hours > 0 ? Math.round(hours * 100) / 100 : 0 + return t('Time.hour', { hour: safeHours }) +} + const average = (values: number[]) => { const valid = values.filter((item) => Number.isFinite(item)) if (!valid.length) return 0