소스 검색

优化感知信息实时展示查询

zengy 4 일 전
부모
커밋
f5aab1bf87
2개의 변경된 파일과 19개의 추가작업 그리고 15개의 파일을 삭제
  1. 18 14
      src/views/subSystem/pipeNetwork/pinteControl/realTimeShow.vue
  2. 1 1
      src/views/subSystem/pipeNetwork/pinteControl/remoteControl.vue

+ 18 - 14
src/views/subSystem/pipeNetwork/pinteControl/realTimeShow.vue

@@ -7,7 +7,7 @@
         <div class="card-head">
           <div class="card-title">
             设备状态总览
-            <span class="title-sub">按片区聚合 · 设备点阵(3s 刷新)</span>
+            <span class="title-sub">按片区聚合 · 设备点阵</span>
           </div>
           <div class="row gap8 wrap">
             <el-input
@@ -18,6 +18,7 @@
               @keyup.enter="locateDevice"
             />
             <el-button type="primary" :loading="locateLoading" @click="locateDevice">定位</el-button>
+            <el-button type="primary" plain size="small" :icon="Refresh" :loading="refreshing" @click="refreshAll">刷新</el-button>
           </div>
         </div>
 
@@ -257,7 +258,8 @@
 </template>
 
 <script setup>
-import { computed, onBeforeUnmount, onMounted, reactive, ref } from "vue";
+import { computed, onMounted, reactive, ref } from "vue";
+import { Refresh } from "@element-plus/icons-vue";
 import { getEquipmentStatusStatistics, listEquipmentTypeAll } from "@/api/pipeNetwork/pdeviceInform";
 import {
   pagePerceptionEquipment,
@@ -270,6 +272,7 @@ import { buildMinioAttachmentUrl } from "@/utils/minioAttachment";
 import { indicatorName, loadIndicatorNames } from "@/utils/warningIndicator";
 
 const loading = ref(false);
+const refreshing = ref(false);
 const stats = ref({});
 const equipmentList = ref([]);
 const total = ref(0);
@@ -295,7 +298,6 @@ const profileOpen = ref(false);
 const profileLoading = ref(false);
 const profile = ref({ base: null, records: [], indicators: [], origCollTable: "", recordView: { columns: [], rows: [] } });
 const currentProfileId = ref("");
-let refreshTimer = null;
 
 const districtOptions = [
   { value: 0, label: "城南" },
@@ -525,12 +527,19 @@ function refreshProfile() {
   loadProfile(currentProfileId.value);
 }
 
-function refreshAll() {
-  loadStatistics();
-  loadEquipment();
-  loadAreaRank();
-  loadAlarmTypeDist();
-  loadAlarms();
+async function refreshAll() {
+  refreshing.value = true;
+  try {
+    await Promise.allSettled([
+      loadStatistics(),
+      loadEquipment(),
+      loadAreaRank(),
+      loadAlarmTypeDist(),
+      loadAlarms()
+    ]);
+  } finally {
+    refreshing.value = false;
+  }
 }
 
 function loadTypeOptions() {
@@ -543,11 +552,6 @@ onMounted(() => {
   loadIndicatorNames();
   loadTypeOptions();
   refreshAll();
-  refreshTimer = setInterval(refreshAll, 3000);
-});
-
-onBeforeUnmount(() => {
-  if (refreshTimer) clearInterval(refreshTimer);
 });
 </script>
 

+ 1 - 1
src/views/subSystem/pipeNetwork/pinteControl/remoteControl.vue

@@ -22,7 +22,7 @@
       <div class="alarm-toolbar">
         <h3>终端设备列表</h3>
         <span class="toolbar-right">
-          <el-button type="primary" plain size="small" :loading="loading" @click="loadList">刷新状态</el-button>
+          <el-button type="primary" plain size="small" :loading="loading" @click="loadList">刷新</el-button>
         </span>
       </div>
       <el-table v-loading="loading" :data="list" border stripe size="small" :header-cell-style="{ background: '#f5f7fa', color: '#606266' }">