Răsfoiți Sursa

宝石蓝底图; 底图切换图片

Bella 2 ani în urmă
părinte
comite
9c2e4d1454

+ 40 - 6
public/static/config/config.js

@@ -6,9 +6,9 @@
  */
 var systemConfig = {
   // 经度偏移矫正值 -- WGS84转上海2000
-  lonCorrectParams:0.1920,
+  lonCorrectParams: 0.192,
   // 纬度偏移校正值 -- WGS84转上海2000
-  latCorrectParams:-0.00018,
+  latCorrectParams: -0.00018,
   assetsUrl: "http://localhost:2013",
   mapViewer: {
     center: [31.14785322514787, 121.50195320451814],
@@ -17,11 +17,45 @@ var systemConfig = {
   // 暂时无法使用
   // token: "65463DEE-620A-0ED5-2385-17ECD07CD351", //公共地图资源token
   // mapService: "http://121.43.55.7:10011/proxy/", //地图服务,
-  blueBlackMap:
-    "http://aimap.pudong.sh:5236/zjmap/reproduction-service/maps/rest/services/sat-2018s2/proxy?AccessKey=lUaEMxqqhZKLSImGuP/Ergx47orYVyIqHVgxfyGpIurKAy9kdq5uU1cWuTuIXeOM",
-  imageryLayer:
-    "http://aimap.pudong.sh:5236/zjmap/reproduction-service/maps/rest/services/sat-2019s2/proxy?AccessKey=lUaEMxqqhZKLSImGuP/Ergx47orYVyIqHVgxfyGpIurKAy9kdq5uU1cWuTuIXeOM",
+  blueBlackMap: {
+    crs: "",
+    url: "http://aimap.pudong.sh:5236/zjmap/reproduction-service/maps/rest/services/basemap-shanghai-gem-blue-sh2000/mapserver?AccessKey=lUaEMxqqhZKLSImGuP/Ergx47orYVyIqHVgxfyGpIurKAy9kdq5uU1cWuTuIXeOM",
+    resolutions: [
+      529.1666666666666, 264.5833333333333, 132.29166666666666,
+      52.916666666666664, 26.458333333333332, 13.229166666666666,
+      5.291666666666666, 2.645833333333333, 1.3229166666666665,
+      0.5291666666666666, 0.2645833333333333, 0.13229166666666664,
+    ],
+    minZoom: 1,
+    maxZoom: 12,
+  },
+  // 遥感影像图的相关配置项
+  imageryLayer: {
+    crs: "",
+    url: "http://aimap.pudong.sh:5236/zjmap/reproduction-service/maps/rest/services/sat-2019s1/proxy?AccessKey=lUaEMxqqhZKLSImGuP/Ergx47orYVyIqHVgxfyGpIurKAy9kdq5uU1cWuTuIXeOM",
+    resolutions: [
+      132.2919312505292, 52.91677250021167, 26.458386250105836,
+      13.229193125052918, 5.291677250021167, 2.6458386250105836,
+      1.3229193125052918, 0.5291677250021167, 0.26458386250105836,
+      0.13229193125052918,
+    ],
+    minZoom: 0,
+    maxZoom: 7,
+  },
+  imageryLayerSat2018s2: {
+    crs: "",
+    url: "http://aimap.pudong.sh:5236/zjmap/reproduction-service/maps/rest/services/sat-2018s2/proxy?AccessKey=lUaEMxqqhZKLSImGuP/Ergx47orYVyIqHVgxfyGpIurKAy9kdq5uU1cWuTuIXeOM",
+    resolutions: [
+      132.2919312505292, 52.91677250021167, 26.458386250105836,
+      13.229193125052918, 5.291677250021167, 2.6458386250105836,
+      1.3229193125052918, 0.5291677250021167, 0.26458386250105836,
+      0.13229193125052918,
+    ],
+    minZoom: 0,
+    maxZoom: 7,
+  },
 };
+
 //地图全局变量声明
 var map2DViewer = {
   markers: {},

BIN
src/assets/map/01_.png


BIN
src/assets/map/02_.png


BIN
src/assets/map/03_.png


BIN
src/assets/map/26451f5681216ee835e9463f62d904f.png


BIN
src/assets/map/darkmap.png


BIN
src/assets/map/sat2018.png


BIN
src/assets/map/sat2019.png


+ 46 - 25
src/components/map/BasemapChange.vue

@@ -5,7 +5,7 @@
       class="map-change"
       :style="{
         right: `${rightPosition}%`,
-        bottom: `${bottomPostion}px`
+        bottom: `${bottomPostion}px`,
       }"
       @mouseover="mouseover"
       @mouseleave="mouseleave"
@@ -19,7 +19,7 @@
         :class="{ active: index === 0 }"
         :style="{
           right: `${index * state.rightPX}px`,
-          'z-index': 99 - index
+          'z-index': 99 - index,
         }"
         @click="change(index, item.type)"
       />
@@ -40,32 +40,31 @@ export default {
         SE: require("@/assets/map/03.png"),
         // 街道底图
         JD: require("@/assets/map/01.png"),
-
-        // 遥感地图
-        DXA: require("@/assets/map/02_.png"),
-        // 深色地图
-        SEA: require("@/assets/map/03_.png"),
-        // 街道底图
-        JDA: require("@/assets/map/01_.png")
       },
       state: {
         // 图片数组
         images: [
           {
-            src: require("@/assets/map/03.png"),
+            src: require("@/assets/map/darkmap.png"),
             type: 1,
             active: "SEA",
-            defalut: "SE"
+            defalut: "SE",
           },
           {
-            src: require("@/assets/map/02.png"),
+            src: require("@/assets/map/sat2019.png"),
             type: 0,
             active: "DXA",
-            defalut: "DX"
-          }
+            defalut: "DX",
+          },
+          {
+            src: require("@/assets/map/sat2018.png"),
+            type: 2,
+            active: "DXA1",
+            defalut: "DX1",
+          },
         ],
-        rightPX: 50 // 每张图片距离右侧的距离 * index
-      }
+        rightPX: 50, // 每张图片距离右侧的距离 * index
+      },
     };
   },
   computed: {
@@ -77,14 +76,14 @@ export default {
     },
     baseMapType() {
       return this.$store.state.baseMapType;
-    }
+    },
   },
   watch: {
     baseMapRight: {
       handler(val) {
         this.rightPosition = val;
       },
-      immediate: true
+      immediate: true,
     },
     menuChange: {
       handler(val) {
@@ -97,11 +96,11 @@ export default {
         }
       },
       deep: true,
-      immediate: true
+      immediate: true,
     },
     baseMapType(val) {
       // console.log(val, "地图类型");
-    }
+    },
   },
   methods: {
     change(index, type) {
@@ -115,22 +114,44 @@ export default {
     },
     // 设置图层显示
     setLayer(type) {
-      // 当前的底图类型 0 - 影像图; 1 - 蓝黑图
+      // 当前的底图类型 0 - imagery; 1 - 蓝黑图; 2 - imagery2
       switch (type) {
         case 0:
           // console.log("影像图");
           if (!map2DViewer.map.hasLayer(map2DViewer.layers["imagery"])) {
-            map2DViewer.map.removeLayer(map2DViewer.layers["darkmap"]);
+            map2DViewer.map.options.crs = systemConfig.imageryLayer.crs;
+            map2DViewer.map.options.minZoom = systemConfig.imageryLayer.minZoom;
+            map2DViewer.map.options.maxZoom = systemConfig.imageryLayer.maxZoom;
+            map2DViewer.map.hasLayer(map2DViewer.layers["darkmap"]) &&
+              map2DViewer.map.removeLayer(map2DViewer.layers["darkmap"]);
+            map2DViewer.map.hasLayer(map2DViewer.layers["imagery2"]) &&
+              map2DViewer.map.removeLayer(map2DViewer.layers["imagery2"]);
             map2DViewer.map.addLayer(map2DViewer.layers["imagery"]);
           }
           break;
         case 1:
           // console.log("蓝黑图");
           if (!map2DViewer.map.hasLayer(map2DViewer.layers["darkmap"])) {
-            map2DViewer.map.removeLayer(map2DViewer.layers["imagery"]);
+            map2DViewer.map.options.crs = systemConfig.blueBlackMap.crs;
+            map2DViewer.map.options.minZoom = systemConfig.blueBlackMap.minZoom;
+            map2DViewer.map.options.maxZoom = systemConfig.blueBlackMap.maxZoom;
+            map2DViewer.map.hasLayer(map2DViewer.layers["imagery"]) &&
+              map2DViewer.map.removeLayer(map2DViewer.layers["imagery"]);
+            map2DViewer.map.hasLayer(map2DViewer.layers["imagery2"]) &&
+              map2DViewer.map.removeLayer(map2DViewer.layers["imagery2"]);
             map2DViewer.map.addLayer(map2DViewer.layers["darkmap"]);
           }
           break;
+        case 2:
+          if (!map2DViewer.map.hasLayer(map2DViewer.layers["imagery2"])) {
+            map2DViewer.map.options.crs = systemConfig.imageryLayer.crs;
+            map2DViewer.map.options.minZoom = systemConfig.imageryLayer.minZoom;
+            map2DViewer.map.options.maxZoom = systemConfig.imageryLayer.maxZoom;
+            map2DViewer.map.hasLayer(map2DViewer.layers["darkmap"]) &&
+              map2DViewer.map.removeLayer(map2DViewer.layers["darkmap"]);
+            map2DViewer.map.hasLayer(map2DViewer.layers["imagery"]) &&
+              map2DViewer.map.removeLayer(map2DViewer.layers["imagery"]);
+          }
       }
 
       // 调用全局事件总线中的指定事件
@@ -142,8 +163,8 @@ export default {
     },
     mouseleave() {
       this.state.rightPX = 50;
-    }
-  }
+    },
+  },
 };
 </script>
 <style lang="less" scoped>

