Browse Source

永久基本农田

maxiaoxiao 5 months ago
parent
commit
05e6fe421f
2 changed files with 12 additions and 20 deletions
  1. 1 1
      src/components/echartsTemplate/bar.vue
  2. 11 19
      src/views/farmlandProtection/gdzl/index.vue

+ 1 - 1
src/components/echartsTemplate/bar.vue

@@ -163,7 +163,7 @@ export default {
       }
       option.legend.data = v.legend;
       option.xAxis.data = v.xData;
-      option.yAxis[0].name = "变化面积/km²";
+      option.yAxis[0].name = v.yName || "变化面积/km²";
       option.series = [];
       v.yData.forEach((item, k) => {
         let o = cloneDeep(seriesItem); // JSON.parse(JSON.stringify(seriesItem));

+ 11 - 19
src/views/farmlandProtection/gdzl/index.vue

@@ -278,25 +278,10 @@ export default {
       }
       this.yearList = res.data || 0;
       this.nowyear = this.yearList.length ? this.yearList[0].year : "";
-      this.setImager(this.yearList[0]);
-      //       serverfwgzkj
-      // :
-      // "127_0_0_1_real3d"
-      // serverfwmc
-      // :
-      // "TB_YJJBNTBH"
-      // serverid
-      // :
-      // "409f15561ad347cf94181cfda488cdf7"
-      // serverurl
-      // :
-      // "http://192.168.60.2:8090/iserver/services/map-YinZiGongZuoKongJian/rest/maps/TB_YJJBNTBH_60.2"
-      // sjy
-      // :
-      // "TB_YJJBNTBH"
+      // this.setImager(this.yearList[0]);
     },
     setImager(obj, isshow = true, fun) {
-      console.log(obj.year, isshow, this.imagelayers[obj.year], "---");
+      console.log(obj.year, isshow, this.imagelayers[obj.year], viewer, "---");
 
       if (this.imagelayers[obj.year]) this.imagelayers[obj.year].show = isshow;
       else if (isshow)
@@ -307,6 +292,7 @@ export default {
           })
         );
       if (obj.top) viewer.imageryLayers.raiseToTop(this.imagelayers[obj.year]);
+      viewer.flyTo(this.imagelayers[obj.year]);
       fun && fun(this.imagelayers[obj.year]);
       // viewer.flyTo(this.imagelayers[obj.year]);
     },
@@ -352,9 +338,13 @@ export default {
       }
     },
     setLnbh(data) {
+      let lnprops = ["d1_mj_qm", "d1_mj", "mj_m"];
+      this.eData.yName = `变化面积${this.unitList[this.nowunit].unit}`;
+      this.eData.xData = [];
+      this.eData.yData = [[]];
       data.forEach((res) => {
         this.eData.xData.push(res.year);
-        this.eData.yData.push(res[this.uprops[this.nowunit]]);
+        this.eData.yData[0].push(res[lnprops[this.nowunit]]);
       });
       this.setEchart(this.eData, 0);
     },
@@ -394,7 +384,9 @@ export default {
       });
     },
     reset() {
-      this.setImager({ year: this.nowyear }, false);
+      this.$nextTick(() => {
+        this.setImager({ year: this.nowyear }, false);
+      });
     },
     setEchart(data, id) {
       this.$nextTick(() => {