浏览代码

解决土地现状饼图错误

maxiaoxiao 10 月之前
父节点
当前提交
b7f9b6ccf9
共有 1 个文件被更改,包括 5 次插入9 次删除
  1. 5 9
      src/components/Query/clickQuery/MultiLevelQuery.vue

+ 5 - 9
src/components/Query/clickQuery/MultiLevelQuery.vue

@@ -47,7 +47,7 @@
         <pie
           class="echart"
           unit="平方米"
-          :ref="`echartRef`"
+          :ref="`echartRef${index}`"
           @echartClick="echartClick"
         ></pie>
 
@@ -583,9 +583,7 @@ export default {
         });
 
         if (tab) {
-          let index = Number(tab.index) - 2;
           let data = [];
-
           this.active_tabs_table = tabData.value.data.data;
           this.rawData = tabData.value.data.data;
           tabData.value.data.datalist.forEach((res) => {
@@ -594,14 +592,13 @@ export default {
               value: res.sumvalue,
             });
           });
-          this.setEchart(data, "vertical", index);
+          this.setEchart(data, "vertical", tab.index);
         }
       }
     },
     handleClickQwnership(tab, event) {
-      let index = 0;
       this.reset();
-      this.qwnershipTabs.forEach((res) => {
+      this.qwnershipTabs.forEach((res, i) => {
         if (res.dataname == tab.name) {
           this.rawData_qwnership = res.data;
           let data = [];
@@ -619,8 +616,7 @@ export default {
               }
             );
           });
-          this.setEchart_qwnership(data, "vertical", index);
-          index++;
+          this.setEchart_qwnership(data, "vertical", 0);
         }
       });
     },
@@ -651,7 +647,7 @@ export default {
       this.$nextTick(() => {
         let max = 7;
         let legend_right = "4%";
-        this.$refs.echartRef[index].setOptions({
+        this.$refs[`echartRef${index}`][0].setOptions({
           data,
           type,
           max,