Browse Source

我的标记名称勾选; 综合分析未勾选时清除所有图层数据

Bella 2 năm trước cách đây
mục cha
commit
6893f243ff

+ 2 - 18
src/components/map/MapHolder.vue

@@ -713,27 +713,11 @@ export default {
       uniqueIdList.push(singlePolygonItem);
       this.$store.state.selectSelectDataMap["singlePolygon"][uniqueId] =
         uniqueIdList;
-      let coordinates = "";
       // 当前数据坐标系为WGS84
       let targetGeometry = JSON.parse(geometry).geometry;
       // 预设模型与所有图层层级不同
-
-      if (targetGeometry.type === "Polygon") {
-        let coord = targetGeometry.coordinates[0];
-        coordinates = publicFun.latLngsToReverse(coord);
-        // coordinates = coord.map((v) => {
-        //   return [v[1], v[0]];
-        // });
-      }
-
-      if (targetGeometry.type === "MultiPolygon") {
-        debugger;
-        let coord = targetGeometry.coordinates[0][0];
-        coordinates = publicFun.latLngsToReverse(coord);
-      }
-
-      console.log(coordinates, "222");
-      // x,y转换
+      let coord = targetGeometry.coordinates;
+      let coordinates = publicFun.latLngsToReverse(coord);
       let polygon = L.polygon(coordinates, {
         color: color,
         weight: 3,

+ 12 - 0
src/utils/publicFunction.js

@@ -72,6 +72,18 @@ const getRandomColor = function () {
   return "#" + rgb.join("");
 };
 
+const getRGBColor = () => {
+  let rgb = [];
+
+  for (let i = 0; i < 2; ++i) {
+    let color = Math.floor(Math.random() * 256);
+
+    rgb.push(color);
+  }
+
+  return `rgb(${rgb[0]},${rgb[1]},1)`;
+};
+
 /**
  * 获取geoJSON格式的数据 -- 目前仅供标记疑点相关内容使用(圆也存为面);
  *

+ 62 - 60
src/views/ComprehensiveAnalysis.vue

@@ -229,11 +229,11 @@
 
                 <div
                   class="panel-list-item"
-                  v-for="item in rightLabelData"
+                  v-for="(item, index) in rightLabelData"
                   :key="item.id"
                 >
                   <div @click="listItemClick('new', item)">
-                    {{ item.name }}
+                    {{ item.name ? item.name : `疑点${index}` }}
                   </div>
                   <span class="operation-icon"
                     ><el-button
@@ -682,7 +682,6 @@ export default {
         );
       }
     },
-    getMapData() {},
     /**
      * 获取图层信息 -- 所有模型和预设模型
      * @columnId
@@ -716,7 +715,7 @@ export default {
         layerParams = {
           columnId: columnId,
           states: "0,1,2,3",
-          pageSize: 10000,
+          pageSize: 500,
           page: 0,
         };
 
@@ -833,14 +832,14 @@ export default {
               }
 
               this.currentTotal += this.originalDataMap.get(uniqueId).length;
-              console.log(
-                "target",
-                this.currentPageSize,
-                columnId,
-                id,
-                mainType,
-                sourceType
-              );
+              // console.log(
+              //   "target",
+              //   this.currentPageSize,
+              //   columnId,
+              //   id,
+              //   mainType,
+              //   sourceType
+              // );
             }
           },
           (error) => {
@@ -851,48 +850,48 @@ export default {
       }
 
       // 图层已初始化
-      if (
-        map2DViewer.analysisGroups[uniqueId] &&
-        !map2DViewer.map.hasLayer(map2DViewer.analysisGroups[uniqueId])
-      ) {
-        map2DViewer.map.addLayer(map2DViewer.analysisGroups[uniqueId]);
-
-        if (mainType === "所有图层") {
-          this.originalData[uniqueId] = [];
-          // 激活当前展开面板
-          this.activeNames = ["myLabel", uniqueId];
-          // 已经请求过接口无需二次请求
-          if (this.originalDataMap.get(uniqueId).length > 0) {
-            this.originalData[uniqueId] = this.originalDataMap
-              .get(uniqueId)
-              .map((ele) => {
-                return {
-                  id: ele.id,
-                  column_name: ele.column_name,
-                  // 是否疑点
-                  c_boolean: ele.c_boolean ? "是" : "否",
-                  // 行政区划
-                  c_xzqh: ele.c_xzqh,
-                  // 空间信息
-                  c_content: ele.c_content,
-                  // 疑点修改时间
-                  c_date_time: ele.c_date_time,
-                  // 修改人员名称
-                  // c_editor_name: ele.c_editor_name,
-                  // 标题
-                  title: ele.title,
-                  column_id: ele.column_id,
-                  content: ele.content,
-                  secret_level: ele.secret_level,
-                };
-              });
-          }
-        }
+      // if (
+      //   map2DViewer.analysisGroups[uniqueId] &&
+      //   !map2DViewer.map.hasLayer(map2DViewer.analysisGroups[uniqueId])
+      // ) {
+      //   map2DViewer.map.addLayer(map2DViewer.analysisGroups[uniqueId]);
+
+      //   if (mainType === "所有图层") {
+      //     this.originalData[uniqueId] = [];
+      //     // 激活当前展开面板
+      //     this.activeNames = ["myLabel", uniqueId];
+      //     // 已经请求过接口无需二次请求
+      //     if (this.originalDataMap.get(uniqueId).length > 0) {
+      //       this.originalData[uniqueId] = this.originalDataMap
+      //         .get(uniqueId)
+      //         .map((ele) => {
+      //           return {
+      //             id: ele.id,
+      //             column_name: ele.column_name,
+      //             // 是否疑点
+      //             c_boolean: ele.c_boolean ? "是" : "否",
+      //             // 行政区划
+      //             c_xzqh: ele.c_xzqh,
+      //             // 空间信息
+      //             c_content: ele.c_content,
+      //             // 疑点修改时间
+      //             c_date_time: ele.c_date_time,
+      //             // 修改人员名称
+      //             // c_editor_name: ele.c_editor_name,
+      //             // 标题
+      //             title: ele.title,
+      //             column_id: ele.column_id,
+      //             content: ele.content,
+      //             secret_level: ele.secret_level,
+      //           };
+      //         });
+      //     }
+      //   }
 
-        if (this.originalDataMap.get(uniqueId).length > 0) {
-          this.currentTotal += this.originalDataMap.get(uniqueId).length;
-        }
-      }
+      //   if (this.originalDataMap.get(uniqueId).length > 0) {
+      //     this.currentTotal += this.originalDataMap.get(uniqueId).length;
+      //   }
+      // }
     },
     /**
      * 切换页时改变图层数据
@@ -1265,6 +1264,7 @@ export default {
 
     // 节点change事件
     handleCheckChange(data, checked) {
+      debugger;
       if (data.mainType && data.mainType !== "我的模型") {
         if (checked) {
           this.showRightBox = true;
@@ -1405,6 +1405,11 @@ export default {
           this.$store.state.mapMethodsCollection
             .get("RENDER")
             .deleteGroupFromMap(data.id);
+
+          // 移除图层id
+          if (map2DViewer.analysisGroups[data.id]) {
+            delete map2DViewer.analysisGroups[data.id];
+          }
         }
       }
 
@@ -1496,9 +1501,6 @@ export default {
                       data.mainType,
                       ""
                     );
-                  // let legendTitle = this.legendTitle.push({});
-                  // map2DViewer.analysisGroups[uniqueId] = L.featureGroup();
-                  // map2DViewer.analysisGroups[uniqueId].addTo(map2DViewer.map);
                 });
               }
             }
@@ -1506,10 +1508,10 @@ export default {
         }
       }
 
-      if (map2DViewer.analysisGroups[uniqueId]) {
-        // 直接显示移除掉的图层
-        map2DViewer.map.addLayer(map2DViewer.analysisGroups[uniqueId]);
-      }
+      // if (map2DViewer.analysisGroups[uniqueId]) {
+      //   // 直接显示移除掉的图层
+      //   map2DViewer.map.addLayer(map2DViewer.analysisGroups[uniqueId]);
+      // }
     },
     readGeojson(geojson, uniqueId) {
       debugger;