maxiaoxiao 1 year ago
parent
commit
67ff4201b1
2 changed files with 15 additions and 7 deletions
  1. 2 2
      src/components/echartsTemplate/3dPie.vue
  2. 13 5
      src/views/cockpitNew1/gdbh.vue

+ 2 - 2
src/components/echartsTemplate/3dPie.vue

@@ -18,7 +18,7 @@ let option = {
     itemWidth: 12, // 设置宽度
     itemHeight: 12, // 设置高度
     data: [],
-    bottom: "40%",
+    bottom: "20%",
     right: "2%",
 
     itemGap: 10,
@@ -73,7 +73,7 @@ let option = {
   grid3D: {
     show: false,
     boxHeight: 1,
-    top: "-5%",
+    top: "10%",
     left: "-25%",
     // bottom: '-80%',
     //					environment: '#021041',

+ 13 - 5
src/views/cockpitNew1/gdbh.vue

@@ -70,9 +70,18 @@ export default {
         jscType: "jsc_gdbh_yelx_nt",
       };
       QueryList(params).then((res) => {
-        res.data.forEach((edata) => {
-          optionsData.push({ name: edata.dlbmmc, value: edata.yjjbntmj });
-        });
+        if (res.data.length) {
+          res.data.forEach((edata) => {
+            optionsData.push({ name: edata.dlbmmc, value: edata.yjjbntmj });
+          });
+        } else {
+          optionsData = [
+            { name: "水田", value: 0 },
+            { name: "水浇地", value: 0 },
+            { name: "旱地", value: 0 },
+          ];
+        }
+
         this.$nextTick(() => {
           this.$refs.echartRef.setOptions(optionsData, 1 / 100000);
         });
@@ -101,7 +110,6 @@ export default {
     // top: 10px;
     width: 98%;
     height: 100px;
-    margin-bottom: 20px;
   }
 
   .item {
@@ -174,7 +182,7 @@ export default {
   }
   #gdbh_echart {
     width: 100%;
-    height: calc(100% - 110px);
+    height: calc(100% - 100px);
     // position: relative;
     // top: 110px;
   }