Просмотр исходного кода

耕地保护现状动态高度

maxiaoxiao 10 месяцев назад
Родитель
Сommit
893e47aee5

+ 2 - 0
src/components/echartsTemplate/pie.vue

@@ -198,6 +198,7 @@ export default {
         option.legend.height = "40%";
         option.legend.top = "60%";
         option.legend.orient = "vertical";
+        option.legend.left = "2%";
       } else {
         option.series[0].radius = ["45%", "70%"];
         option.series[0].center = ["25%", "50%"];
@@ -206,6 +207,7 @@ export default {
         option.legend.orient = "vertical";
       }
       option.legend.right = cartData.legend_right || "2%";
+
       let max = cartData.max || 4;
       // option.legend.textStyle.rich.name.width = max * 15;
       option.legend.formatter = function (name) {

+ 21 - 21
src/views/farmlandProtection/components/fxjg.vue

@@ -47,9 +47,10 @@
       </div>
       <div>
         <pie
-          :class="`echart${edata.length <= 6 ? '' : '_vertical'}`"
+          class="echart"
+          :style="`height: ${200 + edata.length * 10}px`"
           unit="㎡"
-          @echartClick="(name) => echartClick(name)"
+          @echartClick="(name) => echartClick(name, item.value)"
           :ref="`echartRef`"
         ></pie>
       </div>
@@ -117,8 +118,6 @@ export default {
   methods: {
     download() {},
     resultDeatils(val, mxbsm) {
-      // viewer.entities.removeAll();
-      viewer.dataSources.removeAll();
       let obj = {
         bsm: this.fxjgObj.bsm,
         mxbsm: mxbsm,
@@ -131,6 +130,7 @@ export default {
       QueryGdbhJg({ bsm: this.fxjgObj.bsm }).then((res) => {
         let data = [];
         if (res.statuscode == 200) {
+          console.log(res, ":resresres");
           if (res.data.sandiao.mx_data.length) {
             res.data.sandiao.mx_data.forEach((el) => {
               data.push({
@@ -156,17 +156,20 @@ export default {
         }
       });
     },
-    echartClick(name) {
-      this.edata.forEach((res) => {
-        const keys = Object.keys(res);
-        for (const key of keys) {
-          let value = res[key];
-          if (value == name) {
-            this.loadGeoJSON(parse(res.geom), res.itemStyle.color, "all");
-          }
-        }
+    echartClick(name, { iseyes }) {
+      console.log(name, ":name");
+      // this.reset();
 
-      })
+      // this.tableData.forEach((res) => {
+      //   const keys = Object.keys(res);
+      //   for (const key of keys) {
+      //     let value = res[key];
+      //     if (value == name) {
+      //       this.addPolygon(res.空间信息.split(";")[1], "all", "#ff0000", true);
+      //     }
+      //   }
+
+      // })
     },
     drawWktPloygon(item, itemColor, id) {
       // console.log(geometry, "geometry");
@@ -183,7 +186,6 @@ export default {
     },
     // 加载GeoJSON数据
     loadGeoJSON(geojson, yanse, id, height, name) {
-      viewer.dataSources.removeAll()
       let _this = this;
       let fcolor =
         id && id != "all"
@@ -222,14 +224,11 @@ export default {
           if (id) {
             dataSources[id] = data;
           }
+          if (id == "all") _this.isshowAll = true;
         });
     },
   },
   mounted() {},
-  beforeDestroy() {
-    viewer.entities.removeAll();
-    viewer.dataSources.removeAll();
-  },
 };
 </script>
 
@@ -245,11 +244,12 @@ export default {
     // width: 19rem;
     // height: 350px;
     width: 387px !important;
-    height: 200px !important;
+    height: 200px;
+    min-height: 200px;
   }
   .echart_vertical {
     width: 387px !important;
-    height: 370px !important;
+    height: 400px !important;
   }
 
   .downloadDiv {