From cf4ed06dea0076e518319de24c5120bb3fe0dae9 Mon Sep 17 00:00:00 2001 From: guonan <guonan201020@163.com> Date: 星期五, 06 六月 2025 14:41:25 +0800 Subject: [PATCH] 提交 --- src/components/menu/Device.vue | 42 +++++++++++++++++++++++++++++++++--------- 1 files changed, 33 insertions(+), 9 deletions(-) diff --git a/src/components/menu/Device.vue b/src/components/menu/Device.vue index a566a28..3b69b4d 100644 --- a/src/components/menu/Device.vue +++ b/src/components/menu/Device.vue @@ -74,7 +74,7 @@ import { useRoute, onBeforeRouteUpdate } from "vue-router"; import { createPoint, removeEntities } from "@/utils/map"; import { deviceDictList, getDictName } from "@/constant/dict.js"; -import { getDeviceInfo } from "@/api/hpApi"; +import { getDeviceInfoShg, getDeviceInfo } from "@/api/hpApi"; import { initeWaterPrimitiveView } from "@/utils/water"; //鐩告満flyTo鍑芥暟锛屽悗缁璷ptions鍒楄〃涓湁瀵瑰簲缁忕含搴﹀悗寮冪敤 import { useSimStore } from "@/store/simulation"; import { Loading } from "@element-plus/icons-vue"; @@ -87,7 +87,7 @@ try { await getData(); await loadDeviceList(selectValue.value); - initeWaterPrimitiveView(); + // initeWaterPrimitiveView(); } finally { isLoading.value = false; } @@ -124,9 +124,9 @@ removeEntities(item.deviceId); }); }; -const initializeDevicePoints = () => { +const initializeDevicePoints = (val) => { const list = []; - deviceListAll.value.forEach((item, index) => { + val.forEach((item, index) => { // 鏍规嵁闇�姹傚彲澧炲垹 item.type = getDictName(deviceDictList, item.dictDeviceType); item.name = item.deviceName.split(selectValue.value)[1] || item.deviceName; @@ -141,7 +141,7 @@ }; const allDevices = ref([]); const getData = async () => { - const res = await getDeviceInfo(); + const res = await getDeviceInfoShg(); allDevices.value = res.data.pageData; }; // 鏍规嵁鍖哄煙鍚嶇О鍔犺浇璁惧鍒楄〃 @@ -149,14 +149,38 @@ try { isLoading.value = true; handleCleanup(); - // const res = await getDeviceInfo(); + // const res = await getDeviceInfoShg(); // const allDevices = res.data.pageData; const devicesInArea = allDevices.value.filter((item) => item.deviceName?.includes(areaName) ); - deviceListAll.value = devicesInArea; - deviceListAll.length = 0; - initializeDevicePoints(); + // deviceListAll.value = devicesInArea; + getDeviceInfo().then((res) => { + const list = res.data.pageData; + deviceListAll.value = []; + + let index = 0; + const batchSize = 50; // 姣忔澶勭悊鐨勬暟閲� + const delay = 100; // 姣忛殧澶氬皯姣澶勭悊涓�娆� + + const intervalId = setInterval(() => { + // 鍙栧嚭褰撳墠鎵规鐨勬暟鎹� + const batch = list.slice(index, index + batchSize); + + if (batch.length === 0) { + clearInterval(intervalId); // 鏁版嵁澶勭悊瀹屼簡锛屽仠姝㈠畾鏃跺櫒 + return; + } + + // 鎶婂綋鍓嶆壒娆$殑鏁版嵁 push 鍒� deviceListAll + deviceListAll.value = [...deviceListAll.value, ...batch]; + + // 瀵瑰綋鍓嶆壒娆℃墽琛屽垵濮嬪寲鏂规硶 + initializeDevicePoints(batch); + + index += batchSize; + }, delay); + }); } catch (error) { console.error("鍔犺浇璁惧淇℃伅澶辫触", error); } finally { -- Gitblit v1.9.3