Pārlūkot izejas kodu

登录我的标记bug

Bella 2 gadi atpakaļ
vecāks
revīzija
3e0925b113
2 mainītis faili ar 131 papildinājumiem un 30 dzēšanām
  1. 1 1
      src/assets/global.css
  2. 130 29
      src/views/ComprehensiveAnalysis.vue

+ 1 - 1
src/assets/global.css

@@ -2,7 +2,7 @@
 /*滚动条整体部分*/
 ::-webkit-scrollbar {
   width: 5px;
-  height: 10px;
+  height: 5px;
 }
 /*正常情况下滑块的样式*/
 ::-webkit-scrollbar-thumb {

+ 130 - 29
src/views/ComprehensiveAnalysis.vue

@@ -34,7 +34,7 @@
       </el-input>
     </div>
     <div class="comprehensive-analysis-infobox">
-      当前显示的疑点数 : {{ currentTotal }}
+      当前显示的疑点数 : &nbsp;<span>{{ currentTotal }}</span>
     </div>
     <!-- 属性弹窗 -->
     <AttributePopup
@@ -349,11 +349,20 @@ export default {
         pageSizes: [5, 10, 20, 30],
         total: 50,
         currentChange: (val) => {
+          // debugger;
           let columnId = this.enteredColumnId;
+          let currentPageSize = this.currentPageSize;
           let panelId = this.enteredPanelId;
           let mainType = this.enteredMainType;
           let sourceType = this.enteredSourceType;
-          this.changeSingleLayer(val, columnId, panelId, mainType, sourceType);
+          this.changeSingleLayer(
+            val,
+            currentPageSize,
+            columnId,
+            panelId,
+            mainType,
+            sourceType
+          );
         },
         handleSizeChange: (val) => {
           this.handleSizeChange(val);
@@ -407,8 +416,12 @@ export default {
       }
     },
     "$store.state.navSelect": {
-      handler(val) {
-        if (val.index === "1" || val.index === "2") {
+      handler(val, oldVal) {
+        if (
+          (val.index === "1" || val.index === "2") &&
+          oldVal.index &&
+          oldVal.index === "3"
+        ) {
           this.clearAllData();
           this.labelAllVisibleChecked = false;
         }
@@ -417,6 +430,7 @@ export default {
           // 如果没有初始化设置
           if (!map2DViewer.groups["我的标记图层组"]) {
             this.getUserMarkers();
+            this.activeNames = ["myLabel"];
           }
           this.labelAllVisibleChecked = true;
           // 进入该页面后监听地图移动事件
@@ -556,28 +570,31 @@ export default {
   },
 
   mounted() {
+    // console.log("请求综合分析页面");
     // 获取我的标记数据
-    if (this.$store.state.navSelect.index === "3") {
-      this.getUserMarkers();
-      map2DViewer.map.on("move", (e) => {
-        if (!this.isLeftLock) {
-          this.showLeftBox = false;
-          this.leftBoxBtn = true;
-        }
-
-        if (!this.isRightLock) {
-          this.showRightBox = false;
-          this.rightBoxBtn = true;
-        }
-      });
-
-      this.$bus.$off("viewDetailsPopup");
-      this.$bus.$on("viewDetailsPopup", (data) => {
-        this.viewDetailsPopup(data);
-      });
-    }
+    // if (this.$store.state.navSelect.index === "3") {
+    // this.activeNames = ["myLabel"];
+    // this.getUserMarkers();
+    // map2DViewer.map.on("move", (e) => {
+    //   if (!this.isLeftLock) {
+    //     this.showLeftBox = false;
+    //     this.leftBoxBtn = true;
+    //   }
+
+    //   if (!this.isRightLock) {
+    //     this.showRightBox = false;
+    //     this.rightBoxBtn = true;
+    //   }
+    // });
+
+    this.$bus.$off("viewDetailsPopup");
+    this.$bus.$on("viewDetailsPopup", (data) => {
+      this.viewDetailsPopup(data);
+    });
+    // }
   },
   // beforeDestroy() {
+  //   console.log("组件已销毁");
   //   this.clearAllData();
   // },
   methods: {
@@ -636,6 +653,10 @@ export default {
     },
     // 清除页面所有数据
     clearAllData() {
+      // if (map2DViewer.groups["我的标记图层组"]) {
+      //   map2DViewer.map.removeLayer(map2DViewer.groups["我的标记图层组"]);
+      //   // delete map2DViewer.groups["我的标记图层组"];
+      // }
       // uploadDataIdArr = [];
       // this.treeCoordMap.clear();
       map2DViewer.map.off("move");
@@ -682,6 +703,7 @@ export default {
       this.currentPageSize = val;
       this.changeSingleLayer(
         this.currentPage,
+        this.currentPageSize,
         this.enteredColumnId,
         this.enteredPanelId,
         this.enteredMainType,
@@ -710,6 +732,7 @@ export default {
         background: "transparent",
         border: `1px solid ${this.randomColor.get(uniqueId)}`,
       });
+      // 图层未初始化
       if (!map2DViewer.analysisGroups[uniqueId]) {
         if (!this.layerLoading) {
           this.layerLoading = true;
@@ -733,8 +756,8 @@ export default {
             }
             if (res.code === 200 && res.content.data.length > 0) {
               console.log(res.content.count, "count");
-              this.paginationData.currentPage = 1;
-              this.paginationData.total = res.content.count;
+              // this.paginationData.currentPage = 1;
+              this.paginationData.total = res.content.data.length;
               map2DViewer.analysisGroups[uniqueId] = L.featureGroup();
               map2DViewer.analysisGroups[uniqueId].addTo(map2DViewer.map);
               // this.legendTitle.push({
@@ -789,6 +812,25 @@ export default {
                   secret_level: ele.secret_level,
                 };
               });
+
+              this.currentTotal += this.originalData[uniqueId].length;
+              console.log(
+                "target",
+                this.currentPageSize,
+                columnId,
+                id,
+                mainType,
+                sourceType
+              );
+              // 进行分页列表展示
+              this.changeSingleLayer(
+                1,
+                this.currentPageSize,
+                columnId,
+                id,
+                mainType,
+                sourceType
+              );
             }
           },
           (error) => {
@@ -797,6 +839,8 @@ export default {
           }
         );
       }
+
+      // 图层已初始化
       if (map2DViewer.analysisGroups[uniqueId]) {
         map2DViewer.map.addLayer(map2DViewer.analysisGroups[uniqueId]);
         this.originalData[uniqueId] = [];
@@ -826,17 +870,20 @@ export default {
               secret_level: ele.secret_level,
             };
           });
+
+        this.currentTotal += this.originalData[uniqueId].length;
       }
     },
     /**
      * 切换页时改变图层数据
      * @val 当前页
+     * @currentPageSize 当前面板pageSize
      * @columnId
      * @id label_columnId
      * @mainType 所有图层/预设模型
      * @sourceType 土地资源,水资源,林地资源,全部
      */
-    changeSingleLayer(val, columnId, id, mainType, sourceType) {
+    changeSingleLayer1(val, columnId, id, mainType, sourceType) {
       let layerParams = new FormData();
       layerParams = {
         columnId: columnId,
@@ -849,7 +896,7 @@ export default {
           // console.log(res, "changeSingeLayer");
           if (res.code === 200 && res.content.data.length > 0) {
             this.paginationData.currentPage = val;
-            this.paginationData.total = res.content.count;
+            this.paginationData.total = res.content.data.length;
             let uniqueId = id;
             if (map2DViewer.analysisGroups[uniqueId]) {
               this.layerIdMap.set(uniqueId, uniqueId);
@@ -895,6 +942,59 @@ export default {
         }
       );
     },
+
+    changeSingleLayer(
+      val,
+      currentPageSize,
+      columnId,
+      id,
+      mainType,
+      sourceType
+    ) {
+      console.log(val, "页面已切换");
+      let uniqueId = id;
+      if (map2DViewer.analysisGroups[uniqueId]) {
+        this.paginationData.currentPage = val;
+        // this.layerIdMap.set(uniqueId, uniqueId);
+        // map2DViewer.analysisGroups[uniqueId].clearLayers();
+        this.originalData[uniqueId] = [];
+        let oldData = this.originalDataMap.get(uniqueId);
+        if (val * currentPageSize <= oldData.length - 1) {
+          this.originalData[uniqueId] = oldData.slice(
+            (val - 1) * currentPageSize,
+            val * currentPageSize
+          );
+        } else {
+          this.originalData[uniqueId] = oldData.slice(page - 1, oldData.length);
+        }
+
+        this.originalData[uniqueId] = this.originalData[uniqueId].map((ele) => {
+          return {
+            id: ele.id,
+            column_name: ele.column_name,
+            // 是否疑点
+            c_boolean: ele.c_boolean ? "是" : "否",
+            // 行政区划
+            c_xzqh: ele.c_xzqh,
+            // 空间信息
+            c_content: ele.c_content,
+            // 疑点修改时间
+            c_date_time: ele.c_date_time,
+            // 修改人员名称
+            // c_editor_name: ele.c_editor_name,
+            // 标题
+            title: ele.title,
+            column_id: ele.column_id,
+            content: ele.content,
+            secret_level: ele.secret_level,
+          };
+        });
+
+        console.log(uniqueId, this.originalData, "当前页面数据");
+        // 激活当前展开面板
+        this.activeNames = ["myLabel", uniqueId];
+      }
+    },
     // 数据字典查询 -- 根据内容获取对应的index
     // this.classTextToIndex["任务类型"]
     classDictQuery(type, cName, keyName) {
@@ -1317,6 +1417,7 @@ export default {
             ];
           }
           if (this.originalData && this.originalData[data.id]) {
+            this.currentTotal -= this.originalData[data.id].length;
             delete this.originalData[data.id];
           }
           map2DViewer.map.closePopup();
@@ -1354,7 +1455,7 @@ export default {
     },
     // 显示我的模型数据
     displayMyModelData(data) {
-      debugger;
+      // debugger;
       let uniqueId = data.id;
       // 我的模型图层组初始化
       if (!map2DViewer.analysisGroups[uniqueId]) {
@@ -1720,7 +1821,7 @@ export default {
   }
 
   &-infobox {
-    width: 200px;
+    width: 250px;
     height: 40px;
     display: flex;
     align-items: center;