From 7909450b6142fd10c55690c5ce093137247310ef Mon Sep 17 00:00:00 2001
From: guonan <guonan201020@163.com>
Date: 星期五, 06 六月 2025 17:27:10 +0800
Subject: [PATCH] 隐患点优化

---
 src/components/menu/Device.vue |   48 +++++++++++++++++++++++++-----------------------
 1 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/src/components/menu/Device.vue b/src/components/menu/Device.vue
index 3b69b4d..5edadbe 100644
--- a/src/components/menu/Device.vue
+++ b/src/components/menu/Device.vue
@@ -124,9 +124,11 @@
     removeEntities(item.deviceId);
   });
 };
-const initializeDevicePoints = (val) => {
+// const initializeDevicePoints = (val) => {
+const initializeDevicePoints = () => {
   const list = [];
-  val.forEach((item, index) => {
+  // val.forEach((item, index) => {
+  deviceListAll.value.forEach((item, index) => {
     // 鏍规嵁闇�姹傚彲澧炲垹
     item.type = getDictName(deviceDictList, item.dictDeviceType);
     item.name = item.deviceName.split(selectValue.value)[1] || item.deviceName;
@@ -154,33 +156,33 @@
     const devicesInArea = allDevices.value.filter((item) =>
       item.deviceName?.includes(areaName)
     );
-    // deviceListAll.value = devicesInArea;
-    getDeviceInfo().then((res) => {
-      const list = res.data.pageData;
-      deviceListAll.value = [];
+    deviceListAll.value = devicesInArea;
+    // getDeviceInfo().then((res) => {
+    //   const list = res.data.pageData;
+    //   deviceListAll.value = [];
 
-      let index = 0;
-      const batchSize = 50; // 姣忔澶勭悊鐨勬暟閲�
-      const delay = 100; // 姣忛殧澶氬皯姣澶勭悊涓�娆�
+    //   let index = 0;
+    //   const batchSize = 50; // 姣忔澶勭悊鐨勬暟閲�
+    //   const delay = 100; // 姣忛殧澶氬皯姣澶勭悊涓�娆�
 
-      const intervalId = setInterval(() => {
-        // 鍙栧嚭褰撳墠鎵规鐨勬暟鎹�
-        const batch = list.slice(index, index + batchSize);
+    //   const intervalId = setInterval(() => {
+    //     // 鍙栧嚭褰撳墠鎵规鐨勬暟鎹�
+    //     const batch = list.slice(index, index + batchSize);
 
-        if (batch.length === 0) {
-          clearInterval(intervalId); // 鏁版嵁澶勭悊瀹屼簡锛屽仠姝㈠畾鏃跺櫒
-          return;
-        }
+    //     if (batch.length === 0) {
+    //       clearInterval(intervalId); // 鏁版嵁澶勭悊瀹屼簡锛屽仠姝㈠畾鏃跺櫒
+    //       return;
+    //     }
 
-        // 鎶婂綋鍓嶆壒娆$殑鏁版嵁 push 鍒� deviceListAll
-        deviceListAll.value = [...deviceListAll.value, ...batch];
+    //     // 鎶婂綋鍓嶆壒娆$殑鏁版嵁 push 鍒� deviceListAll
+    //     deviceListAll.value = [...deviceListAll.value, ...batch];
 
-        // 瀵瑰綋鍓嶆壒娆℃墽琛屽垵濮嬪寲鏂规硶
-        initializeDevicePoints(batch);
+    //     // 瀵瑰綋鍓嶆壒娆℃墽琛屽垵濮嬪寲鏂规硶
+    //     initializeDevicePoints(batch);
 
-        index += batchSize;
-      }, delay);
-    });
+    //     index += batchSize;
+    //   }, delay);
+    // });
   } catch (error) {
     console.error("鍔犺浇璁惧淇℃伅澶辫触", error);
   } finally {

--
Gitblit v1.9.3