浏览代码

我的任务删除关闭确认按钮弹窗;
综合分析页面的标记疑点功能点击保存后删除编辑状态;
卷帘对比开关状态暂存。

DESKTOP-6LTVLN7\Liumouren 2 年之前
父节点
当前提交
ccf5f15d8d

+ 0 - 2
public/static/plugins/draw-plugin/leaflet.draw.js

@@ -614,7 +614,6 @@ L.Control.Draw = L.Control.extend({
  * 测量工具
  */
 map2DViewer.drawToolFire = function (data) {
-  // console.log(data);
 };
 map2DViewer.setDrawTool = function (options) {
   mousemoveStatus = true;
@@ -661,7 +660,6 @@ map2DViewer.setDrawTool = function (options) {
         this.measureTool = null
         map2DViewer.measureTool = null;
       }
-
       break;
     case "start":
       this.measureTool.start();

+ 6 - 5
src/components/common/BottomForm/MyMission.vue

@@ -319,11 +319,12 @@ export default {
     // 弹窗关闭询问
     handleClose() {
       if (this.dialogVisible) {
-        this.$confirm("确认关闭?")
-          .then(_ => {
-            this.clearDialogVisible();
-          })
-          .catch(_ => {});
+        this.clearDialogVisible();
+        // this.$confirm("确认关闭?")
+        //   .then(_ => {
+        //     this.clearDialogVisible();
+        //   })
+        //   .catch(_ => {});
       }
     },
     // 我的任务取消

+ 7 - 6
src/components/common/BottomForm/ReportOutput.vue

@@ -65,11 +65,12 @@ export default {
     // 弹窗关闭询问
     handleClose() {
       if (this.dialogVisible) {
-        this.$confirm("确认关闭?")
-          .then(_ => {
-            this.clearDialogVisible();
-          })
-          .catch(_ => {});
+        this.clearDialogVisible();
+        // this.$confirm("确认关闭?")
+        //   .then(_ => {
+        //     this.clearDialogVisible();
+        //   })
+        //   .catch(_ => {});
       }
     },
     // 报告输出取消
@@ -77,7 +78,7 @@ export default {
       // 关闭弹窗
       this.dialogVisible = false;
       //   删除文件预览
-        this.$refs.filePreview2.cancel();
+      this.$refs.filePreview2.cancel();
       // 修改父级菜单变量(弹窗显示状态和显示底部菜单)
       if (this.$ifMenu("3", "")) {
         this.$emit("changeShowBottomMenusStatus", true);

+ 22 - 49
src/components/common/BottomForm/SameScreenComparison.vue

@@ -45,18 +45,10 @@
           已选择<span class="checkLength">{{ checkedCities.length }}</span
           >个
         </div>
-        <el-checkbox-group
-          id="mapCheckBox"
-          v-model="checkedCities"
-          @change="handleCheckedCitiesChange"
-          :min="2"
-          :max="6"
-        >
+        <el-checkbox-group id="mapCheckBox" v-model="checkedCities" @change="handleCheckedCitiesChange" :min="2" :max="6">
           <el-checkbox
             class="mapCheckBox"
-            :disabled="
-              checkedCities.length >= 6 && checkedCities.indexOf(index) == -1
-            "
+            :disabled="checkedCities.length >= 6 && checkedCities.indexOf(index) == -1"
             v-for="(city, index) in mapList"
             :checked="city.active"
             :label="index"
@@ -70,26 +62,12 @@
     <div id="textareaBox">
       <div class="doPrintInfo">地址:xxxxxxxx 时间:{{ newTime }}</div>
       <div class="textareaTitle">描述记录:</div>
-      <el-input
-        type="textarea"
-        :autosize="{ minRows: 3, maxRows: 4 }"
-        placeholder="请输入内容"
-        v-model="textarea1"
-      >
-      </el-input>
+      <el-input type="textarea" :autosize="{ minRows: 3, maxRows: 4 }" placeholder="请输入内容" v-model="textarea1"> </el-input>
     </div>
     <!-- 打印区域 -->
     <div id="imgBox">
       <span>基本农田被侵占</span>
-      <img
-        src=""
-        id="imgOut"
-        style="
-          width: 1240px;
-          background-repeat: no-repeat;
-          background-size: 100% 100%;
-        "
-      />
+      <img src="" id="imgOut" style="width: 1240px; background-repeat: no-repeat; background-size: 100% 100%" />
       <div class="doPrintInfo2">地址:xxxxxxxx 时间:{{ newTime }}</div>
       <span><div>描述记录:</div></span>
       <div>{{ textarea1 }}</div>
@@ -134,7 +112,7 @@ export default {
       // 底部文本域
       textarea1: "",
       // 地图底图列表
-      mapList: [],
+      mapList: []
     };
   },
   created() {
@@ -171,16 +149,16 @@ export default {
         columnId: 35,
         states: 3,
         pageSize: 20,
-        page: 0,
+        page: 0
       };
-      this.$Post(this.urlsCollection.selectContentList, params).then((res) => {
+      this.$Post(this.urlsCollection.selectContentList, params).then(res => {
         if (res.code === 200 && res.content.data.length > 0) {
           let data = res.content.data;
-          data.forEach((v) => {
+          data.forEach(v => {
             this.mapList.unshift({
               mapName: v.title,
               mapUrl: v.c_url + localStorage.getItem("TOKEN"),
-              active: false,
+              active: false
             });
           });
           this.mapList[0].active = true;
@@ -197,18 +175,19 @@ export default {
       // 打开弹窗前首先同步一下地图定位
       this.centerZoomInit = {
         center: map2DViewer.map.getCenter(),
-        zoom: map2DViewer.map.getZoom(),
+        zoom: map2DViewer.map.getZoom()
       };
       this.handleCheckedCitiesChange();
     },
     // 弹窗关闭询问
     handleClose() {
       if (this.dialogVisible) {
-        this.$confirm("确认关闭?")
-          .then((_) => {
-            this.clearDialogVisible();
-          })
-          .catch((_) => {});
+        this.clearDialogVisible();
+        // this.$confirm("确认关闭?")
+        //   .then((_) => {
+        //     this.clearDialogVisible();
+        //   })
+        //   .catch((_) => {});
       }
     },
     // 同屏对比取消
@@ -242,13 +221,11 @@ export default {
         _width,
         _height,
         useCORS: true,
-        allowTaint: false,
+        allowTaint: false
       };
       let that = this;
-      html2canvas(this.$refs.doPrint, ops).then((canvas) => {
-        document
-          .getElementById("imgOut")
-          .setAttribute("src", canvas.toDataURL("image/png"));
+      html2canvas(this.$refs.doPrint, ops).then(canvas => {
+        document.getElementById("imgOut").setAttribute("src", canvas.toDataURL("image/png"));
       });
 
       this.interval = setInterval(() => {
@@ -273,11 +250,7 @@ export default {
       document.body.appendChild(new_iframe);
       doc = new_iframe.contentWindow.document;
       var obj = document.getElementById("imgBox");
-      doc.write(
-        '<div style="width:100%;height:auto;margin:0px;">' +
-          obj.innerHTML +
-          "</div>"
-      );
+      doc.write('<div style="width:100%;height:auto;margin:0px;">' + obj.innerHTML + "</div>");
       doc.close();
       new_iframe.contentWindow.focus();
       new_iframe.contentWindow.print();
@@ -322,9 +295,9 @@ export default {
       if (!this.MouseDownStatus) {
         this.mouseIndex = mouseIndex;
       }
-    },
+    }
   },
-  watch: {},
+  watch: {}
 };
 </script>
 <style lang="less" scoped>

+ 15 - 29
src/components/common/BottomForm/UploadingData.vue

@@ -1,11 +1,6 @@
 <template>
   <!-- 上传数据弹窗 -->
-  <el-dialog
-    title="上传数据"
-    :visible.sync="dialogVisible"
-    :before-close="handleClose"
-    width="400px"
-  >
+  <el-dialog title="上传数据" :visible.sync="dialogVisible" :before-close="handleClose" width="400px">
     <template slot="title">
       <div class="dialogTitle">
         <div class="dialogTitleIcon"></div>
@@ -29,9 +24,7 @@
       >
         <i class="el-icon-upload"></i>
         <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
-        <div class="el-upload__tip" slot="tip">
-          *仅支持Geojson格式文件,且不超过5MB
-        </div>
+        <div class="el-upload__tip" slot="tip">*仅支持Geojson格式文件,且不超过5MB</div>
       </el-upload>
     </div>
     <span slot="footer" class="dialog-footer">
@@ -57,7 +50,7 @@ export default {
       // 上传文件列表
       fileList: [],
       // 上传数据弹窗显示状态
-      dialogVisible: false,
+      dialogVisible: false
     };
   },
   mounted() {
@@ -82,11 +75,12 @@ export default {
     // 弹窗关闭询问
     handleClose() {
       if (this.dialogVisible) {
-        this.$confirm("确认关闭?")
-          .then((_) => {
-            this.clearDialogVisible();
-          })
-          .catch((_) => {});
+        this.clearDialogVisible();
+        // this.$confirm("确认关闭?")
+        //   .then((_) => {
+        //     this.clearDialogVisible();
+        //   })
+        //   .catch((_) => {});
       }
     },
     // 上传数据关闭
@@ -112,16 +106,12 @@ export default {
     // 文件超出个数限制时
     handleExceed(files, fileList) {
       this.$message.warning(
-        `当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${
-          files.length + fileList.length
-        } 个文件`
+        `当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`
       );
     },
     // 删除文件之前
     beforeRemove(file, fileList) {
-      this.$store.state.mapMethodsCollection
-        .get("RENDER")
-        .deletePolygonLayer("upload_layer");
+      this.$store.state.mapMethodsCollection.get("RENDER").deletePolygonLayer("upload_layer");
       delete map2DViewer.polygons["upload_layer"];
       this.$message.success(`文件${file.name}移除成功!`);
       return true;
@@ -144,12 +134,8 @@ export default {
       // 地图定位
       let firstPolygon = JSON.parse(JSON.stringify(geoJson[0]));
       let coordinates = firstPolygon.geometry.coordinates[0][0][0];
-      this.$store.state.mapMethodsCollection
-        .get("RENDER")
-        .setView(coordinates, 16);
-      this.$store.state.mapMethodsCollection
-        .get("RENDER")
-        .addPolygonLayer(geoJson, cid, color);
+      this.$store.state.mapMethodsCollection.get("RENDER").setView(coordinates, 16);
+      this.$store.state.mapMethodsCollection.get("RENDER").addPolygonLayer(geoJson, cid, color);
     },
     // 读取file对象内容
     getActionData(file) {
@@ -174,9 +160,9 @@ export default {
         this.$message.error("上传文件大小不能超过 5MB!");
       }
       return isJPG && isLt5M;
-    },
+    }
   },
-  watch: {},
+  watch: {}
 };
 </script>
 <style lang="less" scoped>

+ 21 - 12
src/components/common/BottomMenus.vue

@@ -42,7 +42,7 @@
             :key="subIndex"
           >
             <!-- 选中状态的背景高亮(舍弃) -->
-            <div :class="ifMenuIndex(item.index, subItem.index) ? 'colBtuMenuShadow' : ''"></div>
+            <div :class="ifMenuIndex(item.index, subItem) ? 'colBtuMenuShadow' : ''"></div>
 
             <!-- 子菜单图标的选择性渲染 -->
             <el-image class="BtuMenu_hover" :src="returnBgImage(subItem.bgImage + '-a')"></el-image>
@@ -113,15 +113,16 @@ export default {
             {
               index: 1,
               title: "标记疑点",
-              bgImage: "bjyd",
-              clickEmit: "labelCaseEvent"
+              bgImage: "bjyd"
+              // clickEmit: "labelCaseEvent"
             },
             { index: 2, title: "同屏对比", bgImage: "tpdb", clickRef: "tpdb" },
             {
               index: 3,
               title: "卷帘对比",
               bgImage: "jldb",
-              clickEmit: "JLControl"
+              clickEmit: "JLControl",
+              stateKey: "jlActiveState"
             },
             { index: 4, title: "上传数据", bgImage: "scsj", clickRef: "scsj" },
             {
@@ -161,20 +162,28 @@ export default {
   props: [],
   methods: {
     // 根据菜单父级index和子菜单index,判断全局变量已选中底部菜单的index对比,返回状态。
-    ifMenuIndex(index, subIndex) {
-      if (index == 1) {
-        if (subIndex === 0 || subIndex === 1 || subIndex === 3) {
-          return this.$store.state.bottomMenuIndexs.index == index && this.$store.state.bottomMenuIndexs.subIndex == subIndex;
+    ifMenuIndex(index, subItem) {
+      if (subItem.stateKey != undefined) {
+        return this.$store.state[subItem.stateKey]
+      } else if (index == 1) {
+        if (subItem.index === 0 || subItem.index === 1) {
+          return (
+            this.$store.state.bottomMenuIndexs.index == index && this.$store.state.bottomMenuIndexs.subIndex == subItem.index
+          );
         }
       }
     },
     // 根据菜单父级index和子菜单index,更新全局变量。
     changeBottomMenu(index, item) {
       // 该逻辑可能会舍弃
-      this.$store.commit("changeBottomMenu", {
-        index: index,
-        subIndex: item.index
-      });
+      if (item.stateKey != undefined) {
+        this.$store.commit("changeJlActiveState",!this.$store.state[item.stateKey]);
+      } else {
+        this.$store.commit("changeBottomMenu", {
+          index: index,
+          subIndex: item.index
+        });
+      }
       if (item.clickEmit) {
         // 调用全局事件总线中的指定事件
         this.$bus.$emit(item.clickEmit);

+ 79 - 110
src/components/map/MapHolder.vue

@@ -31,7 +31,7 @@ export default {
       // 标记疑点
       currentLabelCid: null,
       currentLabelHtml: null,
-      tableObj: {},
+      tableObj: {}
     };
   },
   created() {},
@@ -62,7 +62,7 @@ export default {
       deleteSinglePolygon: this.deleteSinglePolygon,
       deleteGroupFromMap: this.deleteGroupFromMap,
       drawGeometry: this.drawGeometry,
-      deleteGeometry: this.deleteGeometry,
+      deleteGeometry: this.deleteGeometry
     });
   },
   beforeDestroyed() {
@@ -70,7 +70,7 @@ export default {
     this.$bus.$off("JLControl");
     // 疑点审计
     this.$bus.$off("caseAuditEvent");
-    map2DViewer.map.closePopup()
+    map2DViewer.map.closePopup();
   },
   computed: {
     // 监听底部菜单栏的状态
@@ -83,13 +83,12 @@ export default {
     // 监听当前菜单
     getCurrentMenu() {
       return this.$store.state.navSelect;
-    },
+    }
   },
   watch: {
     getLabelCaseBtnStatus(val) {
       // console.log(val, "标记疑点");
       if (val.index === 1 && val.subIndex === 1) {
-        console.log("激活标记疑点弹窗");
         // 删除地图上所有弹窗
         this.$store.state.attrTableShow = false;
         this.$store.state.updateCasePopupShow = false;
@@ -101,10 +100,8 @@ export default {
             map2DViewer.myLabels[i] = null;
           }
         }
-
         this.initDraw();
       } else {
-        console.log("移除疑点标记事件");
         this.stopLabelCase();
         if (this.labelPopup) {
           map2DViewer.map.closePopup();
@@ -123,14 +120,15 @@ export default {
           }
           this.$store.state.bottomMenuIndexs.index = -1;
           this.$store.state.bottomMenuIndexs.subIndex = -1;
+          this.$store.commit("changeJlActiveState",false);
         }
         // 切换页面时判断是否需要显示区域图
         this.$nextTick(() => {
           this.getJSonData();
         });
-      },
-      // immediate: true,
-    },
+      }
+      // immediate: true
+    }
   },
   methods: {
     // 开始标记疑点事件
@@ -141,15 +139,20 @@ export default {
     stopLabelCase() {
       if (map2DViewer.measureTool) {
         map2DViewer.setDrawTool({
-          action: "remove",
+          action: "remove"
         });
       }
     },
+    reStartLabelCase() {
+      this.stopLabelCase();
+
+      this.initDraw();
+    },
     // 常规图层弹窗
     createAuditDiv(str, properties) {
       // 根据ref获取组件的dom元素
       this.currentHtml = this.$refs.auditRef.$el.innerHTML;
-      this.$refs.auditRef.tableObj = properties
+      this.$refs.auditRef.tableObj = properties;
       if (this.currentHtml) {
         let div = document.createElement("div");
         div.id = str + "_id";
@@ -158,32 +161,24 @@ export default {
         div.innerHTML = this.currentHtml;
         $(() => {
           if (properties) {
-            $(`#${str}_id .center-table-item-normal .leftcell`).each(
-              (index, domEle) => {
-                $(`#${str}_id .center-table-item-normal .leftcell`)
-                  .eq(index)
-                  .text(Object.keys(properties)[index]);
-              }
-            );
-            $(`#${str}_id .center-table-item-normal .rightcell`).each(
-              (index, domEle) => {
-                $(`#${str}_id .center-table-item-normal .rightcell`)
-                  .eq(index)
-                  .text(Object.values(properties)[index]);
-              }
-            );
+            $(`#${str}_id .center-table-item-normal .leftcell`).each((index, domEle) => {
+              $(`#${str}_id .center-table-item-normal .leftcell`).eq(index).text(Object.keys(properties)[index]);
+            });
+            $(`#${str}_id .center-table-item-normal .rightcell`).each((index, domEle) => {
+              $(`#${str}_id .center-table-item-normal .rightcell`).eq(index).text(Object.values(properties)[index]);
+            });
           }
 
           // 法律法规点击事件
           if ($(`#${str}_id a`)) {
-            $(`#${str}_id a`).click((e) => {
+            $(`#${str}_id a`).click(e => {
               console.log(e, "显示疑点相关的弹窗");
               this.$store.state.lawPopupShow = true;
             });
           }
           // input添加点击事件
           if ($(`#${str}_id input`)[1]) {
-            $(`#${str}_id input`).click((e) => {
+            $(`#${str}_id input`).click(e => {
               switch (e.target.defaultValue) {
                 case "修改":
                   this.modifyBtnEvent();
@@ -218,7 +213,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 "取消":
@@ -256,12 +251,7 @@ export default {
         let title = $(`#${str}_id select`).val();
         let des = $(`#${str}_id textarea`).val();
         let coordinates = [data.points];
-        let geometry = publicFun.generateGeoJSON(
-          title,
-          des,
-          geoType,
-          coordinates
-        );
+        let geometry = publicFun.generateGeoJSON(title, des, geoType, coordinates);
 
         let params = new FormData();
 
@@ -269,12 +259,10 @@ export default {
           geojson: JSON.stringify(geometry),
           type: geoType,
           userId: Number(localStorage.getItem("USER_ID")),
-          sourceId: 0,
+          sourceId: 0
         };
-        console.log(params, "params");
-
         this.$Post(this.urlsCollection.addConllection, params).then(
-          (res) => {
+          res => {
             if (res.code == 200) {
               console.log(res, "添加标记成功");
               map2DViewer.map.closePopup();
@@ -283,33 +271,32 @@ export default {
               paramData = {
                 userId: Number(localStorage.getItem("USER_ID")),
                 sourceId: 0,
-                pageSize: 10,
+                pageSize: 10
               };
-              this.$Post(this.urlsCollection.selectByUser, paramData).then(
-                (userRes) => {
-                  if (userRes.code === 200) {
-                    // console.log(userRes, "获取我的标记疑点数据");
+              this.$Post(this.urlsCollection.selectByUser, paramData).then(userRes => {
+                if (userRes.code === 200) {
+                  // console.log(userRes, "获取我的标记疑点数据");
 
-                    if (userRes.content.length > 0) {
-                      this.$store.state.myLabelPointsArr = [];
-                      this.$store.state.myLabelPointsArr = userRes.content.map(
-                        (v) => {
-                          return {
-                            id: v.id,
-                            geojson: v.geojson,
-                            type: v.type,
-                          };
-                        }
-                      );
-                    }
+                  if (userRes.content.length > 0) {
+                    this.$store.state.myLabelPointsArr = [];
+                    this.$store.state.myLabelPointsArr = userRes.content.map(v => {
+                      return {
+                        id: v.id,
+                        geojson: v.geojson,
+                        type: v.type
+                      };
+                    });
                   }
-                  // 更新时调用一次搜索接口
                 }
-              );
+                // 更新时调用一次搜索接口
+              });
             }
+            // 保存后需要删除地图上的标记
+            this.reStartLabelCase();
           },
-          (error) => {
-            console.log(error);
+          error => {
+            console.log("标记疑点保存失败!", error);
+            this.reStartLabelCase();
           }
         );
       }
@@ -320,9 +307,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);
@@ -345,11 +330,7 @@ export default {
       // 每次点击按钮后重绘弹窗
       if (this.currentHtml && this.currentCid) {
         setTimeout(() => {
-          this.popup
-            .setContent(
-              this.createAuditDiv(this.currentCid, this.currentProperties)
-            )
-            .openOn(map2DViewer.map);
+          this.popup.setContent(this.createAuditDiv(this.currentCid, this.currentProperties)).openOn(map2DViewer.map);
         }, 300);
       }
     },
@@ -357,11 +338,10 @@ export default {
     initDraw() {
       if (!map2DViewer.measureTool) {
         // 引入疑点标记绘制方法
-        map2DViewer.drawToolFire = (data) => {
+        map2DViewer.drawToolFire = data => {
           // 纬经度
           if (data && data.points.length >= 1) {
             let geoType = null;
-            console.log(data, "测试绘制的数据");
             // 类型: 0 点;1 线;2 面;3 矩形;4 圆形;5 其他;
             if (data.points.length === 1 && data.area === 0) {
               geoType = 0;
@@ -397,7 +377,7 @@ 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"
         });
       }
     },
@@ -426,7 +406,7 @@ export default {
         attributionControl: false,
         zoomControl: false,
         minZoom: 10,
-        maxZoom: 16,
+        maxZoom: 16
       }).setView(systemConfig.mapViewer.center, systemConfig.mapViewer.zoom);
 
       //添加默认图层
@@ -440,7 +420,7 @@ export default {
 
             // url: "http://aimap.pudong.sh:5236/maps/rest/services/basemap-shanghai-gem-blue-sh2000/mapserver",
             // tileSize: 512
-            systemConfig.blueBlackMap,
+            systemConfig.blueBlackMap
         })
         .addTo(map2DViewer.map);
       // layer.setStyle({opacity:0,fillOpacity:0})
@@ -458,16 +438,14 @@ 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
-          ) {
+        geoJson.features.map(feature => {
+          if (this.town.indexOf(feature.properties.NAME.replace("镇", "")) > -1) {
             this.renderPolygon(feature);
           }
         });
@@ -512,7 +490,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;
@@ -524,25 +502,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) {
@@ -573,7 +551,7 @@ export default {
       // 纬经度
       // [22474.568725585938, -16689.47381591797]
       // x,y转换
-      coordinates = coordinates.map((v) => {
+      coordinates = coordinates.map(v => {
         let data = transformCoord.shcj_to_wgs84(v[1], [v[0]]);
         data = [data[1], data[0]];
         return data;
@@ -583,10 +561,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 => {
         this.auditPopupShow = true;
         this.popup = L.popup({ maxWidth: 700, maxHeight: 600 })
           .setLatLng(e.latlng)
@@ -599,7 +577,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;
@@ -608,18 +586,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);
@@ -639,7 +615,7 @@ export default {
     //综合分析 - 标记疑点 - 删除面
     deletePolygonLayer(layer) {
       console.log(layer, "layer");
-      map2DViewer.polygons[layer].forEach((polygon) => {
+      map2DViewer.polygons[layer].forEach(polygon => {
         map2DViewer.map.removeLayer(polygon);
       });
     },
@@ -649,7 +625,7 @@ export default {
       if (!map2DViewer.myLabels[`label_${data.id}`]) {
         // console.log("开始绘制点", data);
         let point = L.marker(data.coord, {
-          opacity: 1,
+          opacity: 1
         }).addTo(map2DViewer.map);
         map2DViewer.myLabels[`label_${data.id}`] = point;
       }
@@ -663,15 +639,13 @@ export default {
           weight: 3,
           fillOpacity: color,
           opacity: 1,
-          fillOpacity: 0.4,
+          fillOpacity: 0.4
         }).addTo(map2DViewer.map);
         // zoom the map to the polyline
         map2DViewer.map.fitBounds(polyline.getBounds());
         map2DViewer.myLabels[`label_${data.id}`] = polyline;
       } else {
-        map2DViewer.map.fitBounds(
-          map2DViewer.myLabels[`label_${data.id}`].getBounds()
-        );
+        map2DViewer.map.fitBounds(map2DViewer.myLabels[`label_${data.id}`].getBounds());
       }
     },
     drawPolygon(data, color) {
@@ -683,14 +657,12 @@ export default {
           weight: 3,
           fillOpacity: color,
           opacity: 1,
-          fillOpacity: 0.4,
+          fillOpacity: 0.4
         }).addTo(map2DViewer.map);
         map2DViewer.map.fitBounds(polygon.getBounds());
         map2DViewer.myLabels[`label_${data.id}`] = polygon;
       } else {
-        map2DViewer.map.fitBounds(
-          map2DViewer.myLabels[`label_${data.id}`].getBounds()
-        );
+        map2DViewer.map.fitBounds(map2DViewer.myLabels[`label_${data.id}`].getBounds());
       }
     },
 
@@ -704,24 +676,21 @@ export default {
           let to = turf.point(coordinates[1].reverse());
           let options = { units: "kilometers" };
           let distance = turf.distance(from, to, options);
-          (distance = parseFloat(distance * 1000).toFixed(6)),
-            console.log(distance, "圆的半径");
+          (distance = parseFloat(distance * 1000).toFixed(6)), console.log(distance, "圆的半径");
           let circle = L.circle(coordinates[0].reverse(), {
             color: color,
             weight: 3,
             fillOpacity: color,
             opacity: 1,
             fillOpacity: 0.4,
-            radius: Number(distance),
+            radius: Number(distance)
           }).addTo(map2DViewer.map);
           console.log(circle);
           map2DViewer.map.fitBounds(circle.getBounds());
           map2DViewer.myLabels[`label_${data.id}`] = circle;
         }
       } else {
-        map2DViewer.map.fitBounds(
-          map2DViewer.myLabels[`label_${data.id}`].getBounds()
-        );
+        map2DViewer.map.fitBounds(map2DViewer.myLabels[`label_${data.id}`].getBounds());
       }
     },
     /**
@@ -750,8 +719,8 @@ export default {
         console.log(geometry, "移除");
         geometry.removeFrom(map2DViewer.map);
       }
-    },
-  },
+    }
+  }
 };
 </script>
 <style lang="less" scoped>

+ 5 - 0
src/store/index.js

@@ -17,6 +17,8 @@ export default new Vuex.Store({
     backMenu: {},
     // 底部菜单选中菜单index,subIndex(主要用于元素判断是否高亮)
     bottomMenuIndexs: { index: -1, subIndex: -1 },
+    // 卷帘对比状态同步
+    jlActiveState: false,
     // 当前浏览器窗口的宽高(优化自适应布局)
     windowsSize: {
       width: document.body.clientWidth,
@@ -56,6 +58,9 @@ export default new Vuex.Store({
     changeBackMenu(state, backMenu) {
       state.backMenu = backMenu;
     },
+    changeJlActiveState(state, jlActiveState) {
+      state.jlActiveState = jlActiveState;
+    },
     // 用户信息修改(登录或退出时操作)
     changeUserInfo(state, userInfo) {
       state.userInfo = userInfo;