whyczyk
2021-10-13 a355aafef5a635bd31a701127cea097338cee0a7
src/components/charts/powerChart.vue
@@ -1,5 +1,5 @@
<template>
   <div class="chartCon" @click="toParentPage">
   <div class="chartCon">
      <div class="chartItem">
         <pross-pie-chart id="prossPieChart0" ref="prossPieChart0"></pross-pie-chart>
      </div>
@@ -11,12 +11,6 @@
      </div>
      <div class="chartItem">
         <pross-pie-chart id="prossPieChart3" ref="prossPieChart3"></pross-pie-chart>
      </div>
      <div class="chartItem">
         <pross-pie-chart id="prossPieChart4" ref="prossPieChart4"></pross-pie-chart>
      </div>
      <div class="chartItem">
         <pross-pie-chart id="prossPieChart5" ref="prossPieChart5"></pross-pie-chart>
      </div>
   </div>
</template>
@@ -38,19 +32,6 @@
   },
   methods: {
      toParentPage() {
         window.parent.parent.postMessage({
            cmd: "syncPage",
            params: {
               pageInfo: {
                  label: "电源实时告警",
                  name: "powerRealtimeInfo",
                  src: "#/powerRealtimeInfo",
                  closable: true
               },
            }
         }, "*");
      },
      setData(data) {
         this.$nextTick(() => {
            if (data) {
@@ -73,39 +54,34 @@
         if (res.code == 1) {
            let optionData = [{
               title: '',
               name: '',
               data: 0,
               unit: '',
               color: '#37a9b3',
            }, {
               title: '',
               name: '',
               data: 0,
               unit: '',
               color: '#f3535f'
            }, {
               title: '',
               name: '',
               data: 0,
               unit: '',
               color: '#ff8b00'
            }, {
               title: '',
               name: '',
               data: 0,
               unit: '',
               color: '#757ffb'
            }, {
               title: '',
               data: 0,
               unit: '',
               color: '#4ba0d9'
            }, {
               title: '',
               data: 0,
               unit: '',
               color: '#7fc57c'
            }]
            },]
            let index = 0;
            let resData = res.data;
            for (let key in resData) {
               optionData[index].title = key;
               optionData[index].name = key;
               if (typeof resData[key] == 'string') {
                  optionData[index].data = Number(resData[key].split('%')[0]);
                  optionData[index].unit = '%';
@@ -131,8 +107,6 @@
         this.$refs.prossPieChart1.resize();
         this.$refs.prossPieChart2.resize();
         this.$refs.prossPieChart3.resize();
         this.$refs.prossPieChart4.resize();
         this.$refs.prossPieChart5.resize();
      }
   }
}
@@ -147,7 +121,7 @@
.chartCon .chartItem {
   width: 50%;
   height: 31.333%;
   height: 48%;
   float: left;
   margin-bottom: 2%;
}