From d44fc687dc399812faa7ab75288ad414ba36ece4 Mon Sep 17 00:00:00 2001 From: Zhao Zhao Shen Date: Mon, 10 Mar 2025 18:14:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=82=B9=E6=A3=80=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/request.js | 4 +- src/views/Dashboard/index.vue | 15 ++++--- src/views/Inspection/index.vue | 79 +++++++++++++++++++--------------- src/views/layout/vueLayout.vue | 4 ++ 4 files changed, 60 insertions(+), 42 deletions(-) diff --git a/src/utils/request.js b/src/utils/request.js index 3406b27..dbb0743 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -1,8 +1,8 @@ import axios from 'axios'; const service = axios.create({ - baseURL: 'http://192.168.1.199:8080/api', // 办公室测试接口 - // baseURL: 'http://39.105.9.124:8090/api', // 家用测试接口 + // baseURL: 'http://192.168.1.199:8080/api', // 办公室测试接口 + baseURL: 'http://39.105.9.124:8090/api', // 家用测试接口 timeout: 5000, // 请求超时时间 headers: { "Access-Control-Allow-Origin": "*", diff --git a/src/views/Dashboard/index.vue b/src/views/Dashboard/index.vue index 466520c..6113083 100644 --- a/src/views/Dashboard/index.vue +++ b/src/views/Dashboard/index.vue @@ -50,7 +50,7 @@
-
+
当前配方: {{ processForm_uht.formula }} @@ -64,7 +64,7 @@ {{ processForm_uht.mixerStep }}
-
+
累计流量: {{ processForm_uht.totalTraffic }} @@ -130,7 +130,7 @@
-
+
当前配方: {{ processForm_pulp.formula }} @@ -144,7 +144,7 @@ {{ processForm_pulp.mixerStep }}
-
+
累计流量: {{ processForm_pulp.totalTraffic }} @@ -498,6 +498,11 @@ const updateAlarmCount = () => { alarmStore.setAlarmCount(alarmCount.value); // 更新 alarmStore 中的报警计数 }; +const formatNumberWithCommas = (number) => { + if (number === null || number === undefined) return '--'; + return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); +}; + const updateCurrentInfo = (segment) => { id.value = segment.id; currentStatus.value = segment.deviceStatus; @@ -843,7 +848,7 @@ const handleReasonChange = (id, reason) => { if (ganttChart.value && ganttChart.value.updateChart) { ganttChart.value.updateChart(); } - showInfoMessage('停机原因已设置为:' + reason); + // showInfoMessage('停机原因已设置为:' + reason); }); }, () => { diff --git a/src/views/Inspection/index.vue b/src/views/Inspection/index.vue index fec0cd9..ef05c47 100644 --- a/src/views/Inspection/index.vue +++ b/src/views/Inspection/index.vue @@ -19,7 +19,7 @@ - 查询 + 刷新 导出全部
@@ -257,6 +257,8 @@ const showConfirmMessage = (message, onConfirm, onCancel) => { // 日期变化处理函数 const handleDateChange = (event) => { selectedDate.value = event.target.value; + fetchInspectionData(); + fetchCurrentValues(); }; // 班次变化处理函数 @@ -299,7 +301,7 @@ const fetchCurrentValues = async () => { if (response.data) { const currentValues = response.data.data; inspectionItems.value.forEach(item => { - item.current = currentValues[item.name] || '--'; + item.current = currentValues?.[item.name] || '--'; // 添加对 currentValues 的检查 }); } else { showWarningMessage('获取当前设备当前值失败!'); @@ -385,6 +387,14 @@ const handleSearch = () => { }; const handleExport = () => { + console.log("🚀 ~ handleExport ~ inspectionItems.value.some(item => Object.values(item.data).some(data => data.checkStatus === 0)):", inspectionItems.value.some(item => Object.values(item.data).some(data => data.checkStatus === 0))) + + // 增加一个判断,判断当前的数据中inspectionItems.value中是否有报警数据,如果有则提示不允许导出 + if (inspectionItems.value.some(item => Object.values(item.data).some(data => data.checkStatus === 0))) { + showWarningMessage('请先处理报警数据,再进行导出!'); + return; + } + showInfoMessage('导出全部'); exportExcel(selectedDeviceId.value, selectedDate.value || currentDate, shift.value) .then((response) => { @@ -415,27 +425,27 @@ const getDeviceNameById = (id) => { return device ? device.name : ''; }; -let autoUpdateInterval = null; +// let autoUpdateInterval = null; -onMounted(async () => { - await fetchDeviceList(); - fetchCurrentValues(); - fetchInspectionData(); - sendDataToParent(); +// onMounted(async () => { +// await fetchDeviceList(); +// fetchCurrentValues(); +// fetchInspectionData(); +// sendDataToParent(); - const setupAutoUpdate = () => { - if (isAutoUpdate.value) { - autoUpdateInterval = setInterval(() => { - fetchCurrentValues(); - fetchInspectionData(); - }, 60000); // 每分钟刷新一次接口 - } else if (autoUpdateInterval) { - clearInterval(autoUpdateInterval); - autoUpdateInterval = null; - } - }; +// const setupAutoUpdate = () => { +// if (isAutoUpdate.value) { +// autoUpdateInterval = setInterval(() => { +// fetchCurrentValues(); +// fetchInspectionData(); +// }, 60000); // 每分钟刷新一次接口 +// } else if (autoUpdateInterval) { +// clearInterval(autoUpdateInterval); +// autoUpdateInterval = null; +// } +// }; - setupAutoUpdate(); +// setupAutoUpdate(); // 监听 update-history 事件 // window.addEventListener('update-history', (event) => { @@ -454,13 +464,13 @@ onMounted(async () => { // fetchInspectionData(); // setupAutoUpdate(); // }); -}); +// }); -onUnmounted(() => { - if (autoUpdateInterval) { - clearInterval(autoUpdateInterval); - } -}); +// onUnmounted(() => { +// if (autoUpdateInterval) { +// clearInterval(autoUpdateInterval); +// } +// });