Pārlūkot izejas kodu

全屏对比删除TOKEN

DESKTOP-6LTVLN7\Liumouren 2 gadi atpakaļ
vecāks
revīzija
db123785b8

+ 1 - 1
package.json

@@ -19,7 +19,7 @@
     "html2canvas": "^1.4.1",
     "jquery": "^3.6.1",
     "jszip": "^3.10.1",
-    "proj4": "^2.8.0",
+    "proj4": "^2.8.1",
     "svg-sprite-loader": "^6.0.11",
     "vue": "^2.6.14",
     "vue-pdf": "^4.3.0",

+ 1 - 1
src/components/common/BottomForm/SameScreenComparison.vue

@@ -160,7 +160,7 @@ export default {
           data.forEach(v => {
             this.mapList.unshift({
               mapName: v.title,
-              mapUrl: v.c_url + localStorage.getItem("TOKEN"),
+              mapUrl: v.c_url,
               active: v.c_defined_show ? v.c_defined_show : false
             });
           });

+ 23 - 3
src/components/map/Map.vue

@@ -71,12 +71,32 @@ export default {
       });
     },
     mapInit() {
+      
+      var crs = new L.Proj.CRS(
+        "EPSG:3857",
+        "+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,
+          ],  
+          origin: [-66000, 75000],
+          bounds: L.bounds([-65000, -76000], [75000, 72000]),
+        }
+      );
       this.map = L.map(this.$refs.map, {
+        crs: crs,
+        center: [31.074472887639914, 121.72521988031804],
+        zoom: 1,
+        minZoom: 0,
+        maxZoom: 9,
         attributionControl: false,
         zoomControl: false,
-        minZoom: this.minZoom,
-        maxZoom: this.maxZoom,
-        preferCanvas: true
+        // minZoom: this.minZoom,
+        // maxZoom: this.maxZoom,
+        // preferCanvas: true
         // maxBounds: new L.LatLngBounds(this.bound[0], this.bound[1]),
       }).setView(map2DViewer.map.getCenter(), map2DViewer.map.getZoom());
 

+ 123 - 156
src/components/map/MapHolder.vue

@@ -17,13 +17,14 @@ import CaseAuditPopup from "@/components/popup/CaseAuditPopup.vue";
 import NormalAttrPopup from "@/components/popup/NormalAttrPopup.vue";
 import LabelCasePopup from "@/components/popup/LabelCasePopup.vue";
 import BasemapChange from "@/components/map/BasemapChange.vue";
