From 3e99132ad7b7c92f5a262010fe7bb32a77698832 Mon Sep 17 00:00:00 2001 From: yarnom Date: Fri, 4 Jul 2025 21:56:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device-overview-module/device-markers.js | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/sec-beidou/src/main/resources/static/js/device-overview-module/device-markers.js b/sec-beidou/src/main/resources/static/js/device-overview-module/device-markers.js index e3e17f98..436c17bc 100644 --- a/sec-beidou/src/main/resources/static/js/device-overview-module/device-markers.js +++ b/sec-beidou/src/main/resources/static/js/device-overview-module/device-markers.js @@ -209,13 +209,35 @@ var DeviceMarkers = (function() { } function findDeviceById(deviceId) { + // console.log('搜索设备:', deviceId, '(类型:', typeof deviceId, ')'); + // console.log('当前设备总数:', allFeatures.length); + + var searchTerm = String(deviceId).trim(); + for (var i = 0; i < allFeatures.length; i++) { var feature = allFeatures[i]; var deviceInfo = feature.get('deviceInfo'); - if (deviceInfo && deviceInfo.deviceid === deviceId) { - return feature; + if (deviceInfo) { + var currentDeviceId = String(deviceInfo.deviceid); + // console.log('检查设备:', currentDeviceId, '(类型:', typeof deviceInfo.deviceid, ')'); + + if (currentDeviceId === searchTerm) { + // console.log('精确匹配找到设备:', currentDeviceId); + return feature; + } + + if (currentDeviceId.indexOf(searchTerm) !== -1) { + // console.log('部分匹配找到设备:', currentDeviceId); + return feature; + } + + if (currentDeviceId.replace(/\s+/g, '') === searchTerm.replace(/\s+/g, '')) { + // console.log('去除空格后匹配找到设备:', currentDeviceId); + return feature; + } } } + console.log('未找到设备:', deviceId); return null; } @@ -230,7 +252,9 @@ var DeviceMarkers = (function() { zoom: Math.max(map.getView().getZoom(), 15), duration: 1000 }); + return true; } + return false; } /**