瀏覽代碼

feat:优化高亮样式代码

wangsisi 4 月之前
父節點
當前提交
884373a6b3
共有 1 個文件被更改,包括 10 次插入17 次删除
  1. 10 17
      src/views/authentic/authenticMap.js

+ 10 - 17
src/views/authentic/authenticMap.js

@@ -309,23 +309,16 @@ class AuthenticMap {
             ElMessage.warning("编辑中")
           }else{
             ElMessage.success("已选择该点位")
-            const features = f
-            //代码可优化,明天优化
-              if(mapData.selectPointArr.length>0){
-                if(features.get("id")===mapData.selectPointArr[0].get("id")){
-                    const list = features.getGeometry().getCoordinates();
-                    const arr = list[0][0].find(subArray => subArray.includes(coordinates))
-                    that.selectPointLayer.source.clear();
-                    let point = new Feature(new Point(arr));
-                    that.selectPointLayer.addFeature(point);
-                  }
-              }else{
-                const list = mapData.point.getGeometry().getCoordinates();
-                    const arr = list[0][0].find(subArray => subArray.includes(coordinates))
-                    that.selectPointLayer.source.clear();
-                    let point = new Feature(new Point(arr));
-                    that.selectPointLayer.addFeature(point);
-              }
+            let list 
+            if(mapData.selectPointArr.length>0){
+              list = f.getGeometry().getCoordinates();
+            }else{
+              list = mapData.point.getGeometry().getCoordinates();
+            }
+            const arr = list[0][0].find(subArray => subArray.includes(coordinates))
+            that.selectPointLayer.source.clear();
+            let point = new Feature(new Point(arr));
+            that.selectPointLayer.addFeature(point);
             mapData.selectPoint = coordinates
           }
         }