Selaa lähdekoodia

光伏盈利饼图调整

Bella 2 vuotta sitten
vanhempi
commit
2f0de5d035
1 muutettua tiedostoa jossa 19 lisäystä ja 5 poistoa
  1. 19 5
      src/components/dashboard/more/pv/pvPowerProfitChart.vue

+ 19 - 5
src/components/dashboard/more/pv/pvPowerProfitChart.vue

@@ -4,9 +4,8 @@ import apiDashboard from "@/api/dashboard/apiDashboard";
 export default {
   data() {
     return {
-      dataIndexes: ["saving", "amountSubsidy"],
+      dataIndexes: ["subsidy", "saving","earning"],
       option: {
-        color: ["#80D4FF", "#FFDF80"],
         tooltip: {
           trigger: "item",
         },
@@ -56,9 +55,24 @@ export default {
     },
     getData() {
       return apiDashboard.getPvProfitOverview(this.queryData).then((res) => {
-        this.option.series[0].data[0].value = res.subsidy;
-        this.option.series[0].data[1].value = res.saving;
-        this.option.series[0].data[2].value = res.earning;
+        this.option.series[0].data = res.map((v) => {
+          if (v.name === "subsidy") {
+            return {
+              value: v.value,
+              name: "补贴金额",
+            };
+          } else if (v.name === "saving") {
+            return {
+              value: v.value,
+              name: "节约金额",
+            };
+          } else if (v.name === "earning") {
+            return {
+              value: v.value,
+              name: "并网收入",
+            };
+          }
+        });
         this.chart.setOption(this.option);
       });
     },