diff --git a/src/views/Dashboard/index.vue b/src/views/Dashboard/index.vue index 6113083..0053c6f 100644 --- a/src/views/Dashboard/index.vue +++ b/src/views/Dashboard/index.vue @@ -6,17 +6,17 @@

果汁调配

- 累计流量:{{ totalTrafficJuice }} + 累计流量:{{ formatNumberWithCommas(totalTrafficJuice) }}
+ @click="handleBlockClick(item?.deviceId, item.aliasName, false)"> {{ item.name }}:
- {{ item.value }} + {{ formatNumberWithCommas(item.value) }}
@@ -25,17 +25,17 @@

果肉调配

- 累计流量:{{ totalTrafficPulp }} + 累计流量:{{ formatNumberWithCommas(totalTrafficPulp) }}
+ @click="handleBlockClick(item?.deviceId, item.aliasName, false)"> {{ item.name }}:
- {{ item.value }} + {{ formatNumberWithCommas(item.value) }}
@@ -67,11 +67,11 @@
累计流量: - {{ processForm_uht.totalTraffic }} + {{ formatNumberWithCommas(processForm_uht.totalTraffic) }}
产品流量: - {{ processForm_uht.productFlowRate }} + {{ formatNumberWithCommas(processForm_uht.productFlowRate) }}
平衡温度: @@ -147,11 +147,11 @@
累计流量: - {{ processForm_pulp.totalTraffic }} + {{ formatNumberWithCommas(processForm_pulp.totalTraffic) }}
产品流量: - {{ processForm_pulp.productFlowRate }} + {{ formatNumberWithCommas(processForm_pulp.productFlowRate) }}
平衡温度: @@ -234,12 +234,12 @@
- {{ juiceTank.liquidLevel }} + {{ formatNumberWithCommas(juiceTank.liquidLevel) }}
- ▼果汁流量:{{ juiceTank.productFlowRate + ▼果汁流量:{{ formatNumberWithCommas(juiceTank.productFlowRate) }}
@@ -285,18 +285,18 @@
当前液位: - {{ dynamicMixer.liquidLevel }} + {{ formatNumberWithCommas(dynamicMixer.liquidLevel) }}
当前流量: - {{ dynamicMixer.productFlowRate }} + {{ formatNumberWithCommas(dynamicMixer.productFlowRate) }}
- ▲果肉流量:{{ pulpTank.productFlowRate + ▲果肉流量:{{ formatNumberWithCommas(pulpTank.productFlowRate) }}
@@ -334,7 +334,7 @@
- {{ pulpTank.liquidLevel }} + {{ formatNumberWithCommas(pulpTank.liquidLevel) }}
@@ -369,7 +369,7 @@ 生产步骤:{{ mixerStep }} 开始时间:{{ startTimeFormatted }} 结束时间:{{ endTimeFormatted }} - 流量:{{ productFlowRate }} + 流量:{{ formatNumberWithCommas(productFlowRate) }} 配方:{{ formula }} 持续时长:{{ duration }} {{ selectedReason ? '停机原因:' + @@ -392,7 +392,7 @@ 结束时间:{{ endTimeFormatted }} 持续时长:{{ duration }} 调配状态:{{ blendStatus }} - 罐重:{{ capacity }} + 罐重:{{ formatNumberWithCommas(capacity) }}
@@ -539,8 +539,7 @@ const processDataFromAPI = (apiData) => { recordTime: item.recordTime, data: { id: item.data.id || 0, - weight: item.data.weight || 0, - capacity: item.data.capacity, + weight: item.data.weight || 0, deviceStatus: item.data.deviceStatus || '', cleanStatus: item.data.cleanStatus || '', productFlowRate: item.data.productFlowRate || 0, @@ -548,7 +547,9 @@ const processDataFromAPI = (apiData) => { formula: item.data.formula || '', mixerStep: item.data.mixerStep || '', temperature: item.data.temperature || 0, - liquidLevel: item.data.liquidLevel || 0 + liquidLevel: item.data.liquidLevel || 0, + capacity: item.data.capacity, + aliasName: item.data.aliasName || '', }, statusList: item.statusList || [] }; @@ -614,7 +615,7 @@ const updateData = (processedData) => { // 设置默认值 if (juiceData.value.deviceId) { globalDeviceId.value = juiceData.value.deviceId; - currentTitle.value = juiceData.value.data[0].name; + currentTitle.value = juiceData.value.data[0].aliasName; } // 累计流量 totalTrafficJuice.value = juiceData.value.totalTraffic.toFixed(2); @@ -623,6 +624,7 @@ const updateData = (processedData) => { if (juiceData.value.data.length > 0) { progressList.value = juiceData.value.data.map(item => ({ name: item.name, + aliasName: item.aliasName, deviceId: item.deviceId, deviceStatus: item.deviceStatus, value: item.weight, @@ -632,6 +634,7 @@ const updateData = (processedData) => { if (pulpData.value.data.length > 0) { innerProgressList.value = pulpData.value.data.map(item => ({ name: item.name, + aliasName: item.aliasName, deviceId: item.deviceId, deviceStatus: item.deviceStatus, value: item.weight, diff --git a/src/views/Inspection/index.vue b/src/views/Inspection/index.vue index eaa9206..1e01259 100644 --- a/src/views/Inspection/index.vue +++ b/src/views/Inspection/index.vue @@ -26,7 +26,7 @@
- + {{ item.name }} @@ -52,7 +52,7 @@ 参考值 当前值 + :style="{ backgroundColor: getDeviceNameById(selectedDeviceTypeId) === '灌注机' ? '#00FFB9' : '#00E4FF', color: '#000028' }"> {{ hour }}
@@ -119,7 +119,7 @@ const status = ref('0'); // 确保 status 变量已定义 // 设备列表 const deviceList = ref([]); -const selectedDeviceId = ref(null); +const selectedDeviceTypeId = ref(null); const showForm = ref(false); const selectedItemName = ref(''); @@ -168,7 +168,7 @@ const confirmedTimes = ref({}); // 点检状态 const hourCheckStatus = ref({}); const hourCheckTime = ref({}); -const alarmId = ref({}); +const alarmId = ref({}); // 改为双层结构:{ [deviceId: string]: { [recordTime: string]: number } } const hourCheckValid = ref({}); const formatTime = (time) => { @@ -272,7 +272,7 @@ const handleShiftChange = (event) => { // 切换设备 const handleDeviceListChange = (id) => { - selectedDeviceId.value = id; + selectedDeviceTypeId.value = id; fetchInspectionData(); fetchCurrentValues(); }; @@ -283,7 +283,7 @@ const fetchDeviceList = async () => { const response = await getDeviceList(); if (response.code === 200) { deviceList.value = response.data; - selectedDeviceId.value = deviceList.value[0].id; // 默认选中第一个设备 + selectedDeviceTypeId.value = deviceList.value[0].id; // 默认选中第一个设备 } else { showWarningMessage('获取设备列表失败!'); } @@ -295,7 +295,7 @@ const fetchDeviceList = async () => { // 获取当前值、参考值、单位等信息 const fetchCurrentValues = async () => { try { - const deviceId = selectedDeviceId.value; // 根据实际情况设置设备ID + const deviceId = selectedDeviceTypeId.value; // 根据实际情况设置设备ID const dateValue = selectedDate.value || currentDate; const response = await getInspectionCurrent(deviceId, dateValue); const params = await getCheckParas(deviceId, dateValue); @@ -335,19 +335,26 @@ const fetchCurrentValues = async () => { // 获取点检数据 const fetchInspectionData = async () => { try { - const deviceId = selectedDeviceId.value; // 根据实际情况设置设备ID + const deviceTypeId = selectedDeviceTypeId.value; // 根据实际情况设置设备ID const shiftValue = shift.value; const dateValue = selectedDate.value || currentDate; - const response = await getInspectionData(deviceId, dateValue, shiftValue); + const response = await getInspectionData(deviceTypeId, dateValue, shiftValue); if (response.data) { const inspectionData = response.data; const itemsMap = {}; inspectionData.forEach(record => { + console.log("🚀 ~ fetchInspectionData ~ record:", record) const recordTime = record.recordTime; const data = record.data; + const deviceId = record.deviceId; hourCheckStatus.value[recordTime] = record.hourCheckStatus; hourCheckTime.value[recordTime] = formatTime(record.hourCheckTime); - alarmId.value[recordTime] = record.alarmId; + + if (!alarmId.value[deviceId]) { + alarmId.value[deviceId] = {} // 初始化设备ID对应的存储空间 + } + alarmId.value[deviceId][recordTime] = record.alarmId; + hourCheckValid.value[recordTime] = record.hourCheckValid; for (const [name, valueObj] of Object.entries(data)) { @@ -398,7 +405,7 @@ const handleExport = () => { } showInfoMessage('导出全部'); - exportExcel(selectedDeviceId.value, selectedDate.value || currentDate, shift.value) + exportExcel(selectedDeviceTypeId.value, selectedDate.value || currentDate, shift.value) .then((response) => { if (response) { // 有数据的处理