Ver código fonte

添加标记,删除标记,修改标记等互动操作

Bella 2 anos atrás
pai
commit
551386976f

Diferenças do arquivo suprimidas por serem muito extensas
+ 11652 - 1
package-lock.json


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

@@ -642,9 +642,7 @@ map2DViewer.setDrawTool = function (options) {
         }
         this.measureTool.remove();
         this.measureTool = null
-        // map2DViewer.map.removeControl(map2DViewer.measureTool);
         map2DViewer.measureTool = null;
-        console.log(map2DViewer.measureTool, "检查map中是否还存在control");
       }
 
       break;

+ 2 - 10
src/components/common/BottomMenus.vue

@@ -19,8 +19,6 @@
     <UploadingData @changeShowBottomMenusStatus="changeShowBottomMenusStatus" />
     <!-- 自定义模型 -->
     <CustomModelDialog />
-    <!-- 报告输出弹窗 -->
-    <ReportOutput @changeShowBottomMenusStatus="changeShowBottomMenusStatus"/>
     <!-- 底部菜单主体 -->
     <div
       id="menusBox"
@@ -89,7 +87,6 @@ import MyMission from "./BottomForm/MyMission.vue";
 import SameScreenComparison from "./BottomForm/SameScreenComparison.vue";
 import UploadingData from "./BottomForm/UploadingData.vue";
 import CustomModelDialog from "./BottomForm/CustomModelDialog.vue";
