Browse Source

整治项目对比

maxiaoxiao 7 months ago
parent
commit
0f983b5b24

+ 4 - 15
src/views/LandConsolidation/components/contrast.vue

@@ -56,7 +56,7 @@ import {
   initroller,
   useRoller,
 } from "@/utils/MapHelper/map.js";
-import { loadGeoJSON } from "@/utils/MapHelper/help.js";
+import { loadGeoJSON, removeGeoJSON } from "@/utils/MapHelper/help.js";
 import AsideBottom from "./AsideBottom.vue";
 import { QueryList } from "@/api/cockpitNew";
 let geoSources = {};
@@ -90,9 +90,9 @@ export default {
   },
   methods: {
     closeInster() {
-      console.log("ssss");
       this.onClick(-1);
       removeGeoJSON("fpdb");
+      this.nolayer = this.layersData[0].year;
       this.$emit("close");
     },
     show(data) {
@@ -114,14 +114,11 @@ export default {
         geoSources[`${name}h`].setVisibleInViewport(1, checked);
         // geodata.show = checked;
       }
-
-      console.log(`${name}${i ? "h" : "q"}`, i, checked);
     },
 
     clickml() {},
     async onClick(i) {
       this.active = i;
-      console.log(i, this.layersData, "---");
       if (i == 0) {
         await this.Getlayers();
         this.$refs.aside.setdata(this.layersData);
@@ -158,7 +155,7 @@ export default {
       }
     },
     setImager(obj, isshow = true, fun) {
-      console.log(obj, obj.year, isshow, "---");
+      console.log(obj, obj.year, isshow, this.imagelayers[obj.year], "---");
 
       if (this.imagelayers[obj.year]) this.imagelayers[obj.year].show = isshow;
       else if (isshow)
@@ -201,14 +198,6 @@ export default {
           });
       });
     },
-    removeGeoJSON() {
-      if (!window.viewer) return;
-      viewer.entities.removeAll();
-      viewer.dataSources.removeAll();
-      // viewer.dataSources._dataSources.forEach((das) => {
-      //   if (das.name == "Idleland") {viewer.dataSources.remove(das);}
-      // });
-    },
 
     setImageryRollers(imageryLayer) {
       if (this.active == 1) setImageryRoller(imageryLayer);
@@ -220,7 +209,7 @@ export default {
   },
   watch: {
     nolayer(newVal, oldVal) {
-      console.log(newVal, oldVal);
+      console.log(newVal, oldVal,'---nolayer');
       if (oldVal) this.setImager({ year: oldVal }, false);
     },
   },

+ 17 - 17
src/views/LandConsolidation/components/list.vue

@@ -50,10 +50,10 @@
 <script>
 import tablePage from "@/components/mapView/tablePage.vue";
 import customForm from "@/components/mapView/custom-form.vue";
-// import { QueryOne, QueryList } from "@/api/cockpitNew";
+import { QueryList } from "@/api/cockpitNew";
 import { getXmList } from "@/api/stxf/tdzz.js";
 import { zzForm, TableHeader, reasonList } from "./config";
-import { loadGeoJSON } from "@/utils/MapHelper/help.js";
+import { loadGeoJSON, removeGeoJSON } from "@/utils/MapHelper/help.js";
 let geoSources = {};
 export default {
   components: {
@@ -108,7 +108,7 @@ export default {
     },
     getTableData() {
       this.$emit("updateParent", "loading", true);
-      this.removeGeoJSON("zzxm");
+      removeGeoJSON("zzxm");
       getXmList(this.pageObj).then((res) => {
         this.$emit("updateParent", "loading", false);
         this.table = { total: res.total, data: res.rows };
@@ -141,12 +141,12 @@ export default {
       // let xzqdm = "h_" + item.xzqdm;
       // this.tempdataLayerId = xzqdm;
       // if (geoSources[xzqdm]) return;
-      this.removeGeoJSON("zzxmhig");
+      removeGeoJSON("zzxmhig");
       item.tQytdzzZzxm.forEach((res) => {
         if (res.geom)
           loadGeoJSON(res.geom, "#ff0000", { isfly: true }, (data) => {
             data.name = "zzxmhig";
-            geoSources[res.pid + res.id] = data;
+            geoSources[res.pid + res.id + "h"] = data;
             res.entity = "整治图斑";
             data.entities.values.forEach((entity) => {
               entity.properties = { type: "图斑上图", res };
@@ -154,15 +154,6 @@ export default {
           });
       });
     },
-    removeGeoJSON(name) {
-      if (!window.viewer) return;
-      // viewer.entities.removeAll();
-      // viewer.dataSources.removeAll();
-      for (var i = viewer.dataSources._dataSources.length - 1; i >= 0; i--) {
-        var das = viewer.dataSources._dataSources[i];
-        if (das.name == name) viewer.dataSources.remove(das);
-      }
-    },
 
     reset(xzqh) {
       this.pageObj = {
@@ -172,15 +163,24 @@ export default {
         pageNum: 1,
         pageSize: 10,
       };
-      this.removeGeoJSON();
+      removeGeoJSON("zzxm");
+      removeGeoJSON("zzxmhig");
     },
     detail(row) {
       this.flyTo(row);
       this.bus.$emit("handleView", row, "整治项目");
     },
-    handle(row) {
-      this.$emit("contrast", row);
+    async handle(row) {
+      removeGeoJSON("zzxm");
+      this.flyTo(row);
+      let res = await QueryList({
+        jscType: "qytuzz_zzxm_qhdb",
+        id: row.id,
+      });
+      console.log("----", res);
+      this.$emit("contrast", { id: this.region, fp: res.data });
     },
+
     changerdxz() {
       this.pageObj.isConfirm = !this.pageObj.isConfirm;
       this.searchFun();

+ 10 - 7
src/views/LandConsolidation/components/sdgk.vue

@@ -97,6 +97,7 @@ import { overview, district, reason } from "@/api/Idleland.js";
 import { QueryOne, QueryList } from "@/api/cockpitNew";
 import { legends } from "./config.js";
 import { loadGeoJSON } from "@/utils/MapHelper/help.js";
+let geoSources = {};
 export default {
   props: {},
   data() {
@@ -146,9 +147,9 @@ export default {
       this.Getxzxx();
       this.Getsdtz();
       this.Getkjxx();
-      this.Getkjxx();
-      this.Getkjxx();
-      this.Getkjxx();
+      // this.Getkjxx();
+      // this.Getkjxx();
+      // this.Getkjxx();
     },
     async Getzzxm() {
       let sdres = await QueryOne({
@@ -199,12 +200,13 @@ export default {
       this.active_tableData(res.data);
     },
     active_tableData(newVal) {
-      newVal.forEach((res, index) => {
+      newVal.forEach((res, ri) => {
         let color = legends[res.type].color;
         if (res.geom)
           loadGeoJSON(res.geom, color, { isfly: true }, (data) => {
-            geoSources[res.id] = data;
+            geoSources[ri] = data;
             data.name = res.type = 0 ? "sdqy" : "zzqy";
+            // data.show = false;
             // data.entities.values.forEach((entity) => {
             //   entity.properties = { type: "图斑上图", id: res.id };
             // });
@@ -212,8 +214,9 @@ export default {
       });
     },
     sourcesshow(isshow) {
-      Object.keys(geoSources).forEach((dageo) => {
-        dageo.show = isshow;
+      Object.keys(geoSources).forEach((name) => {
+        console.log(name, geoSources[name]);
+        geoSources[name].show = isshow;
       });
     },
     reset() {