+ 149 - 89
src/components/map/MapHolder.vue

@@ -1,9 +1,17 @@
 <template>
   <div id="map2DViewer">
     <!-- 特殊地图属性弹窗 -- 有审计功能 -->
-    <CaseAuditPopup v-show="auditPopupShow" :tableObj="auditRefTableObj" ref="auditRef" />
+    <CaseAuditPopup
+      v-show="auditPopupShow"
+      :tableObj="auditRefTableObj"
+      ref="auditRef"
+    />
     <!-- 通用地图属性弹窗 -- 无审计功能 -->
-    <NormalAttrPopup v-show="normalAttrPopupShow" :tableObj="tableObj" ref="normalRef" />
+    <NormalAttrPopup
+      v-show="normalAttrPopupShow"
+      :tableObj="tableObj"
+      ref="normalRef"
+    />
     <LabelCasePopup v-show="labelDetailsPopupShow" ref="labelRef" />
     <BasemapChange />
   </div>
@@ -25,7 +33,7 @@ export default {
     CaseAuditPopup,
     NormalAttrPopup,
     LabelCasePopup,
-    BasemapChange
+    BasemapChange,
   },
   data() {
     return {
@@ -51,14 +59,14 @@ export default {
         镇域名称: "--",
         面积: "--",
         土地类型: "--",
-        图斑编号: "--"
+        图斑编号: "--",
       },
       auditRefTableObj: {
         镇域名称: "--",
         面积: "--",
         图层构成: "--",
-        性质: "--"
-      }
+        性质: "--",
+      },
     };
   },
   created() {},
