ソースを参照

修复图层分析报错

Hwf 3 週間 前
コミット
9b42d15f9b
2 ファイル変更3 行追加16 行削除
  1. 1 0
      src/utils/olMap/olMap.ts
  2. 2 16
      src/views/globalMap/RightMenu/LayerAnalysis.vue

+ 1 - 0
src/utils/olMap/olMap.ts

@@ -623,6 +623,7 @@ export class olMap {
       }
     };
     const handleTouchMove = (e) => {
+      e.preventDefault(); // 阻止默认滚动
       if (!this.drawing) return;
       this.path.push(e.coordinate);
       // 移除旧的线段

+ 2 - 16
src/views/globalMap/RightMenu/LayerAnalysis.vue

@@ -91,20 +91,6 @@ const getColor = (checked, index) => {
   }
 };
 
-// 得到选中的标签的类型
-const getOption = (data, key = 'dataType') => {
-  if (!data) {
-    return;
-  }
-  let path = [];
-  data.forEach((item) => {
-    if (item.checked) {
-      path.push(item[key]);
-    }
-  });
-  return path.toString();
-};
-
 const handleClickLegend = (item) => {
   item.checked = !item.checked;
   const newSelected = {};
@@ -120,7 +106,7 @@ watch(
     if (!mapStore.pointType || mapStore.pointType.length === 0) {
       return;
     }
-    getCountPointInfo({ option: getOption(mapStore.pointType, 'component') }).then((res) => {
+    getCountPointInfo({ option: mapStore.pointParams.option }).then((res) => {
       res.data.list.forEach((item) => {
         item.checked = true;
       });
@@ -146,7 +132,7 @@ watch(
       return;
     }
     // 各区县
-    getCountPointInfoAreaList({ option: getOption(checkedData) }).then((res) => {
+    getCountPointInfoAreaList({ option: mapStore.pointParams.option }).then((res) => {
       const data = res.data.list;
       if (data.length > 0) {
         // 使用reduce方法合并相同area的num