+import coordinate from "@/utils/coordinate.js";
 export default {
   name: "MapHolder",
   components: {
     CaseAuditPopup,
     NormalAttrPopup,
     LabelCasePopup,
-    BasemapChange,
+    BasemapChange
   },
   data() {
     return {
@@ -45,7 +46,7 @@ export default {
       currentLabelHtml: null,
       tableObj: {},
       // 疑点审计的保存后的疑点状态集合
-      caseStatusMap: new Map(),
+      caseStatusMap: new Map()
     };
   },
   created() {},
@@ -76,7 +77,7 @@ export default {
       deleteSinglePolygon: this.deleteSinglePolygon,
       deleteGroupFromMap: this.deleteGroupFromMap,
       drawGeometry: this.drawGeometry,
-      deleteGeometry: this.deleteGeometry,
+      deleteGeometry: this.deleteGeometry
     });
   },
   beforeDestroyed() {
@@ -97,7 +98,7 @@ export default {
     // 监听当前菜单
     getCurrentMenu() {
       return this.$store.state.navSelect;
-    },
+    }
   },
   watch: {
     getLabelCaseBtnStatus(val) {
@@ -140,9 +141,9 @@ export default {
         this.$nextTick(() => {
           this.getJSonData();
         });
-      },
+      }
       // immediate: true
-    },
+    }
   },
   methods: {
     // 开始标记疑点事件
@@ -153,7 +154,7 @@ export default {
     stopLabelCase() {
       if (map2DViewer.measureTool) {
         map2DViewer.setDrawTool({
-          action: "remove",
+          action: "remove"
         });
       }
     },
@@ -172,19 +173,16 @@ export default {
       let geoProperties = JSON.parse(geojsonData).properties;
       // 搜索geojson数据中的固定字段 -- 镇域名称,面积,土地类型,图斑编号
       this.$refs.normalRef.tableObj["面积"] = geoProperties["面积"] || "--";
-      this.$refs.normalRef.tableObj["镇域名称"] =
-        geoProperties["镇域名称"] || "--";
-      this.$refs.normalRef.tableObj["土地类型"] =
-        geoProperties["土地类型"] || "--";
-      this.$refs.normalRef.tableObj["图斑编号"] =
-        geoProperties["图斑编号"] || "--";
+      this.$refs.normalRef.tableObj["镇域名称"] = geoProperties["镇域名称"] || "--";
+      this.$refs.normalRef.tableObj["土地类型"] = geoProperties["土地类型"] || "--";
+      this.$refs.normalRef.tableObj["图斑编号"] = geoProperties["图斑编号"] || "--";
       let currentInnerHtml = this.$refs.normalRef.$el.innerHTML;
       // 需要重新绘制的属性obj
       let targetObj = {
         镇域名称: geoProperties["镇域名称"] || "--",
         面积: geoProperties["面积"] || "--",
         土地类型: geoProperties["土地类型"] || "--",
-        图斑编号: geoProperties["图斑编号"] || "--",
+        图斑编号: geoProperties["图斑编号"] || "--"
       };
 
       if (currentInnerHtml) {
@@ -200,27 +198,21 @@ export default {
             if ($(`#${str}_id a`)) {
               // 属性框内容
               if ($(".center-table-item-normal")) {
-                $(".center-table-item-normal .leftcell").each(
-                  (index, domEle) => {
-                    $(".center-table-item-normal .leftcell")
-                      .eq(index)
-                      .text(Object.keys(targetObj)[index]);
-                    $(".center-table-item-normal .rightcell")
-                      .eq(index)
-                      .text(Object.values(targetObj)[index]);
-                  }
-                );
+                $(".center-table-item-normal .leftcell").each((index, domEle) => {
+                  $(".center-table-item-normal .leftcell").eq(index).text(Object.keys(targetObj)[index]);
+                  $(".center-table-item-normal .rightcell").eq(index).text(Object.values(targetObj)[index]);
+                });
               }
 
               $(`#${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);
                 });
@@ -251,10 +243,8 @@ export default {
       let geoProperties = JSON.parse(geojsonData).properties;
       // 搜索geojson数据中的固定字段 -- 镇域名称,面积,土地类型,图斑编号
       this.$refs.auditRef.tableObj["面积"] = geoProperties["面积"] || "--";
-      this.$refs.auditRef.tableObj["镇域名称"] =
-        geoProperties["镇域名称"] || "--";
-      this.$refs.auditRef.tableObj["图层构成"] =
-        geoProperties["图层构成"] || "--";
+      this.$refs.auditRef.tableObj["镇域名称"] = geoProperties["镇域名称"] || "--";
+      this.$refs.auditRef.tableObj["图层构成"] = geoProperties["图层构成"] || "--";
       this.$refs.auditRef.tableObj["性质"] = geoProperties["性质"] || "--";
 
       // 需要重新绘制的属性obj
@@ -262,7 +252,7 @@ export default {
         镇域名称: geoProperties["镇域名称"] || "--",
         面积: geoProperties["面积"] || "--",
         图层构成: geoProperties["图层构成"] || "--",
-        性质: geoProperties["性质"] || "--",
+        性质: geoProperties["性质"] || "--"
       };
       if (this.currentHtml) {
         let div = document.createElement("div");
@@ -274,32 +264,22 @@ export default {
           // 属性框内容
           if ($(".center-table-item-normal")) {
             $(".center-table-item-normal .leftcell").each((index, domEle) => {
-              $(".center-table-item-normal .leftcell")
-                .eq(index)
-                .text(Object.keys(targetObj)[index]);
-              $(".center-table-item-normal .rightcell")
-                .eq(index)
-                .text(Object.values(targetObj)[index]);
+              $(".center-table-item-normal .leftcell").eq(index).text(Object.keys(targetObj)[index]);
+              $(".center-table-item-normal .rightcell").eq(index).text(Object.values(targetObj)[index]);
             });
           }
 
           if ($(".center-table-item-special")) {
             $(".center-table-item-special .leftcell").each((index, domEle) => {
-              $(".center-table-item-speciall .leftcell")
-                .eq(index)
-                .text(Object.keys(targetObj)[index]);
-              $(".center-table-item-special .rightcell")
-                .eq(index)
-                .text(Object.values(targetObj)[index]);
+              $(".center-table-item-speciall .leftcell").eq(index).text(Object.keys(targetObj)[index]);
+              $(".center-table-item-special .rightcell").eq(index).text(Object.values(targetObj)[index]);
             });
           }
 
           // 下拉框内容
           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));
             }
           }
 
@@ -307,13 +287,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);
@@ -321,7 +301,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();
@@ -357,7 +337,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 "取消":
@@ -386,22 +366,20 @@ 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();
@@ -426,13 +404,7 @@ 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);
@@ -440,11 +412,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);
@@ -454,36 +426,33 @@ 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();
             }
@@ -497,9 +466,7 @@ 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);
@@ -522,13 +489,7 @@ 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));
           // .openOn(map2DViewer.map);
         }, 300);
       }
@@ -537,7 +498,7 @@ export default {
     initDraw() {
       if (!map2DViewer.measureTool) {
         // 引入疑点标记绘制方法
-        map2DViewer.drawToolFire = (data) => {
+        map2DViewer.drawToolFire = data => {
           // 纬经度
           if (data && data.points.length >= 1) {
             let geoType = null;
@@ -576,40 +537,33 @@ 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(
-        "EPSG:2401",
+        "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: [529.1666666666666, 264.5833333333333,
-            132.2919312505292, 52.91677250021167, 26.458386250105836,
-            13.229193125052918, 5.291677250021167, 2.6458386250105836,
-            1.3229193125052918, 0.5291677250021167, 0.26458386250105836,
-            0.13229193125052918,
+          resolutions: [
+            132.2919312505292, 52.91677250021167, 26.458386250105836, 13.229193125052918, 5.291677250021167, 2.6458386250105836,
+            1.3229193125052918, 0.5291677250021167, 0.26458386250105836, 0.13229193125052918
           ],
-          // 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
-          // ],
           origin: [-66000, 75000],
-          bounds: L.bounds([-65000, -76000], [75000, 72000]),
+          bounds: L.bounds([-65000, -76000], [75000, 72000])
         }
       );
 
       map2DViewer.map = L.map("map2DViewer", {
         crs: crs,
         center: [31.074472887639914, 121.72521988031804],
-        zoom: 5,
-        minZoom: 1,
-        maxZoom: 10,
+        zoom: 1,
+        minZoom: 0,
+        maxZoom: 9,
         attributionControl: false,
-        zoomControl: false,
+        zoomControl: false
         // preferCanvas: true,
       }).setView(systemConfig.mapViewer.center, systemConfig.mapViewer.zoom);
 
@@ -622,9 +576,10 @@ export default {
           // systemConfig.mapService +
           // "?servertype=Street_Purplish_Blue&token=" +
           // systemConfig.token,
-          url: "http://aimap.pudong.sh:5236/zjmap/reproduction-service/maps/rest/services/sat-2018s2/proxy?AccessKey=lUaEMxqqhZKLSImGuP/Ergx47orYVyIqHVgxfyGpIurKAy9kdq5uU1cWuTuIXeOM",
+          url: "http://aimap.pudong.sh:5236/zjmap/reproduction-service/maps/rest/services/sat-2019s4/proxy?AccessKey=lUaEMxqqhZKLSImGuP/Ergx47orYVyIqHVgxfyGpIurKAy9kdq5uU1cWuTuIXeOM",
+          // 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,
+          tileSize: 512
           // systemConfig.blueBlackMap,
         })
         .addTo(map2DViewer.map);
@@ -643,21 +598,34 @@ 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) => {
-          if (
-            this.town.indexOf(feature.properties.NAME.replace("镇", "")) > -1
-          ) {
-            this.renderPolygon(feature);
-          }
+        geoJson.features.map(feature => {
+          // if (
+          //   this.town.indexOf(feature.properties.NAME.replace("镇", "")) > -1
+          // ) {
+          this.renderPolygon(feature);
+          // }
         });
       });
     },
+    /**
+     * val :经纬度数组
+     */
+    w84Proj4ToShanghai(val) {
+      // 参数1:随意定义的坐标系名称,格式“EPSG:xxxxx”
+      // 参数2:prj文件里的内容
+      this.$proj4.defs("EPSG:0986","+proj=tmerc +lat_0=0 +lon_0=121.2751921 +k=1 +x_0=0 +y_0=-3457147.81 +ellps=GRS80 +units=m +no_defs +type=crs");
+        // "+proj=tmerc +lat_0=0 +lon_0=121.2751921 +k=1 +x_0=0 +y_0=-3457147.81 +ellps=krass +units=m +no_defs",
+      // 从"EPSG:0986"转成"EPSG:4326"
+      // coordinate 类型Array  例:[116, 39]
+      let pro = `PROJCS[\"shanghaicity\",GEOGCS[\"GCS_Beijing_1954\",DATUM[\"D_Beijing_1954\",SPHEROID[\"Krasovsky_1940\",6378245.0,298.3]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"False_Easting\",-3457147.81],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",121.2751921],PARAMETER[\"Scale_Factor\",1.0],PARAMETER[\"Latitude_Of_Origin\",0.0],UNIT[\"Meter\",1.0]]`;
+      return this.$proj4( "EPSG:0986", "EPSG:4326",val);
+    },
     // 可视化单一的镇域面
     getSingleJsonData(name) {},
     // 默认获取浦东新区全区的图层数据
@@ -672,10 +640,7 @@ export default {
         this.getJSonDataToStreet("", "");
         // 切换到首页时需定位到当前图层
         if (this.$store.state.homeSpecialTown === "全部") {
-          this.setView(
-            townLocationMap.get(this.$store.state.homeSpecialTown),
-            10
-          );
+          this.setView(townLocationMap.get(this.$store.state.homeSpecialTown), 10);
         } else {
           let polygon = townPolygonMap.get(this.$store.state.homeSpecialTown);
           map2DViewer.map.fitBounds(polygon.getBounds());
@@ -707,10 +672,14 @@ 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;
+      // center = coordinate.wgs84_to_shcj(center[0],center[1]);
+      center = this.w84Proj4ToShanghai(center);
+      console.log("center",center);
+
       center.reverse();
       // 坐标
       townLocationMap.set(name, center);
@@ -719,25 +688,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) {
@@ -758,6 +727,8 @@ export default {
         return "#0055ff";
       } else if (townData.C.indexOf(name) > -1) {
         return "#00ffd5";
+      } else {
+        return "#00000032";
       }
     },
     /**
@@ -772,18 +743,16 @@ 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;
       // 预设模型与所有图层层级不同
@@ -794,10 +763,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 (mainType === "所有图层") {
@@ -833,7 +802,7 @@ export default {
     },
     // 综合分析 - 图层绘制面
     addPolygonLayer(data, cid, color) {
-      data.map((feature) => {
+      data.map(feature => {
         let polygonData = JSON.parse(JSON.stringify(feature));
         let coordinates = polygonData.geometry.coordinates[0];
         let infos = polygonData.properties;
@@ -842,18 +811,16 @@ export default {
           weight: 3,
           fillColor: color,
           opacity: 1,
-          fillOpacity: 0.4,
+          fillOpacity: 0.4
         }).addTo(map2DViewer.map);
         map2DViewer.polygons[`${cid}_layer`].push(polygon);
         polygon.infos = infos;
-        polygon.on("click", (e) => {
+        polygon.on("click", e => {
           // console.log(e, "polygon");
           this.auditPopupShow = true;
           // console.log(e.latlng, "获取当前弹窗坐标111");
 
-          this.popup = L.popup({ maxWidth: 700, maxHeight: 600 })
-            .setLatLng(e.latlng)
-            .setContent(this.createAuditDiv(cid));
+          this.popup = L.popup({ maxWidth: 700, maxHeight: 600 }).setLatLng(e.latlng).setContent(this.createAuditDiv(cid));
           // .openOn(map2DViewer.map);
           this.auditPopupShow = false;
           this.popup.openOn(map2DViewer.map);
@@ -873,7 +840,7 @@ export default {
     //综合分析 - 标记疑点 - 删除面
     deletePolygonLayer(layer) {
       console.log(layer, "layer");
-      map2DViewer.polygons[layer].forEach((polygon) => {
+      map2DViewer.polygons[layer].forEach(polygon => {
         map2DViewer.map.removeLayer(polygon);
       });
     },
@@ -881,7 +848,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;
       }
@@ -894,7 +861,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;
@@ -908,7 +875,7 @@ export default {
           weight: 3,
           fillOpacity: color,
           opacity: 1,
-          fillOpacity: 0.4,
+          fillOpacity: 0.4
         }).addTo(map2DViewer.groups["我的标记图层组"]);
 
         map2DViewer.myLabels[`label_${data.id}`] = polygon;
@@ -931,7 +898,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;
         }
@@ -962,8 +929,8 @@ export default {
       if (geometry) {
         geometry.removeFrom(map2DViewer.map);
       }
-    },
-  },
+    }
+  }
 };
 </script>
 <style lang="less" scoped>

+ 2 - 1
src/main.js

@@ -18,7 +18,7 @@ import CryptoJS from "./utils/publicFunction.js";
 // 引入dayjs库
 import dayjs from "dayjs";
 import * as echarts from "echarts";
-
+import proj4 from "proj4";
 Vue.directive("drag", drag);
 Vue.prototype.$CryptoJS = CryptoJS;
 Vue.prototype.$Post = post;
@@ -26,6 +26,7 @@ Vue.prototype.$Get = get;
 Vue.prototype.$GetFile = getFile;
 Vue.prototype.$Echarts = echarts;
 Vue.prototype.$dayjs = dayjs;
+Vue.prototype.$proj4 = proj4;
 Vue.prototype.$PostForm = postform;
 Vue.prototype.urlsCollection = urls;
 Vue.config.productionTip = false;