fix: 点检功能完善
This commit is contained in:
parent
e6814c5f04
commit
d44fc687dc
|
@ -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": "*",
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
</div>
|
||||
<div class="spacing"></div>
|
||||
<div class="UHT-item">
|
||||
<div class="info-panel" style="display: flex; justify-content: space-between;width: 45%;">
|
||||
<div class="info-panel" style="display: flex; justify-content: space-between;width: 44%;">
|
||||
<div class="info-row">
|
||||
<span class="info-label">当前配方:</span>
|
||||
<span class="info-value">{{ processForm_uht.formula }}</span>
|
||||
|
@ -64,7 +64,7 @@
|
|||
<span class="info-value">{{ processForm_uht.mixerStep }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-panel" style="display: flex; justify-content: space-between;width: 24%">
|
||||
<div class="info-panel" style="display: flex; justify-content: space-between;width: 25%">
|
||||
<div class="info-row">
|
||||
<span class="info-label">累计流量:</span>
|
||||
<span class="info-value">{{ processForm_uht.totalTraffic }}</span>
|
||||
|
@ -130,7 +130,7 @@
|
|||
</div>
|
||||
<div class="spacing"></div>
|
||||
<div class="UHT-item">
|
||||
<div class="info-panel" style="display: flex; justify-content: space-between;width: 45%;">
|
||||
<div class="info-panel" style="display: flex; justify-content: space-between;width: 44%;">
|
||||
<div class="info-row">
|
||||
<span class="info-label">当前配方:</span>
|
||||
<span class="info-value">{{ processForm_pulp.formula }}</span>
|
||||
|
@ -144,7 +144,7 @@
|
|||
<span class="info-value">{{ processForm_pulp.mixerStep }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-panel" style="display: flex; justify-content: space-between;width: 24%;">
|
||||
<div class="info-panel" style="display: flex; justify-content: space-between;width: 25%;">
|
||||
<div class="info-row">
|
||||
<span class="info-label">累计流量:</span>
|
||||
<span class="info-value">{{ processForm_pulp.totalTraffic }}</span>
|
||||
|
@ -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);
|
||||
});
|
||||
},
|
||||
() => {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<IxSelectItem label="报警" value="2"></IxSelectItem>
|
||||
</IxSelect>
|
||||
<!-- 查询按钮 -->
|
||||
<IxButton @click="handleSearch" class="input-spacing btn-style"> 查询 </IxButton>
|
||||
<IxButton @click="handleSearch" class="input-spacing btn-style"> 刷新 </IxButton>
|
||||
<!-- 导出按钮 -->
|
||||
<IxButton class="input-spacing btn-style" @click="handleExport"> 导出全部 </IxButton>
|
||||
</div>
|
||||
|
@ -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);
|
||||
// }
|
||||
// });
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
@ -509,26 +519,21 @@ onUnmounted(() => {
|
|||
/* 添加水平滚动条 */
|
||||
}
|
||||
|
||||
.table-container {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.table-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 100%;
|
||||
/* 确保表格宽度至少为容器宽度 */
|
||||
overflow-x: auto;
|
||||
/* 添加水平滚动条 */
|
||||
position: relative; /* 添加此行以确保表头和数据在同一容器内滚动 */
|
||||
}
|
||||
|
||||
.table-row {
|
||||
.table-row, .table-row-1 {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
/* padding: 10px;
|
||||
border-bottom: 1px solid #ccc; */
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
/* 使每一行铺满 */
|
||||
min-width: max-content; /* 添加此行以确保表格内容不会被压缩 */
|
||||
}
|
||||
|
||||
.table-row-1 {
|
||||
|
@ -538,6 +543,10 @@ onUnmounted(() => {
|
|||
align-items: center;
|
||||
flex: 1;
|
||||
padding: 0 0 0 0.5rem;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 2;
|
||||
background-color: inherit; /* 添加此行以确保表头背景色一致 */
|
||||
}
|
||||
|
||||
.fixed-width {
|
||||
|
|
|
@ -170,6 +170,10 @@ onMounted(() => {
|
|||
}, 60000); // 每分钟更新一次
|
||||
onUnmounted(() => clearInterval(interval)); // 监听应用切换事件
|
||||
});
|
||||
|
||||
// 实时刷新时间
|
||||
setInterval(updateTime, 1000); // 每秒刷新一次
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
Loading…
Reference in New Issue