@@ -89,7 +97,7 @@ export default {
       deleteSinglePolygon: this.deleteSinglePolygon,
       deleteGroupFromMap: this.deleteGroupFromMap,
       drawGeometry: this.drawGeometry,
-      deleteGeometry: this.deleteGeometry
+      deleteGeometry: this.deleteGeometry,
     });
   },
   beforeDestroyed() {
@@ -110,7 +118,7 @@ export default {
     // 监听当前菜单
     getCurrentMenu() {
       return this.$store.state.navSelect;
-    }
+    },
   },
   watch: {
     getLabelCaseBtnStatus(val) {
@@ -153,9 +161,9 @@ export default {
         this.$nextTick(() => {
           this.getJSonData();
         });
-      }
+      },
       // immediate: true
-    }
+    },
   },
   methods: {
     // 开始标记疑点事件
@@ -166,7 +174,7 @@ export default {
     stopLabelCase() {
       if (map2DViewer.measureTool) {
         map2DViewer.setDrawTool({
-          action: "remove"
+          action: "remove",
         });
       }
     },
@@ -197,13 +205,13 @@ export default {
             if ($(`#${str}_id a`)) {
               $(`#${str}_id a`)
                 .eq(0)
-                .click(e => {
+                .click((e) => {
                   this.$store.state.lawPopupShow = true;
                   this.$store.state.lawSourceType = sourceType;
                 });
               $(`#${str}_id a`)
                 .eq(1)
-                .click(e => {
+                .click((e) => {
                   // 触发综合分析右侧面板点击事件
                   this.$bus.$emit("viewDetailsPopup", geojsonData);
                 });
@@ -256,7 +264,9 @@ export default {
           // 下拉框内容
           if ($(`#${str}_id .center-table-item-special select`)) {
             if (this.caseStatusMap.has(str)) {
-              $(`#${str}_id .center-table-item-special select`).val(this.caseStatusMap.get(str));
+              $(`#${str}_id .center-table-item-special select`).val(
+                this.caseStatusMap.get(str)
+              );
             }
           }
 
@@ -264,13 +274,13 @@ export default {
           if ($(`#${str}_id a`)) {
             $(`#${str}_id a`)
               .eq(0)
-              .click(e => {
+              .click((e) => {
                 this.$store.state.lawPopupShow = true;
                 this.$store.state.lawSourceType = sourceType;
               });
             $(`#${str}_id a`)
               .eq(1)
-              .click(e => {
+              .click((e) => {
                 // 触发综合分析右侧面板点击事件
 
                 this.$bus.$emit("viewDetailsPopup", geojsonData);
@@ -278,7 +288,7 @@ export default {
           }
           // input添加点击事件
           if ($(`#${str}_id input`)[1]) {
-            $(`#${str}_id input`).click(e => {
+            $(`#${str}_id input`).click((e) => {
               switch (e.target.defaultValue) {
                 case "取消":
                   this.cancelBtnEvent();
@@ -314,7 +324,7 @@ export default {
           console.log($(`#${str}_id textarea`).val(), "textarea");
           $(`#${str}_id`).css("height", "100%");
 
-          $(`#${str}_id input`).click(e => {
+          $(`#${str}_id input`).click((e) => {
             console.log(e.target.defaultValue);
             switch (e.target.defaultValue) {
               case "取消":
@@ -343,20 +353,22 @@ export default {
         // 修改人员名称
         c_editor_name: localStorage.getItem("USER_NAME"),
         // 修改人员ID
-        c_editorid: localStorage.getItem("USER_ID")
+        c_editorid: localStorage.getItem("USER_ID"),
       };
       let modifyParams = new FormData();
       modifyParams = {
         columnId: 510,
         modelId: 118,
-        content: JSON.stringify(obj)
+        content: JSON.stringify(obj),
       };
-      this.$Post(this.urlsCollection.updateContent, modifyParams).then(res => {
-        if (res.code === 200) {
-          this.$message.success("数据修改成功");
-          map2DViewer.map.closePopup();
+      this.$Post(this.urlsCollection.updateContent, modifyParams).then(
+        (res) => {
+          if (res.code === 200) {
+            this.$message.success("数据修改成功");
+            map2DViewer.map.closePopup();
+          }
         }
-      });
+      );
     },
     cancelBtnEvent() {
       map2DViewer.map.closePopup();
@@ -381,7 +393,13 @@ export default {
         } else {
           geoName = $(`#${str}_id input`).eq(0).val();
           let coordinates = [data.points];
-          let geometry = publicFun.generateGeoJSON(title, des, geoType, coordinates, geoName);
+          let geometry = publicFun.generateGeoJSON(
+            title,
+            des,
+            geoType,
+            coordinates,
+            geoName
+          );
           let params = new FormData();
           let newGeojson = JSON.stringify(geometry);
           myLabelNameMap.set(geoName, newGeojson);
@@ -389,11 +407,11 @@ export default {
             geojson: newGeojson,
             type: geoType,
             userId: Number(localStorage.getItem("USER_ID")),
-            sourceId: 0
+            sourceId: 0,
           };
 
           this.$Post(this.urlsCollection.addConllection, params).then(
-            res => {
+            (res) => {
               if (res.code == 200) {
                 // 标记成功后删除保存的原有名称
                 myLabelNameMap.delete(geoName);
@@ -403,33 +421,36 @@ export default {
                 paramData = {
                   userId: Number(localStorage.getItem("USER_ID")),
                   sourceId: 0,
-                  pageSize: 10
+                  pageSize: 10,
                 };
                 // 暂存map中刚刚保存的数据
-                this.$Post(this.urlsCollection.selectByUser, paramData).then(userRes => {
-                  if (userRes.code === 200) {
-                    if (userRes.content.length > 0) {
-                      this.$store.state.myLabelPointsArr = [];
-                      this.$store.state.myLabelPointsArr = userRes.content.map(v => {
-                        if (JSON.stringify(geometry) === v.geojson) {
-                          sessionStorage.setItem("myLabelPointsId", v.id);
-                        }
-                        return {
-                          id: v.id,
-                          geojson: v.geojson,
-                          type: v.type
-                        };
-                      });
-                      // 判断刚刚暂存的数据,并调用小眼睛的方法
+                this.$Post(this.urlsCollection.selectByUser, paramData).then(
+                  (userRes) => {
+                    if (userRes.code === 200) {
+                      if (userRes.content.length > 0) {
+                        this.$store.state.myLabelPointsArr = [];
+                        this.$store.state.myLabelPointsArr =
+                          userRes.content.map((v) => {
+                            if (JSON.stringify(geometry) === v.geojson) {
+                              sessionStorage.setItem("myLabelPointsId", v.id);
+                            }
+                            return {
+                              id: v.id,
+                              geojson: v.geojson,
+                              type: v.type,
+                            };
+                          });
+                        // 判断刚刚暂存的数据,并调用小眼睛的方法
+                      }
                     }
+                    // 更新时调用一次搜索接口
                   }
-                  // 更新时调用一次搜索接口
-                });
+                );
               }
               // 保存后需要删除地图上的标记
               this.reStartLabelCase();
             },
-            error => {
+            (error) => {
               console.log("标记疑点保存失败!", error);
               this.reStartLabelCase();
             }
@@ -443,7 +464,9 @@ export default {
         map2DViewer.jlMap = L.tileLayer(
           "http://t0.tianditu.gov.cn/DataServer?T=img_w&X={x}&Y={y}&L={z}&tk=f331ba0b9ab96fb21c56d91de868935d"
         ).addTo(map2DViewer.map);
-        map2DViewer.jlControl = L.control.sideBySide(map2DViewer.map, map2DViewer.jlMap).addTo(map2DViewer.map);
+        map2DViewer.jlControl = L.control
+          .sideBySide(map2DViewer.map, map2DViewer.jlMap)
+          .addTo(map2DViewer.map);
       } else if (map2DViewer.map.hasLayer(map2DViewer.jlMap)) {
         map2DViewer.map.removeControl(map2DViewer.jlControl);
         map2DViewer.map.removeLayer(map2DViewer.jlMap);
@@ -466,7 +489,13 @@ export default {
       // 每次点击按钮后重绘弹窗
       if (this.currentHtml && this.currentCid) {
         setTimeout(() => {
-          this.popup.setContent(this.createAuditDiv(this.currentCid, this.currentProperties, this.currentSourceType));
+          this.popup.setContent(
+            this.createAuditDiv(
+              this.currentCid,
+              this.currentProperties,
+              this.currentSourceType
+            )
+          );
         }, 300);
       }
     },
@@ -474,7 +503,7 @@ export default {
     initDraw() {
       if (!map2DViewer.measureTool) {
         // 引入疑点标记绘制方法
-        map2DViewer.drawToolFire = data => {
+        map2DViewer.drawToolFire = (data) => {
           // 纬经度
           if (data && data.points.length >= 1) {
             let geoType = null;
@@ -513,32 +542,47 @@ export default {
           color: "red",
           font_size: "14px",
           closeButton: true,
-          iconUrl: "../../static/plugins/draw-plugin/images/marker-icon.png"
+          iconUrl: "../../static/plugins/draw-plugin/images/marker-icon.png",
         });
       }
     },
 
     mapInit: function () {
-      var crs = new L.Proj.CRS(
+      // 遥感影像图层crs
+      systemConfig.imageryLayer.crs = new L.Proj.CRS(
+        "EPSG:0986",
+        "+proj=tmerc +lat_0=0 +lon_0=121.2751921 +k=1 +x_0=0 +y_0=-3457147.81 +ellps=krass +units=m +no_defs",
+        {
+          resolutions: systemConfig.imageryLayer.resolutions,
+          // resolutions: [
+          //   132.2919312505292, 52.91677250021167, 26.458386250105836, 13.229193125052918, 5.291677250021167, 2.6458386250105836,
+          //   1.3229193125052918, 0.5291677250021167, 0.26458386250105836, 0.13229193125052918
+          // ],
+
+          origin: [-66000, 75000],
+          bounds: L.bounds([-65000, -76000], [75000, 72000]),
+        }
+      );
+
+      // 宝石蓝底图crs
+      systemConfig.blueBlackMap.crs = new L.Proj.CRS(
         "EPSG:0986",
         "+proj=tmerc +lat_0=0 +lon_0=121.2751921 +k=1 +x_0=0 +y_0=-3457147.81 +ellps=krass +units=m +no_defs",
         {
-          resolutions: [
-            132.2919312505292, 52.91677250021167, 26.458386250105836, 13.229193125052918, 5.291677250021167, 2.6458386250105836,
-            1.3229193125052918, 0.5291677250021167, 0.26458386250105836, 0.13229193125052918
-          ],
+          resolutions: systemConfig.blueBlackMap.resolutions,
+
           origin: [-66000, 75000],
-          bounds: L.bounds([-65000, -76000], [75000, 72000])
+          bounds: L.bounds([-65000, -76000], [75000, 72000]),
         }
       );
 
       map2DViewer.map = L.map("map2DViewer", {
-        crs: crs,
+        crs: systemConfig.blueBlackMap.crs,
         zoom: 1,
-        minZoom: 0,
-        maxZoom: 6,
+        minZoom: systemConfig.blueBlackMap.minZoom,
+        maxZoom: systemConfig.blueBlackMap.maxZoom,
         attributionControl: false,
-        zoomControl: false
+        zoomControl: false,
         // preferCanvas: true,
       }).setView(systemConfig.mapViewer.center, systemConfig.mapViewer.zoom);
 
@@ -555,15 +599,23 @@ export default {
           // http://aimap.pudong.sh:5236/zjmap/reproduction-service/maps/rest/services/sat-2019s4/proxy?AccessKey=lUaEMxqqhZKLSImGuP/Ergx47orYVyIqHVgxfyGpIurKAy9kdq5uU1cWuTuIXeOM
           // url: "http://aimap.pudong.sh:5236/maps/rest/services/basemap-shanghai-gem-blue-sh2000/mapserver",
           tileSize: 512,
-          url:systemConfig.blueBlackMap
+          url: systemConfig.blueBlackMap.url,
         })
         .addTo(map2DViewer.map);
-      // layer.setStyle({opacity:0,fillOpacity:0})
       map2DViewer.layers["darkmap"] = layer;
 
-      // 加载天地图
-      let imageryLayer = L.tileLayer(systemConfig.imageryLayer);
+      // 加载遥感影像sat-2019s1
+      let imageryLayer = L.esri.tiledMapLayer({
+        tileSize: 512,
+        url: systemConfig.imageryLayer.url,
+      });
       map2DViewer.layers["imagery"] = imageryLayer;
+      // 加载遥感影像sat-2018s2
+      let imageryLayer2 = L.esri.tiledMapLayer({
+        tileSize: 512,
+        url: systemConfig.imageryLayerSat2018s2.url,
+      });
+      map2DViewer.layers["imagery2"] = imageryLayer2;
     },
     // 传入街道参数,重新渲染区域图层
     getJSonDataToStreet(url, param) {
@@ -573,14 +625,16 @@ export default {
         map2DViewer.groups["浦东新区_polygon"].remove();
       }
       // 请求并渲染新的区域图层
-      get("./static/json/simplified_pdgeojson.json", "").then(geoJson => {
+      get("./static/json/simplified_pdgeojson.json", "").then((geoJson) => {
         // 存放所有的面数据
         map2DViewer.groups["浦东新区_polygon"] = L.featureGroup();
         map2DViewer.groups["浦东新区_label"] = L.featureGroup();
         map2DViewer.groups["浦东新区_polygon"].addTo(map2DViewer.map);
         map2DViewer.groups["浦东新区_label"].addTo(map2DViewer.map);
-        geoJson.features.map(feature => {
-          let correctCordArr = JSON.parse(JSON.stringify(feature.geometry.coordinates));
+        geoJson.features.map((feature) => {
+          let correctCordArr = JSON.parse(
+            JSON.stringify(feature.geometry.coordinates)
+          );
           let newCorrectCoordArr = publicFun.latLngsCorrection(correctCordArr);
           feature.geometry.coordinates = newCorrectCoordArr;
 
@@ -657,7 +711,7 @@ export default {
         weight: 3,
         fillColor: this.getColor(name),
         opacity: 1,
-        fillOpacity: 0.4
+        fillOpacity: 0.4,
       }).addTo(map2DViewer.groups["浦东新区_polygon"]);
 
       center = JSON.parse(JSON.stringify(center)).geometry.coordinates;
@@ -669,25 +723,25 @@ export default {
         radius: 10,
         weight: 1,
         fillOpacity: 0,
-        color: "#e6d273"
+        color: "#e6d273",
       });
       wmarker.bindLabel(feature.properties.NAME, {
         noHide: true,
         clickable: true,
-        offset: [-25, 10]
+        offset: [-25, 10],
       });
       wmarker.addTo(map2DViewer.groups["浦东新区_label"]);
       let circle1 = L.circleMarker(center, {
         radius: 8,
         weight: 1,
         fillOpacity: 0,
-        color: "#e6d273"
+        color: "#e6d273",
       }).addTo(map2DViewer.groups["浦东新区_polygon"]);
       let circle2 = L.circleMarker(center, {
         radius: 5,
         weight: 1,
         fillOpacity: 1,
-        color: "#e6d273"
+        color: "#e6d273",
       }).addTo(map2DViewer.groups["浦东新区_polygon"]);
     },
     latLngsToReverse: function (latlngsAry) {
@@ -725,16 +779,18 @@ export default {
     addSinglePolygon(geometry, cid, color, uniqueId, mainType, sourceType) {
       let uniqueIdList = [];
       if (this.$store.state.selectSelectDataMap["singlePolygon"][uniqueId]) {
-        uniqueIdList = this.$store.state.selectSelectDataMap["singlePolygon"][uniqueId];
+        uniqueIdList =
+          this.$store.state.selectSelectDataMap["singlePolygon"][uniqueId];
       }
 
       let singlePolygonItem = {
         uniqueId: uniqueId,
         geometry: geometry,
-        cid: cid
+        cid: cid,
       };
       uniqueIdList.push(singlePolygonItem);
-      this.$store.state.selectSelectDataMap["singlePolygon"][uniqueId] = uniqueIdList;
+      this.$store.state.selectSelectDataMap["singlePolygon"][uniqueId] =
+        uniqueIdList;
       // 当前数据坐标系为WGS84
       let targetGeometry = JSON.parse(geometry).geometry;
       // 预设模型与所有图层层级不同
@@ -746,10 +802,10 @@ export default {
         weight: 3,
         fillColor: color,
         opacity: 1,
-        fillOpacity: 0.4
+        fillOpacity: 0.4,
       }).addTo(map2DViewer.analysisGroups[uniqueId]);
 
-      polygon.on("click", e => {
+      polygon.on("click", (e) => {
         let geojsonData = geometry;
         // 所有图层下的疑点图层 -- 常规展示
         if (geojsonData) {
@@ -759,7 +815,7 @@ export default {
               镇域名称: geoProperties["镇域名称"] || "--",
               面积: geoProperties["面积"] || "--",
               图层构成: geoProperties["图层构成"] || "--",
-              性质: geoProperties["性质"] || "--"
+              性质: geoProperties["性质"] || "--",
             };
             this.$refs.auditRef.$nextTick(() => {
               this.currentCid = cid;
@@ -767,7 +823,9 @@ export default {
               this.currentSourceType = sourceType;
               let domItem = this.createAuditDiv(cid, geojsonData, sourceType);
               this.auditPopupShow = true;
-              this.popup = L.popup({ maxWidth: 700, maxHeight: 600 }).setLatLng(e.latlng).setContent(domItem);
+              this.popup = L.popup({ maxWidth: 700, maxHeight: 600 })
+                .setLatLng(e.latlng)
+                .setContent(domItem);
               this.auditPopupShow = false;
               this.popup.openOn(map2DViewer.map);
             });
@@ -777,13 +835,15 @@ export default {
               镇域名称: geoProperties["镇域名称"] || "--",
               面积: geoProperties["面积"] || "--",
               土地类型: geoProperties["土地类型"] || "--",
-              图斑编号: geoProperties["图斑编号"] || "--"
+              图斑编号: geoProperties["图斑编号"] || "--",
             };
 
             this.$refs.normalRef.$nextTick(() => {
               let domItem = this.createNormalDiv(cid, geojsonData, sourceType);
               this.normalAttrPopupShow = true;
-              this.normalPopup = L.popup({ maxWidth: 700, maxHeight: 600 }).setLatLng(e.latlng).setContent(domItem);
+              this.normalPopup = L.popup({ maxWidth: 700, maxHeight: 600 })
+                .setLatLng(e.latlng)
+                .setContent(domItem);
               this.normalAttrPopupShow = false;
               this.normalPopup.openOn(map2DViewer.map);
             });
@@ -861,7 +921,7 @@ export default {
     //综合分析 - 标记疑点 - 删除面
     deletePolygonLayer(layer) {
       console.log(layer, "layer");
-      map2DViewer.polygons[layer].forEach(polygon => {
+      map2DViewer.polygons[layer].forEach((polygon) => {
         map2DViewer.map.removeLayer(polygon);
       });
     },
@@ -869,7 +929,7 @@ export default {
     drawPoints(data) {
       if (!map2DViewer.myLabels[`label_${data.id}`]) {
         let point = L.marker(data.coord, {
-          opacity: 1
+          opacity: 1,
         }).addTo(map2DViewer.groups["我的标记图层组"]);
         map2DViewer.myLabels[`label_${data.id}`] = point;
       }
@@ -882,7 +942,7 @@ export default {
           weight: 3,
           fillOpacity: color,
           opacity: 1,
-          fillOpacity: 0.4
+          fillOpacity: 0.4,
         }).addTo(map2DViewer.groups["我的标记图层组"]);
         // zoom the map to the polyline
         map2DViewer.myLabels[`label_${data.id}`] = polyline;
@@ -896,7 +956,7 @@ export default {
           weight: 3,
           fillOpacity: color,
           opacity: 1,
-          fillOpacity: 0.4
+          fillOpacity: 0.4,
         }).addTo(map2DViewer.groups["我的标记图层组"]);
 
         map2DViewer.myLabels[`label_${data.id}`] = polygon;
@@ -918,7 +978,7 @@ export default {
             fillOpacity: color,
             opacity: 1,
             fillOpacity: 0.4,
-            radius: Number(distance)
+            radius: Number(distance),
           }).addTo(map2DViewer.groups["我的标记图层组"]);
           map2DViewer.myLabels[`label_${data.id}`] = circle;
         }
@@ -949,8 +1009,8 @@ export default {
       if (geometry) {
         geometry.removeFrom(map2DViewer.map);
       }
-    }
-  }
+    },
+  },
 };
 </script>
 <style lang="less" scoped>

+ 11 - 5
src/views/ComprehensiveAnalysis.vue

@@ -482,8 +482,6 @@ export default {
     },
     getLeftMenuTitle: {
       handler(val) {
-        console.log(val);
-        console.log(defaultModelNameMap);
         this.$nextTick(() => {
           // 从疑点筛查进入综合分析页面默认勾选
           if (defaultModelNameMap.has(val)) {
@@ -607,6 +605,14 @@ export default {
       console.log(
         `监听到用户点击任务!任务类型Code:${data[0]},所属街道Code:${data[1]}!`
       );
+      this.classTextToIndex["浦东新区行政区划"].forEach((v,i)=>{
+        if(v === data[1]){
+          console.log(i,"当前所属街镇选中");
+          this.townSelectVal = i
+          this.changeTownEvent(i)
+        }
+      })
+      
     });
   },
   destroy() {
@@ -1061,7 +1067,7 @@ export default {
                                   );
                                   this.randomColor.set(
                                     `${item3.title}_${item3.id}`,
-                                    publicFun.getRandomColor()
+                                    publicFun.getRGBColor()
                                   );
                                   defaultModelNameMap.set(
                                     item3.title,
@@ -1305,7 +1311,7 @@ export default {
     },
     // 定位功能失效
     locateEvent(node) {
-      console.log(this.layerIdMap);
+      // console.log(this.layerIdMap);
       if (this.layerIdMap.has(node.data.id)) {
         let layer = this.layerIdMap.get(node.data.id);
         // console.log(layer, "layer");
@@ -1565,7 +1571,7 @@ export default {
                 this.$message.info("暂无数据!");
               }
               if (res.code === 200 && res.content.length > 0) {
-                console.log(res.content, "查看我的模型图层数据");
+                // console.log(res.content, "查看我的模型图层数据");
                 // 清除当前图层组内所有图层,并读取GeoJSON数据
                 map2DViewer.analysisGroups[uniqueId].clearLayers();
                 // 判断能用的数据