Quellcode durchsuchen

-统计分析修改图结构

jiangbiao vor 2 Jahren
Ursprung
Commit
36e250013d

+ 11 - 5
ui/src/views/statistics/pie/jplPieChart.vue

@@ -87,11 +87,17 @@ export default {
             break;
           }
         }
-        if (flag && ((this.plantName != '合计' && this.plantName == this.pointList[i].plantName) || this.plantName == '合计' || this.plantName == '')) {
-          this.option.legend.data[i] = this.pointList[i].pointType
-          this.option.series[0].data[i] = {value: this.pointList[i].jpl, name: this.pointList[i].pointType}
-        }else{
-          this.option.series[0].data[j] = {value: parseFloat(this.option.series[0].data[j].value)+ parseFloat(this.pointList[i].jpl), name: this.pointList[i].pointType}
+        if ((this.plantName != '合计' && this.plantName == this.pointList[i].plantName)
+          || this.plantName == '合计' || this.plantName == '') {
+          if (flag) {
+            this.option.legend.data[i] = this.pointList[i].pointType
+            this.option.series[0].data[i] = {value: this.pointList[i].jpl, name: this.pointList[i].pointType}
+          } else {
+            this.option.series[0].data[j] = {
+              value: parseFloat(this.option.series[0].data[j].value) + parseFloat(this.pointList[i].jpl),
+              name: this.pointList[i].pointType
+            }
+          }
         }
       }
       this.initChart();

+ 12 - 9
ui/src/views/statistics/pie/pflPieChart.vue

@@ -78,16 +78,18 @@ export default {
   },
   mounted() {
     this.$nextTick(() => {
-        for (let i = 0; i < this.pointList.length; i++) {
-          let flag = true;
-          let j = 0
-          for (j; j < this.option.series[0].data.length; j++) {
-            if (this.option.series[0].data[j].name == this.pointList[i].pointType) {
-              flag = false;
-              break;
-            }
+      for (let i = 0; i < this.pointList.length; i++) {
+        let flag = true;
+        let j = 0
+        for (j; j < this.option.series[0].data.length; j++) {
+          if (this.option.series[0].data[j].name == this.pointList[i].pointType) {
+            flag = false;
+            break;
           }
-          if (flag && ((this.plantName != '合计' && this.plantName == this.pointList[i].plantName) || this.plantName == '合计' || this.plantName == '')) {
+        }
+        if ((this.plantName != '合计' && this.plantName == this.pointList[i].plantName)
+          || this.plantName == '合计' || this.plantName == '') {
+          if (flag) {
             this.option.legend.data[i] = this.pointList[i].pointType
             this.option.series[0].data[i] = {value: this.pointList[i].pfl, name: this.pointList[i].pointType}
           } else {
@@ -97,6 +99,7 @@ export default {
             }
           }
         }
+      }
       this.initChart();
     })
   },

+ 49 - 47
ui/src/views/statistics/pie/xllPieChart.vue

@@ -29,52 +29,51 @@ export default {
     return {
       chart: null,
       option: {
-      title: {
-        text:'泄漏量',
-        left: 'center'
-      },
-      tooltip: {
-        trigger: 'item',
+        title: {
+          text: '泄漏量',
+          left: 'center'
+        },
+        tooltip: {
+          trigger: 'item',
           formatter: '{a} <br/>{b} : {c} ({d}%)'
-      },
-      legend: {
-        orient: 'vertical',
+        },
+        legend: {
+          orient: 'vertical',
           left: 'left',
           data: []
-      },
-      toolbox: {
-        show: true,
+        },
+        toolbox: {
+          show: true,
           feature: {
-          mark: {show: true},
-          magicType: {
-            show: true,
+            mark: {show: true},
+            magicType: {
+              show: true,
               type: ['funnel']
-          },
-          restore: {show: true},
-          saveAsImage: {show: true}
-        }
-      },
-      series: [
-        {
-          label: {
-            formatter: '{b}: ({d}%)'
-          },
-          name: '泄漏量',
-          type: 'pie',
-          radius: ['40%', '60%'],
-          selectedMode: 'single',
-          data: [
-          ],
-          emphasis: {
+            },
+            restore: {show: true},
+            saveAsImage: {show: true}
+          }
+        },
+        series: [
+          {
             label: {
-              show: true,
-              fontSize: '13',
-              fontWeight: 'bold'
-            }
-          },
-        }
-      ]
-    },
+              formatter: '{b}: ({d}%)'
+            },
+            name: '泄漏量',
+            type: 'pie',
+            radius: ['40%', '60%'],
+            selectedMode: 'single',
+            data: [],
+            emphasis: {
+              label: {
+                show: true,
+                fontSize: '13',
+                fontWeight: 'bold'
+              }
+            },
+          }
+        ]
+      },
     }
   },
   mounted() {
@@ -88,13 +87,16 @@ export default {
             break;
           }
         }
-        if (flag && ((this.plantName != '合计' && this.plantName == this.pointList[i].plantName) || this.plantName == '合计' || this.plantName == '')) {
-          this.option.legend.data[i] = this.pointList[i].pointType
-          this.option.series[0].data[i] = {value: this.pointList[i].xll, name: this.pointList[i].pointType}
-        } else {
-          this.option.series[0].data[j] = {
-            value: parseFloat(this.option.series[0].data[j].value) + parseFloat(this.pointList[i].xll),
-            name: this.pointList[i].pointType
+        if ((this.plantName != '合计' && this.plantName == this.pointList[i].plantName)
+          || this.plantName == '合计' || this.plantName == '') {
+          if (flag) {
+            this.option.legend.data[i] = this.pointList[i].pointType
+            this.option.series[0].data[i] = {value: this.pointList[i].xll, name: this.pointList[i].pointType}
+          } else {
+            this.option.series[0].data[j] = {
+              value: parseFloat(this.option.series[0].data[j].value) + parseFloat(this.pointList[i].xll),
+              name: this.pointList[i].pointType
+            }
           }
         }
       }