Commit 1ae0d6b6 authored by 蔡伟's avatar 蔡伟

Merge branch 'feat/layout-style' into 'dev'

feat(*): 优化布袋监测

See merge request !21
parents 71f58964 74a45541
...@@ -70,7 +70,8 @@ ...@@ -70,7 +70,8 @@
<div class="time-controls"> <div class="time-controls">
<div class="time-desc"> <div class="time-desc">
<span class="icon"></span> <span class="icon"></span>
当前实时信号:{{ currentData.compartNo }}仓 / {{ currentData.row }}</div> 当前实时信号:{{ currentData.compartNo }}仓 / {{ currentData.row }}
</div>
<div> <div>
<el-button @click="navigateBackward"> <el-button @click="navigateBackward">
<el-icon><ArrowLeftBold />向前</el-icon> <el-icon><ArrowLeftBold />向前</el-icon>
...@@ -84,7 +85,6 @@ ...@@ -84,7 +85,6 @@
<el-button @click="reset">重置</el-button> <el-button @click="reset">重置</el-button>
</div> </div>
</div> </div>
<table> <table>
...@@ -99,14 +99,20 @@ ...@@ -99,14 +99,20 @@
<tbody> <tbody>
<tr> <tr>
<td>峰值{{ currentData.row }}排_R</td> <td>峰值{{ currentData.row }}排_R</td>
<td v-for="(value, index) in tableData" :key="'r' + index" :class="{ 'online-style': value.compartNo === currentData.compartNo }"> <td
{{ value.peakValueR || "-" }} v-for="(value, index) in tableData"
:key="'r' + index"
:class="{
'online-style': value.compartNo === currentData.compartNo,
}"
>
{{ value.peakValueR }}
</td> </td>
</tr> </tr>
<tr> <tr>
<td>峰值_H</td> <td>峰值_H</td>
<td v-for="(value, index) in tableData" :key="'h' + index"> <td v-for="(value, index) in tableData" :key="'h' + index">
{{ value.peakValueH || "-" }} {{ value.peakValueH }}
</td> </td>
</tr> </tr>
<tr> <tr>
...@@ -122,13 +128,13 @@ ...@@ -122,13 +128,13 @@
<tr> <tr>
<td>反吹中</td> <td>反吹中</td>
<td v-for="(value, index) in tableData" :key="'b' + index"> <td v-for="(value, index) in tableData" :key="'b' + index">
{{ value.blowBack || "-" }} {{ value.blowBack }}
</td> </td>
</tr> </tr>
<tr> <tr>
<td>谷值</td> <td>谷值</td>
<td v-for="(value, index) in tableData" :key="'v' + index"> <td v-for="(value, index) in tableData" :key="'v' + index">
{{ value.valleyValue || "-" }} {{ value.valleyValue}}
</td> </td>
</tr> </tr>
</tbody> </tbody>
...@@ -245,7 +251,7 @@ const initChartData = () => { ...@@ -245,7 +251,7 @@ const initChartData = () => {
dusterNo: dusterNo.value, dusterNo: dusterNo.value,
deviceNo: selectedDevice.value, deviceNo: selectedDevice.value,
startTime: startTime, startTime: startTime,
endTime: endTime, // endTime: endTime,
}) })
.then((res) => { .then((res) => {
// 将data中的date和realData数据添加到chartData中,要求大数据量下速度快 // 将data中的date和realData数据添加到chartData中,要求大数据量下速度快
...@@ -295,7 +301,7 @@ const updateFunction = () => { ...@@ -295,7 +301,7 @@ const updateFunction = () => {
if (!dusterNo.value || !selectedDevice.value) return; if (!dusterNo.value || !selectedDevice.value) return;
// 从API获取实时数据 // 从API获取实时数据
if (showRealtimeDeviceStatus) {
getMonitorRealtime({ getMonitorRealtime({
dusterNo: dusterNo.value, dusterNo: dusterNo.value,
deviceNo: selectedDevice.value, deviceNo: selectedDevice.value,
...@@ -314,8 +320,8 @@ const updateFunction = () => { ...@@ -314,8 +320,8 @@ const updateFunction = () => {
.catch((err) => { .catch((err) => {
console.error("获取实时数据失败:", err); console.error("获取实时数据失败:", err);
}); });
}
if (showRealtimeDeviceStatus) {
// 结束时间往后推一秒 // 结束时间往后推一秒
let endTime = moment(new Date(currentTime.value)) let endTime = moment(new Date(currentTime.value))
.add(1, "seconds") .add(1, "seconds")
...@@ -342,18 +348,10 @@ const updateFunction = () => { ...@@ -342,18 +348,10 @@ const updateFunction = () => {
updateChart(); updateChart();
} }
}); });
};
// 停止实时更新
const stopRealTimeUpdates = () => {
if (updateTimer) {
clearInterval(updateTimer);
updateTimer = null;
} }
showRealtimeDeviceStatus = false;
}; };
// 向前导航(查看更早的数据) // 向前导航(查看更早的数据)
const navigateBackward = () => { const navigateBackward = () => {
// 不完全关闭轮询,只禁用实时设备状态获取 // 不完全关闭轮询,只禁用实时设备状态获取
...@@ -376,6 +374,7 @@ const navigateBackward = () => { ...@@ -376,6 +374,7 @@ const navigateBackward = () => {
const endTime = new Date(lastTimePoint.getTime() - intervalMs); const endTime = new Date(lastTimePoint.getTime() - intervalMs);
lastTimePoint = endTime; lastTimePoint = endTime;
// 重新生成数据 // 重新生成数据
generateHistoricalData(endTime, interval); generateHistoricalData(endTime, interval);
}; };
...@@ -399,18 +398,18 @@ const navigateForward = () => { ...@@ -399,18 +398,18 @@ const navigateForward = () => {
} }
// 计算新的时间范围 // 计算新的时间范围
const endTime = new Date(lastTimePoint.getTime() + intervalMs); let endTime = new Date(lastTimePoint.getTime() + intervalMs);
// 如果新的结束时间超过当前时间,则切换回实时模式 // // 如果新的结束时间超过当前时间,则切换回实时模式
const now = moment(); const now = moment();
if (endTime > now) { if (endTime > now) {
lastTimePoint = null; lastTimePoint = new Date(now);
showRealtimeDeviceStatus = true; endTime = new Date(now);
return; // // showRealtimeDeviceStatus = true;
} // return;
} else {
lastTimePoint = endTime; lastTimePoint = endTime;
}
// 重新生成数据 // 重新生成数据
generateHistoricalData(endTime, interval); generateHistoricalData(endTime, interval);
}; };
...@@ -435,7 +434,10 @@ const reset = () => { ...@@ -435,7 +434,10 @@ const reset = () => {
// 开启实时更新(重置用) // 开启实时更新(重置用)
const startRealTimeUpdate = () => { const startRealTimeUpdate = () => {
// 确保之前的定时器已清除 // 确保之前的定时器已清除
stopRealTimeUpdates(); if (updateTimer) {
clearInterval(updateTimer);
updateTimer = null;
}
// 启动定时更新 // 启动定时更新
updateTimer = setInterval(() => { updateTimer = setInterval(() => {
updateFunction(); updateFunction();
...@@ -518,7 +520,6 @@ watch(dusterNo, (newVal) => { ...@@ -518,7 +520,6 @@ watch(dusterNo, (newVal) => {
}); });
onMounted(() => { onMounted(() => {
console.log("dusterNo", route);
if (dusterNo.value) { if (dusterNo.value) {
getDeviceList(); getDeviceList();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment