fix: 点检功能完善

This commit is contained in:
Zhao Zhao Shen 2025-03-10 18:14:02 +08:00
parent e6814c5f04
commit d44fc687dc
4 changed files with 60 additions and 42 deletions

View File

@ -1,8 +1,8 @@
import axios from 'axios'; import axios from 'axios';
const service = axios.create({ const service = axios.create({
baseURL: 'http://192.168.1.199:8080/api', // 办公室测试接口 // baseURL: 'http://192.168.1.199:8080/api', // 办公室测试接口
// baseURL: 'http://39.105.9.124:8090/api', // 家用测试接口 baseURL: 'http://39.105.9.124:8090/api', // 家用测试接口
timeout: 5000, // 请求超时时间 timeout: 5000, // 请求超时时间
headers: { headers: {
"Access-Control-Allow-Origin": "*", "Access-Control-Allow-Origin": "*",

View File

@ -50,7 +50,7 @@
</div> </div>
<div class="spacing"></div> <div class="spacing"></div>
<div class="UHT-item"> <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"> <div class="info-row">
<span class="info-label">当前配方</span> <span class="info-label">当前配方</span>
<span class="info-value">{{ processForm_uht.formula }}</span> <span class="info-value">{{ processForm_uht.formula }}</span>
@ -64,7 +64,7 @@
<span class="info-value">{{ processForm_uht.mixerStep }}</span> <span class="info-value">{{ processForm_uht.mixerStep }}</span>
</div> </div>
</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"> <div class="info-row">
<span class="info-label">累计流量</span> <span class="info-label">累计流量</span>
<span class="info-value">{{ processForm_uht.totalTraffic }}</span> <span class="info-value">{{ processForm_uht.totalTraffic }}</span>
@ -130,7 +130,7 @@
</div> </div>
<div class="spacing"></div> <div class="spacing"></div>
<div class="UHT-item"> <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"> <div class="info-row">
<span class="info-label">当前配方</span> <span class="info-label">当前配方</span>
<span class="info-value">{{ processForm_pulp.formula }}</span> <span class="info-value">{{ processForm_pulp.formula }}</span>
@ -144,7 +144,7 @@
<span class="info-value">{{ processForm_pulp.mixerStep }}</span> <span class="info-value">{{ processForm_pulp.mixerStep }}</span>
</div> </div>
</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"> <div class="info-row">
<span class="info-label">累计流量</span> <span class="info-label">累计流量</span>
<span class="info-value">{{ processForm_pulp.totalTraffic }}</span> <span class="info-value">{{ processForm_pulp.totalTraffic }}</span>
@ -498,6 +498,11 @@ const updateAlarmCount = () => {
alarmStore.setAlarmCount(alarmCount.value); // alarmStore 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) => { const updateCurrentInfo = (segment) => {
id.value = segment.id; id.value = segment.id;
currentStatus.value = segment.deviceStatus; currentStatus.value = segment.deviceStatus;
@ -843,7 +848,7 @@ const handleReasonChange = (id, reason) => {
if (ganttChart.value && ganttChart.value.updateChart) { if (ganttChart.value && ganttChart.value.updateChart) {
ganttChart.value.updateChart(); ganttChart.value.updateChart();
} }
showInfoMessage('停机原因已设置为:' + reason); // showInfoMessage('' + reason);
}); });
}, },
() => { () => {

View File

@ -19,7 +19,7 @@
<IxSelectItem label="报警" value="2"></IxSelectItem> <IxSelectItem label="报警" value="2"></IxSelectItem>
</IxSelect> </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> <IxButton class="input-spacing btn-style" @click="handleExport"> 导出全部 </IxButton>
</div> </div>
@ -257,6 +257,8 @@ const showConfirmMessage = (message, onConfirm, onCancel) => {
// //
const handleDateChange = (event) => { const handleDateChange = (event) => {
selectedDate.value = event.target.value; selectedDate.value = event.target.value;
fetchInspectionData();
fetchCurrentValues();
}; };
// //
@ -299,7 +301,7 @@ const fetchCurrentValues = async () => {
if (response.data) { if (response.data) {
const currentValues = response.data.data; const currentValues = response.data.data;
inspectionItems.value.forEach(item => { inspectionItems.value.forEach(item => {
item.current = currentValues[item.name] || '--'; item.current = currentValues?.[item.name] || '--'; // currentValues
}); });
} else { } else {
showWarningMessage('获取当前设备当前值失败!'); showWarningMessage('获取当前设备当前值失败!');
@ -385,6 +387,14 @@ const handleSearch = () => {
}; };
const handleExport = () => { 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('导出全部'); showInfoMessage('导出全部');
exportExcel(selectedDeviceId.value, selectedDate.value || currentDate, shift.value) exportExcel(selectedDeviceId.value, selectedDate.value || currentDate, shift.value)
.then((response) => { .then((response) => {
@ -415,27 +425,27 @@ const getDeviceNameById = (id) => {
return device ? device.name : ''; return device ? device.name : '';
}; };
let autoUpdateInterval = null; // let autoUpdateInterval = null;
onMounted(async () => { // onMounted(async () => {
await fetchDeviceList(); // await fetchDeviceList();
fetchCurrentValues(); // fetchCurrentValues();
fetchInspectionData(); // fetchInspectionData();
sendDataToParent(); // sendDataToParent();
const setupAutoUpdate = () => { // const setupAutoUpdate = () => {
if (isAutoUpdate.value) { // if (isAutoUpdate.value) {
autoUpdateInterval = setInterval(() => { // autoUpdateInterval = setInterval(() => {
fetchCurrentValues(); // fetchCurrentValues();
fetchInspectionData(); // fetchInspectionData();
}, 60000); // // }, 60000); //
} else if (autoUpdateInterval) { // } else if (autoUpdateInterval) {
clearInterval(autoUpdateInterval); // clearInterval(autoUpdateInterval);
autoUpdateInterval = null; // autoUpdateInterval = null;
} // }
}; // };
setupAutoUpdate(); // setupAutoUpdate();
// update-history // update-history
// window.addEventListener('update-history', (event) => { // window.addEventListener('update-history', (event) => {
@ -454,13 +464,13 @@ onMounted(async () => {
// fetchInspectionData(); // fetchInspectionData();
// setupAutoUpdate(); // setupAutoUpdate();
// }); // });
}); // });
onUnmounted(() => { // onUnmounted(() => {
if (autoUpdateInterval) { // if (autoUpdateInterval) {
clearInterval(autoUpdateInterval); // clearInterval(autoUpdateInterval);
} // }
}); // });
</script> </script>
<style scoped> <style scoped>
@ -509,26 +519,21 @@ onUnmounted(() => {
/* 添加水平滚动条 */ /* 添加水平滚动条 */
} }
.table-container {
display: flex;
}
.table-container { .table-container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
min-width: 100%; min-width: 100%;
/* 确保表格宽度至少为容器宽度 */
overflow-x: auto; overflow-x: auto;
/* 添加水平滚动条 */ /* 添加水平滚动条 */
position: relative; /* 添加此行以确保表头和数据在同一容器内滚动 */
} }
.table-row { .table-row, .table-row-1 {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
/* padding: 10px; align-items: center;
border-bottom: 1px solid #ccc; */
flex: 1; flex: 1;
/* 使每一行铺满 */ min-width: max-content; /* 添加此行以确保表格内容不会被压缩 */
} }
.table-row-1 { .table-row-1 {
@ -538,6 +543,10 @@ onUnmounted(() => {
align-items: center; align-items: center;
flex: 1; flex: 1;
padding: 0 0 0 0.5rem; padding: 0 0 0 0.5rem;
position: sticky;
top: 0;
z-index: 2;
background-color: inherit; /* 添加此行以确保表头背景色一致 */
} }
.fixed-width { .fixed-width {

View File

@ -170,6 +170,10 @@ onMounted(() => {
}, 60000); // }, 60000); //
onUnmounted(() => clearInterval(interval)); // onUnmounted(() => clearInterval(interval)); //
}); });
//
setInterval(updateTime, 1000); //
</script> </script>
<style scoped> <style scoped>