-import ReportOutput from "./BottomForm/ReportOutput.vue";
 export default {
   name: "BottomMenus",
   components: {
@@ -99,7 +96,6 @@ export default {
     SameScreenComparison,
     UploadingData,
     CustomModelDialog,
-    ReportOutput
   },
   data() {
     return {
@@ -155,7 +151,7 @@ export default {
           index: 2,
           width: "94px",
           title: "疑点报告",
-          subMenu: [{ index: 0, title: "报告输出", bgImage: "bgsc", clickEmit: "ReportOutput"  }],
+          subMenu: [{ index: 0, title: "报告输出", bgImage: "bgsc" }],
         },
         {
           index: 3,
@@ -172,10 +168,6 @@ export default {
   methods: {
     // 根据菜单父级index和子菜单index,判断全局变量已选中底部菜单的index对比,返回状态。
     ifMenuIndex(index, subIndex) {
-      // return (
-      //   this.$store.state.bottomMenuIndexs.index == index &&
-      //   this.$store.state.bottomMenuIndexs.subIndex == subIndex
-      // );
       if (index == 1) {
         if (subIndex === 0 || subIndex === 1 || subIndex ===3) {
           return (
@@ -183,7 +175,7 @@ export default {
             this.$store.state.bottomMenuIndexs.subIndex == subIndex
           );
         }
-        // this.$store.state.bottomMenuIndexs.index = 1
+
       }
     },
     // 根据菜单父级index和子菜单index,更新全局变量。

+ 8 - 13
src/components/map/MapHolder.vue

@@ -40,6 +40,7 @@ export default {
       this.caseAuditEvent();
     });
 
+
     //地图初始化
     this.mapInit();
 
@@ -180,8 +181,8 @@ export default {
           $(`#${str}_id input`).click((e) => {
             console.log(e.target.defaultValue);
             switch (e.target.defaultValue) {
-              case "删除":
-                this.deleteBtnEvent(str);
+              case "取消":
+                this.cancelBtnEvent();
                 break;
               case "保存":
                 this.saveBtnEvent(str, data, geoType);
@@ -199,8 +200,9 @@ export default {
     confirmBtnEvent() {
       console.log("用户点击地图中的确认按钮");
     },
-    deleteBtnEvent() {
-      console.log("delete btn");
+    cancelBtnEvent() {
+      map2DViewer.map.closePopup();
+      this.labelPopup = null;
     },
 
     /**
@@ -220,8 +222,7 @@ export default {
           geoType,
           coordinates
         );
-        console.log(data, "标记疑点 -- 绘制的疑点信息");
-        console.log(geometry, "转换后的geoJson数据");
+
         let params = new FormData();
 
         params = {
@@ -289,7 +290,6 @@ export default {
     },
     // 疑点审计
     caseAuditEvent() {
-      // console.log("case audit");
       // 每次点击按钮后重绘弹窗
       if (this.currentHtml && this.currentCid) {
         setTimeout(() => {
@@ -335,11 +335,6 @@ export default {
               this.labelDetailsPopupShow = false;
             }
           }
-          // try {
-
-          // } catch (e) {
-          //   console.log("引入疑点标记绘制方法 error");
-          // }
         };
         map2DViewer.setDrawTool({
           action: "add",
@@ -555,7 +550,7 @@ export default {
   },
 };
 </script>
-<style scoped>
+<style lang="less" scoped>
 #map2DViewer {
   position: absolute;
   width: 100%;

+ 19 - 27
src/components/popup/LabelCasePopup.vue

@@ -1,9 +1,9 @@
 <template>
-  <MenuCard class="label-case" :menuData="menuData" v-drag>
+  <MenuCard class="label-case" :menuData="menuData">
     <div class="label-case-inner">
       <div class="top">
-        <div class="top-title">标记点分类 :</div>
-        <select class="top-select">
+        <div class="top-title">标记点分类:</div>
+        <select class="top-select" v-model="selectVal">
           <option value="土地资源">土地资源</option>
           <option value="林业资源">林业资源</option>
           <option value="水资源">水资源</option>
@@ -12,12 +12,15 @@
       <div class="center">
         <div class="center-title">描述:</div>
         <div class="center-text">
-          <textarea placeholder="请输入详细信息"></textarea>
+          <textarea
+            placeholder="请输入详细信息"
+            v-model="textContent"
+          ></textarea>
         </div>
       </div>
       <div class="footer">
-        <input type="button" value="删除" @click="modifyEvent" />
-        <input type="button" value="保存" @click="confirmEvent" />
+        <input type="button" value="取消" @click="cancelEvent" />
+        <input type="button" value="保存" @click="saveEvent" />
       </div>
     </div>
   </MenuCard>
@@ -38,33 +41,21 @@ export default {
       menuData: {
         type: "chart",
         title: "添加标记",
-        boxWidth: "500",
-        boxHeight: "361",
+        boxWidth: "380",
+        boxHeight: "300",
       },
       selectVal: "土地资源",
-      selectOptions: [
-        {
-          value: "土地资源",
-          label: "土地资源",
-        },
-        {
-          value: "林业资源",
-          label: "林业资源",
-        },
-        {
-          value: "水资源",
-          label: "水资源",
-        },
-      ],
-      textarea: "",
+      textContent: "",
+      id:null,
+      geojson:"",
     };
   },
   methods: {
-    modifyEvent() {
-      console.log("modify");
+    cancelEvent() {
+      this.$emit("close");
     },
-    confirmEvent() {
-      console.log("confirm");
+    saveEvent() {
+      this.$emit("save");
     },
   },
 };
@@ -73,6 +64,7 @@ export default {
 .label-case {
   position: relative;
   cursor: auto;
+  pointer-events: auto;
   &-inner {
     width: 100%;
     height: 100%;

+ 3 - 2
src/utils/publicFunction.js

@@ -103,15 +103,16 @@ const generateGeoJSON = (title, desc, featureType, coords) => {
       title: title || "",
       desc: desc || "",
       featureType: propertiesType,
+      featureTypeIndex:featureType
     },
     geometry: {
       coordinates: coords,
-      // coordinates: [
+      // coordinates: [[
       //   [114.1199232448792, 35.33694447387694],
       //   [113.75754748638985, 31.716871012257627],
       //   [109.28122464218609, 32.06198896315057],
       //   [109.70940919390267, 34.543087977545525],
-      // ],
+      // ]],
       type: dataType,
     },
   };

+ 163 - 61
src/views/ComprehensiveAnalysis.vue

@@ -1,16 +1,25 @@
 <template>
   <div class="comprehensive-analysis">
-    <LawPopup class="popup-style" />
+    <LawPopup class="comprehensive-analysis-law-popup" />
+    <LabelCasePopup
+      class="comprehensive-analysis-label-popup"
+      style="left: 40%"
+      v-if="updateCasePopupShow"
+      ref="updateLabelRef"
+      @close="closeLabelEvent"
+      @save="modifyLabelEvent"
+    />
     <div class="comprehensive-analysis-backbtn" @click="backEvent">
       <div class="left-arrow"></div>
       <div class="title">返回上级</div>
     </div>
     <div class="comprehensive-analysis-searchbox">
-      <el-input placeholder="请输入地点" v-model="addressInput">
+      <el-input placeholder="请输入地名地址" v-model="addressInput">
         <el-button
           type="primary"
           slot="append"
           icon="el-icon-search"
+          style="vertical-align: bottom"
         ></el-button>
       </el-input>
     </div>
@@ -172,7 +181,7 @@
                   class="panel-list-item"
                   v-for="i in originalData[key]"
                   :key="i.id"
-                  @click="listItemClick('default', i)"
+                  @click.stop="listItemClick('default', i)"
                 >
                   {{ i.name }}
                 </div>
@@ -183,9 +192,33 @@
                   class="panel-list-item"
                   v-for="item in rightLabelData"
                   :key="item.id"
-                  @click="listItemClick('new', item)"
                 >
-                  {{ item.name }}
+                  <div @click="listItemClick('new', item)">
+                    {{ item.name }}
+                  </div>
+                  <span
+                    style="
+                      position: absolute;
+                      right: 100px;
+                      top: 0;
+                      display: flex;
+                      align-items: center;
+                      justify-content: space-around;
+                      width: 75px;
+                    "
+                    ><el-button
+                      size="normal"
+                      type="text"
+                      icon="el-icon-edit"
+                      @click="updateLabel(item)"
+                    ></el-button
+                    ><el-button
+                      size="normal"
+                      type="text"
+                      icon="el-icon-delete"
+                      @click="deleteLabel(item.id)"
+                    ></el-button
+                  ></span>
                 </div>
               </el-collapse-item>
             </el-collapse>
@@ -202,6 +235,7 @@ import Legend from "@/components/map/Legend.vue";
 import publicFun from "@/utils/publicFunction.js";
 import { treeModel, defaultLayers } from "@/config/common";
 import AttributePopup from "@/components/popup/AttributePopup.vue";
+import LabelCasePopup from "@/components/popup/LabelCasePopup.vue";
 import LawPopup from "@/components/popup/LawPopup.vue";
 import { get } from "@/utils/request";
 import { nextTick } from "vue";
@@ -212,52 +246,27 @@ export default {
     Legend,
     AttributePopup,
     LawPopup,
+    LabelCasePopup,
   },
   data() {
     return {
       addressInput: "",
       legendShow: false,
+      // 修改标记弹窗
+      updateCasePopupShow: false,
+      // 属性信息弹窗
+      attrTableShow: false,
       tableType: "normal",
       tableData: [],
       legendHeight: "0",
       boxWidth: "600",
       boxHeight: "600",
-      attrTableShow: false,
+
       activeNames: ["myLabel"],
       rightPanelTitle: "",
       rightPanelDataMap: new Map(),
       originalData: {},
-      rightLabelData: [
-        // {
-        //   id: publicFun.buildGuid(),
-        //   name: "疑点1",
-        // },
-        // {
-        //   id: publicFun.buildGuid(),
-        //   name: "疑点2",
-        // },
-        // {
-        //   id: publicFun.buildGuid(),
-        //   name: "疑点3",
-        // },
-        // {
-        //   id: publicFun.buildGuid(),
-        //   name: "疑点4",
-        // },
-        // {
-        //   id: publicFun.buildGuid(),
-        //   name: "疑点5",
-        // },
-        // {
-        //   id: publicFun.buildGuid(),
-        //   name: "疑点6",
-        // },
-        // {
-        //   id: publicFun.buildGuid(),
-        //   name: "疑点7",
-        // },
-      ],
-      // searchInput: "",,
+      rightLabelData: [],
       showLeftBox: true,
       showRightBox: true,
       leftBoxBtn: false,
@@ -300,9 +309,6 @@ export default {
             console.log(val, "678");
             // 设置默认勾选项
             this.$refs.tree.setCheckedKeys([treeIdMap.get(val)]);
-            // this.$store.state.mapMethodsCollection
-            //   .get("RENDER")
-            //   .setView(coordinates, 16);
           }
         });
       },
@@ -344,18 +350,10 @@ export default {
       },
       deep: true,
     },
-    // getMyPoints:{
-    //   handler(val){
-    //     console.log(getMyPoints,"myPoints");
-    //   },
-    //   deep:true,
-    //   immediate:true
-    // }
     getMyLabelData: {
       handler(val) {
-        // console.log(val, "获取我的疑点数组");
+        this.rightLabelData = [];
         if (val.length > 0) {
-          console.log("获取的我的疑点数据", val);
           this.rightLabelData = val.map((v, i) => {
             let data = JSON.parse(v.geojson);
             return {
@@ -364,12 +362,14 @@ export default {
               coord: data.geometry.coordinates[0][0],
               type: data.properties.title,
               des: data.properties.desc,
+              geojson: v.geojson,
             };
           });
+          console.log(this.rightLabelData, "rightLabelData");
         }
       },
       deep: true,
-      immediate: true,
+      // immediate: true,
     },
   },
   created() {
@@ -436,7 +436,8 @@ export default {
           pageSize: 10,
         };
         this.$Post(this.urlsCollection.selectByUser, paramData).then((res) => {
-          if (res.code === 200 && res.content.length > 0) {
+          if (res.code === 200 && res.content.length >= 1) {
+            console.log(res);
             this.$store.state.myLabelPointsArr = [];
             this.$store.state.myLabelPointsArr = res.content.map((v) => {
               return {
@@ -446,6 +447,11 @@ export default {
               };
             });
           }
+
+          // res.content 返回数据为空
+          if (res.code === 205) {
+            this.$store.state.myLabelPointsArr = [];
+          }
         });
       }
     },
@@ -546,9 +552,6 @@ export default {
             let firstPolygon = JSON.parse(JSON.stringify(geoJson[0]));
             let coordinates = firstPolygon.geometry.coordinates[0][0][0];
             this.treeCoordMap.set(data.label, coordinates);
-            // this.$store.state.mapMethodsCollection
-            //   .get("RENDER")
-            //   .setView(coordinates, 16);
 
             this.$store.state.mapMethodsCollection
               .get("RENDER")
@@ -592,11 +595,12 @@ export default {
         };
       });
     },
+    // 右侧面板项点击事件
     listItemClick(type, data) {
-      // data
-      // id: "default_1669007689253APblgwSrDZlV1kSFim";
-      // name: "疑点1";
+      this.$store.state.bottomMenuIndexs.index = -1;
+      this.$store.state.bottomMenuIndexs.subIndex = -1;
       this.attrTableShow = true;
+      this.updateCasePopupShow = false;
       this.tableData = [];
       if (type === "default") {
         let coord = data.geometry.coordinates[0][0][0];
@@ -625,24 +629,109 @@ export default {
           type: data.type,
           des: data.des,
         });
-        console.log(data, "myLabelTable");
+        this.$bus.$emit("listItemClick", data);
       }
     },
     closeEvent() {
       this.attrTableShow = false;
     },
+    // 关闭修改标记弹窗
+    closeLabelEvent() {
+      this.updateCasePopupShow = false;
+    },
+    modifyLabelEvent() {
+      this.$nextTick(() => {
+        let selectType = this.$refs.updateLabelRef.selectVal;
+        let desContent = this.$refs.updateLabelRef.textContent;
+        let id = this.$refs.updateLabelRef.id;
+        let params = new FormData();
+        let geojson = JSON.parse(this.$refs.updateLabelRef.geojson);
+        let geometryType = geojson.properties.featureTypeIndex;
+        // 修改标题和描述
+        geojson.properties.title = selectType;
+        geojson.properties.desc = desContent;
+        console.log(geojson, "修改后的geojson数据");
+        params = {
+          userId: Number(localStorage.getItem("USER_ID")),
+          sourceId: 0,
+          type: geometryType,
+          geojson: JSON.stringify(geojson),
+          id: id,
+        };
+        this.$Post(this.urlsCollection.updateConllection, params).then(
+          (res) => {
+            if (res.code === 200) {
+              console.log("修改成功", res);
+              this.updateCasePopupShow = false;
+              this.getUserMarkers();
+            }
+          },
+          (error) => {
+            this.$message.error("保存失败");
+            console.log(error);
+          }
+        );
+      });
+    },
+    // 修改标记 -- 仅支持修改类型和描述
+    updateLabel(val) {
+      console.log("修改标记", val);
+      this.$store.state.bottomMenuIndexs.index = -1;
+      this.$store.state.bottomMenuIndexs.subIndex = -1;
+      this.updateCasePopupShow = true;
+      this.attrTableShow = false;
+      this.this.$nextTick(() => {
+        console.log(this.$refs.updateLabelRef, "updateLabelRef");
+        this.$refs.updateLabelRef.selectVal = val.type;
+        this.$refs.updateLabelRef.textContent = val.des;
+        this.$refs.updateLabelRef.id = val.id;
+        this.$refs.updateLabelRef.geojson = val.geojson;
+      });
+    },
+    // 删除标记
+    deleteLabel(id) {
+      if (localStorage.getItem("USER_ID")) {
+        console.log("删除标记");
+        let params = new FormData();
+        params = {
+          userId: Number(localStorage.getItem("USER_ID")),
+          sourceId: 0,
+          id: id,
+        };
+        this.$Post(this.urlsCollection.deleteConllection, params).then(
+          (res) => {
+            if (res.code === 200) {
+              console.log("疑点删除成功");
+              this.getUserMarkers();
+              // this.rightLabelData.forEach((v, i) => {
+              //   if (v.id === id) {
+              //     this.rightLabelData.splice(i, 1);
+              //   }
+              // });
+            }
+          }
+        );
+      }
+    },
   },
 };
 </script>
 <style lang="less" scoped>
 @commonBorderColor: rgb(0, 170, 255);
 .comprehensive-analysis {
-  .popup-style {
+  &-law-popup {
     position: absolute;
     top: 15%;
     left: 33%;
-    // pointer-events: auto;
-    z-index: 2;
+    pointer-events: auto;
+    z-index: 99;
+  }
+  &-label-popup {
+    position: absolute;
+    top: 15%;
+    left: 35%;
+    pointer-events: auto;
+    z-index: 99;
   }
   .el-checkbox {
     color: #fff;
@@ -690,6 +779,18 @@ export default {
     left: 21%;
     top: 30px;
     pointer-events: auto;
+    /deep/.el-input-group__append,
+    .el-input-group__prepend {
+      background-color: transparent;
+      color: #fff;
+      border-left: none;
+      // border: none;
+      // border-radius: 1px;
+    }
+    /deep/.el-input-group--append .el-input__inner,
+    .el-input-group__prepend {
+      border-right: none;
+    }
   }
 
   &-backbtn {
@@ -978,6 +1079,7 @@ export default {
           content: "";
         }
         .panel-list-item {
+          position: relative;
           margin: 0 auto;
           width: 80%;
           height: auto;

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff