Browse Source

监测图斑图斑详情查询

maxiaoxiao 7 months ago
parent
commit
e5046780d7
1 changed files with 43 additions and 37 deletions
  1. 43 37
      src/views/farmlandProtection/components/tbqd.vue

+ 43 - 37
src/views/farmlandProtection/components/tbqd.vue

@@ -7,6 +7,10 @@
           placeholder="请输入监测编号搜索"
           @keyup.enter.native="initNew(true)"
         ></el-input>
+        <span class="clearBtn" @click="cockpit">
+          <i class="el-icon-thumb"></i>
+          图斑详情查询
+        </span>
         <span>共{{ total }}条</span>
       </div>
       <div class="pagination">
@@ -141,6 +145,7 @@ import * as turf from "@turf/turf";
 import { QueryOne, QueryList } from "@/api/cockpitNew";
 import { loadGeoJSON, removeGeoJSON } from "@/utils/MapHelper/help.js";
 import { JctbList, ewktToenvelope, getJctbInfo } from "@/api/ghss/jctb.js";
+import * as pick_cockpit_vector from "@/components/Query/clickQuery/pick_cockpit_vector.js";
 let layerSources = {};
 export default {
   props: {
@@ -162,7 +167,11 @@ export default {
       tempdataLayerId: null,
     };
   },
-  computed: {},
+  computed: {
+    computed_vectorData() {
+      return store.state.vectorData;
+    },
+  },
   mounted() {
     // this.init();
     // this.initNew()
@@ -194,15 +203,6 @@ export default {
       removeGeoJSON("farmlandjc");
       maplist.forEach((item) => {
         ewkt.push(item.geom);
-        if (item.geom) {
-          item.type = "图斑上图";
-          loadGeoJSON(item.geom, "#ff0000", {}, (data) => {
-            data.name = "farmlandjc";
-            data.entities.values.forEach((entity) => {
-              entity.properties = item;
-            });
-          });
-        }
       });
       ewktToenvelope({ ewkt }).then((res) => {
         loadGeoJSON(
@@ -215,7 +215,10 @@ export default {
           },
           (data) => (data.name = "farmlandjc")
         );
+        this.getMapList(maplist);
       });
+
+      pick_cockpit_vector.init_handler();
     },
     handleClick(item) {
       removeGeoJSON("farmlandjch");
@@ -223,27 +226,16 @@ export default {
       if (!item.geom) {
         this.$message.warning("缺少定位图斑");
       } else {
-        this.tempdataLayerId = "h_" + item.index;
-        loadGeoJSON(
-          item.geom,
-          "#43EDED",
-          { isfly: true, sw: 5 },
-          (data) => {
-            let mul = "HORIZONTAL";
-            data.name = "farmlandjch";
-            // scene.multiViewportMode = Cesium.MultiViewportMode[mul];
-            layerSources["h_" + item.index] = data;
-            // data.setVisibleInViewport(1, false);
-            data.entities.values.forEach((entity) => {
-              entity.properties = item;
-            });
-          }
-          // item.geom.type == "MultiPolygon" ? 5 : 100
-        );
+        loadGeoJSON(item.geom, "#43EDED", { isfly: true, sw: 5 }, (data) => {
+          data.name = "farmlandjch";
+          data.entities.values.forEach((entity) => {
+            entity.properties = { type: "图斑上图", id: item.id };
+          });
+        });
       }
     },
-    handleDetails(row) {
-      this.handleClick(row);
+    handleDetails(row, isfly = true) {
+      if (isfly) this.handleClick(row);
       this.$emit("updateParent", "isShowTb", true);
       getJctbInfo(row.id).then((res) => {
         if (res.code == 200) {
@@ -260,17 +252,21 @@ export default {
       this.initNew(false);
     },
     getMapList(newVal) {
-      newVal.forEach((item, index) => {
-        item.type = "图斑上图";
-        if (item.geom)
-          loadGeoJSON(item.geom, "#55A1E3", { isfly: false }, (data) => {
-            layerSources[item.id] = data;
+      newVal.forEach((item) => {
+        if (item.geom) {
+          loadGeoJSON(item.geom, "#ff0000", {}, (data) => {
+            data.name = "farmlandjc";
             data.entities.values.forEach((entity) => {
-              entity.properties = item;
+              entity.properties = { type: "图斑上图", ...item };
             });
           });
+        }
       });
     },
+    cockpit() {
+      //驾驶舱矢量数据点选查询
+      pick_cockpit_vector.init_handler();
+    },
   },
   watch: {
     updateObj: {
@@ -300,10 +296,20 @@ export default {
         layerSources[oldVal] = null;
       }
     },
+    computed_vectorData(newVal) {
+      newVal.forEach((res) => {
+        if (res.name == "id") {
+          this.handleDetails({ id: res.value }, false);
+        }
+      });
+    },
   },
   beforeDestroy() {
-    viewer.dataSources.removeAll();
-    viewer.entities.removeAll();
+    // viewer.dataSources.removeAll();
+    // viewer.entities.removeAll();
+    removeGeoJSON("farmlandjc");
+    removeGeoJSON("farmlandjch");
+    pick_cockpit_vector.clear_data(); //矢量拾取清除
   },
 };
 </script>