累计流量:
{{ 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);
+// }
+// });