Bläddra i källkod

山水工程单独点击

maxiaoxiao 9 månader sedan
förälder
incheckning
2d19d7350c
1 ändrade filer med 12 tillägg och 14 borttagningar
  1. 12 14
      src/views/cockpit/common/VectorSpace/BoxCommonVector.vue

+ 12 - 14
src/views/cockpit/common/VectorSpace/BoxCommonVector.vue

@@ -98,7 +98,6 @@ import * as wellknown from "wellknown";
 import * as turf from "@turf/turf";
 
 let BoxCommonVector_entity = null;
-let layersObj = {};
 let layerSources = {};
 export default {
   data() {
@@ -139,20 +138,20 @@ export default {
     async setLayerStatus(item) {
       let did_v = Number(item.did) - 1;
       this.tempdataLayerId = did_v;
-      if (layersObj[did_v]) {
-        layersObj[did_v].show = true;
+      if (tdsy.layersObj[did_v]) {
+        tdsy.layersObj[did_v].show = true;
         viewer.flyTo(layerSources[did_v], {
           offset: new Cesium.HeadingPitchRange(0, -45),
         });
       } else {
-        tdsy.layer.show = false;
+        if (tdsy.layer) tdsy.layer.show = false;
         let layer = viewer.imageryLayers.addImageryProvider(
           new Cesium.SuperMapImageryProvider({
             url: this.layersData.url,
             layersID: `[${did_v}]`,
           })
         );
-        layersObj[did_v] = layer;
+        tdsy.layersObj[did_v] = layer;
         this.loadGeoJSON(item.geom, did_v);
       }
       // } else if (this.layersData.layerName) {
@@ -164,7 +163,7 @@ export default {
       //   tdsy.superProvider.setLayerStatusParameters([params_gh]);
       //   tdsy.layer.show = false;
       //   let layer = viewer.imageryLayers.addImageryProvider(tdsy.superProvider);
-      //   layersObj[item.did] = layer;
+      //   tdsy.layersObj[item.did] = layer;
     },
     loadGeoJSON(geojson, id) {
       let polygon = Cesium.GeoJsonDataSource.load(geojson, {
@@ -537,7 +536,9 @@ export default {
       this.searchs = newVal.searchs;
       this.searchform = newVal.searchform;
       this.state = "";
-      if (newVal.tableData && newVal.tableData.length > 0) {
+      if (newVal.goitem) {
+        this.draw_vector_server(newVal.mapType, newVal.goitem);
+      } else if (newVal.tableData && newVal.tableData.length > 0) {
         this.active_dableData = []; //防止重复点击tableData不刷新
         this.active_dableData = newVal.tableData;
         this.tableData = newVal.tableData;
@@ -545,9 +546,6 @@ export default {
       } else if (this.title) {
         this.init_vector();
       }
-      if (newVal.goitem) {
-        this.draw_vector_server(newVal.mapType, newVal.goitem);
-      }
     },
     active_dableData(newVal, oldVal) {
       if (this.cockpit_vector.mapType)
@@ -555,10 +553,10 @@ export default {
       else this.draw_vector_tdgy_gy_jd(newVal);
     },
     tempdataLayerId(newVal, oldVal) {
-      if (oldVal && layersObj[oldVal]) {
-        layersObj[oldVal].show = false;
-      } else if (layersObj[newVal]) {
-        // layersObj[newVal].show = true;
+      if (oldVal && tdsy.layersObj[oldVal]) {
+        tdsy.layersObj[oldVal].show = false;
+      } else if (tdsy.layersObj[newVal]) {
+        // tdsy.layersObj[newVal].show = true;
       }
       console.log(newVal, oldVal, "----");
     },