maxiaoxiao 11 месяцев назад
Родитель
Сommit
335578dc02
1 измененных файлов с 25 добавлено и 39 удалено
  1. 25 39
      src/views/complianceAnalysis/components/scjg.vue

+ 25 - 39
src/views/complianceAnalysis/components/scjg.vue

@@ -45,6 +45,7 @@
 
 <script>
 import pie from "@/components/echartsTemplate/pie.vue";
+import { GetFxjg } from "@/api/ghss/hgxfx.js";
 import hgxfx from "../../../../static/data/ghss/data.js";
 let colors = [
   "#62ADED",
@@ -80,19 +81,29 @@ export default {
   mounted() {},
   methods: {
     initData() {
-      this.fileid =
-        this.$props.scjgObj.xmmc.indexOf("东岸卓越城项目") >= 0
-          ? "hgxfx1"
-          : "hgxfx2";
       this.echarts = [];
-      hgxfx.jgtreeData.forEach((e) => {
-        // if (e.label == "控制性详细规划") e.label = "详细规划分析";
-        this.echarts.push({ ...e, iseyes: false, isshow: false });
+      GetFxjg({ bsm: this.$props.scjgObj.bsm }).then((res) => {
+        if (res.success) {
+          res.data.forEach((e, ei) => {
+            let c = e.dataList || e.child;
+            c.map((ci) => {
+              ci.name = ci.mc_name || ci.scxbsm;
+              ci.value = ci.mj;
+              // ci.id = ci.scxbsm;
+              // ci.label = ci.mc_name;
+            });
+            this.echarts.push({
+              id: e.scxbsm,
+              label: e.scxbsm,
+              children: c,
+              iseyes: false,
+              isshow: false,
+            });
+            this.setEchart(c, ei);
+            console.log(c, "this.echars");
+          });
+        }
       });
-      this.setEchart1();
-      this.setEchart2();
-      // this.setEchart3();
-      this.setEchart4();
     },
     eyesChaneg(i) {
       this.echarts[i].iseyes = !this.echarts[i].iseyes;
@@ -122,35 +133,10 @@ export default {
           });
       }
     },
-    setEchart1() {
-      this.$nextTick(() => {
-        this.$refs.echartRef[0].setOptions({
-          type: "vertical",
-          data: hgxfx.xzfxlist,
-        });
-      });
-    },
-    setEchart2() {
-      this.$nextTick(() => {
-        let setoptions = {
-          data: hgxfx.sxfxlist,
-          type: "horizontal", //横向
-          isclick: true,
-        };
-        this.$refs.echartRef[1].setOptions(setoptions);
-      });
-    },
-    setEchart3() {
-      this.$nextTick(() => {
-        this.$refs.echartRef[2].setOptions({ data: tdlylist });
-      });
-    },
-    setEchart4() {
+    setEchart(data, i) {
       this.$nextTick(() => {
-        this.$refs.echartRef[2].setOptions({
-          data: hgxfx.xxghlist,
-          type: "vertical",
-        });
+        let type = i == 1 ? "horizontal" : "vertical";
+        this.$refs.echartRef[i].setOptions({ data, type });
       });
     },
     // 加载GeoJSON数据