diff --git a/src/views/Dashboard/index.vue b/src/views/Dashboard/index.vue index 02ea549..f82cc8b 100644 --- a/src/views/Dashboard/index.vue +++ b/src/views/Dashboard/index.vue @@ -24,7 +24,7 @@

果肉调配

- 果肉流量:{{ totalTrafficPulp }} + 累计流量:{{ totalTrafficPulp }}
当前状态: - {{ processForm_uht.status }} + {{ processForm_uht.deviceStatus }}
当前步骤: @@ -106,7 +106,7 @@
当前状态: - {{ processForm_pulp.status }} + {{ processForm_pulp.deviceStatus }}
当前步骤: @@ -315,8 +315,6 @@ import momentTimezone from 'moment-timezone'; import { ref, onMounted, getCurrentInstance, onUnmounted, defineEmits } from 'vue' import { IxChip, IxButton, IxDropdown, IxDropdownItem, IxDropdownHeader, IxDivider, IxTabItem, IxTabs } from '@siemens/ix-vue'; // 引入 Chip 组件 import { getCurrentReport, getHistoryReport, getGanttData, getStopReason, setStopReason } from '@/api/dashboard.js'; -import GradientProgressBar from '@/components/GradientProgressBar.vue' -import ProcessStatusBar from '@/components/ProcessStatusBar.vue' import ProcessGanttChart from '@/components/ProcessGanttChart.vue' const emit = defineEmits(['send-data']); @@ -476,6 +474,28 @@ const getStatusColor = (status) => { const processHistoryDataFromAPI = processDataFromAPI; // 复用 processDataFromAPI 函数 const getDataByName = (data, name) => { + const filteredData = data.filter(item => item.name === name); + if (filteredData.length === 0) { + return { + name, + deviceId: null, + totalTraffic: 0, + data: [] + }; + } + const mergedData = filteredData.map(item => ({ + ...item.data, + deviceId: item.deviceId // 增加 deviceId 字段 + })); + return { + name, + deviceId: filteredData[0].deviceId, + totalTraffic: mergedData.reduce((acc, item) => acc + (item.weight || 0), 0), + data: mergedData + }; +}; + +const getUHTDataByName = (data, name) => { const filteredData = data.filter(item => item.name === name); if (filteredData.length === 0) { return { @@ -501,10 +521,10 @@ const updateData = (processedData) => { juiceData.value = getDataByName(processedData, "果汁调配"); pulpData.value = getDataByName(processedData, "果肉调配"); uhtData.value = getDataByName(processedData, "果汁杀菌"); - pulpUHTData.value = getDataByName(processedData, "果肉杀菌"); - juiceTankData.value = getDataByName(processedData, "果汁无菌罐"); - pulpTankData.value = getDataByName(processedData, "果肉无菌罐"); - dynamicMixerData.value = getDataByName(processedData, "动态混合器"); + pulpUHTData.value = getUHTDataByName(processedData, "果肉杀菌"); + juiceTankData.value = getUHTDataByName(processedData, "果汁无菌罐"); + pulpTankData.value = getUHTDataByName(processedData, "果肉无菌罐"); + dynamicMixerData.value = getUHTDataByName(processedData, "动态混合器"); // 设置默认值 if (juiceData.value.deviceId) { @@ -512,8 +532,8 @@ const updateData = (processedData) => { currentTitle.value = juiceData.value.data[0].name; } // 累计流量 - totalTrafficJuice.value = juiceData.value.totalTraffic; - totalTrafficPulp.value = pulpData.value.totalTraffic; + totalTrafficJuice.value = juiceData.value.totalTraffic.toFixed(2); + totalTrafficPulp.value = pulpData.value.totalTraffic.toFixed(2); if (juiceData.value.data.length > 0) { progressList.value = juiceData.value.data.map(item => ({ @@ -539,7 +559,7 @@ const updateData = (processedData) => { name: uhtData.value.name, formula: uhtData.value.data[0].formula, totalTraffic: uhtData.value.totalTraffic, - status: uhtData.value.data[0].status, + deviceStatus: uhtData.value.data[0].deviceStatus, productFlowRate: uhtData.value.data[0].productFlowRate, mixerStep: uhtData.value.data[0].mixerStep, temperature: uhtData.value.data[0].temperature @@ -550,7 +570,7 @@ const updateData = (processedData) => { name: pulpUHTData.value.name, formula: pulpUHTData.value.data[0].formula, totalTraffic: pulpUHTData.value.totalTraffic, - status: pulpUHTData.value.data[0].status, + deviceStatus: pulpUHTData.value.data[0].deviceStatus, productFlowRate: pulpUHTData.value.data[0].productFlowRate, mixerStep: pulpUHTData.value.data[0].mixerStep, temperature: pulpUHTData.value.data[0].temperature @@ -583,8 +603,7 @@ const updateData = (processedData) => { productFlowRate: dynamicMixerData.value.data[0].productFlowRate }; } - if (processedData !== undefined) showInfoMessage("数据刷新成功!"); - else showWarningMessage("未查询到历史数据!"); + if (processedData === undefined) showWarningMessage("未查询到主数据!"); }; // 读取接口数据 @@ -639,9 +658,9 @@ const processGanttDataResponse = (response) => { if (ganttChart.value && ganttChart.value.updateChart) { ganttChart.value.updateChart(); } - showInfoMessage('' + ganttData.length + ' 条数据已刷新!'); + // showInfoMessage('' + ganttData.length + ' 条数据已刷新!'); } else { - showWarningMessage('未查询到数据!'); + showWarningMessage('未查询到甘特图数据!'); processData.value = []; formattedProcessData.value = []; if (ganttChart.value && ganttChart.value.updateChart) { diff --git a/src/views/Inspection/InspectionForm.vue b/src/views/Inspection/InspectionForm.vue index 4d98c1c..f13bb5d 100644 --- a/src/views/Inspection/InspectionForm.vue +++ b/src/views/Inspection/InspectionForm.vue @@ -10,27 +10,31 @@

{{ itemName }}

- 09:00 超出上下限 + {{ itemTime }} 超出上下限
\ No newline at end of file