|
@@ -2,7 +2,7 @@
|
|
<div class="any-wrap">
|
|
<div class="any-wrap">
|
|
<Label :label="label" :icon="icon" />
|
|
<Label :label="label" :icon="icon" />
|
|
<div class="chart-wrap">
|
|
<div class="chart-wrap">
|
|
- <zz-echart :option="options" class="chart"></zz-echart>
|
|
|
|
|
|
+ <zz-echart :option="options" class="chart" ref="charts"></zz-echart>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
@@ -103,18 +103,20 @@ export default {
|
|
},
|
|
},
|
|
|
|
|
|
created() {
|
|
created() {
|
|
- this.setData();
|
|
|
|
|
|
+ this.getData();
|
|
},
|
|
},
|
|
|
|
|
|
mounted() {
|
|
mounted() {
|
|
- let that = this;
|
|
|
|
- window.addEventListener('resize', function () {
|
|
|
|
- that.setData();
|
|
|
|
- });
|
|
|
|
|
|
+ window.addEventListener('resize', ()=>{
|
|
|
|
+ if(this.$refs.charts){
|
|
|
|
+ this.$refs.charts.echart.resize();
|
|
|
|
+ }
|
|
|
|
+ })
|
|
},
|
|
},
|
|
|
|
|
|
methods: {
|
|
methods: {
|
|
- setData() {
|
|
|
|
|
|
+ setData({data,standardCop,month}) {
|
|
|
|
+ this.options.xAxis[0].data = month;
|
|
if (this.type == 1) {
|
|
if (this.type == 1) {
|
|
this.label = '月度能效趋势';
|
|
this.label = '月度能效趋势';
|
|
this.icon = require('../../../assets/img/energyIcon/icon_erey.png');
|
|
this.icon = require('../../../assets/img/energyIcon/icon_erey.png');
|
|
@@ -136,13 +138,13 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
symbol: 'none',
|
|
symbol: 'none',
|
|
- data: [4.28, 4.36, 4.69, 5.0, 4.88, 4.5, 4.6, 4.8],
|
|
|
|
|
|
+ data: data,
|
|
markLine: {
|
|
markLine: {
|
|
symbol: 'none',
|
|
symbol: 'none',
|
|
data: [
|
|
data: [
|
|
{
|
|
{
|
|
name: '基准值',
|
|
name: '基准值',
|
|
- yAxis: 3.15,
|
|
|
|
|
|
+ yAxis: standardCop,
|
|
lineStyle: {
|
|
lineStyle: {
|
|
color: '#27EA83'
|
|
color: '#27EA83'
|
|
}
|
|
}
|
|
@@ -165,7 +167,7 @@ export default {
|
|
} else if (this.type == '2') {
|
|
} else if (this.type == '2') {
|
|
this.label = '月度电量分析';
|
|
this.label = '月度电量分析';
|
|
this.icon = require('../../../assets/img/energyIcon/icon_dianliang.png');
|
|
this.icon = require('../../../assets/img/energyIcon/icon_dianliang.png');
|
|
- this.options.legend.data = ['用电量', '基准用电量'];
|
|
|
|
|
|
+ this.options.legend.data = ['用电量', '基准用电量'];
|
|
this.options.series = [
|
|
this.options.series = [
|
|
{
|
|
{
|
|
name: '用电量',
|
|
name: '用电量',
|
|
@@ -182,7 +184,7 @@ export default {
|
|
return value + ' kw.h';
|
|
return value + ' kw.h';
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- data: [14118, 31750, 55630, 92420, 104200, 108420, 93800, 98600]
|
|
|
|
|
|
+ data: data[0]
|
|
},
|
|
},
|
|
{
|
|
{
|
|
type: 'line',
|
|
type: 'line',
|
|
@@ -194,10 +196,39 @@ export default {
|
|
itemStyle: {
|
|
itemStyle: {
|
|
color: '#FF9E21'
|
|
color: '#FF9E21'
|
|
},
|
|
},
|
|
- data: [18824, 45357, 79471, 128361, 157870, 180700, 148888, 159032]
|
|
|
|
|
|
+ data: data[1]
|
|
}
|
|
}
|
|
];
|
|
];
|
|
}
|
|
}
|
|
|
|
+ },
|
|
|
|
+ getData(){
|
|
|
|
+ if (this.type == 1) {
|
|
|
|
+
|
|
|
|
+ let month = [],cop=[],standardCop=0;
|
|
|
|
+ this.$http.get('/sc-energy/board/getMonthlyEnergyTendency').then(({data})=>{
|
|
|
|
+ data.map(item=>{
|
|
|
|
+ month.push(item.month);
|
|
|
|
+ cop.push(item.cop);
|
|
|
|
+ standardCop = item.standardCop
|
|
|
|
+ })
|
|
|
|
+ this.setData({data:cop,standardCop:standardCop,month:month})
|
|
|
|
+ }).catch(() => { });
|
|
|
|
+
|
|
|
|
+ }else if (this.type == 2) {
|
|
|
|
+
|
|
|
|
+ let month = [],powerConsumption=[],standardPowerConsumption=[];
|
|
|
|
+ this.$http.get('/sc-energy/board/getMonthlyElectricalAnalysis').then(({data})=>{
|
|
|
|
+ data.map(item=>{
|
|
|
|
+ month.push(item.month);
|
|
|
|
+ powerConsumption.push(item.powerConsumption);
|
|
|
|
+ standardPowerConsumption.push(item.standardPowerConsumption)
|
|
|
|
+ })
|
|
|
|
+ this.setData({data:[powerConsumption,standardPowerConsumption],month:month})
|
|
|
|
+ }).catch(() => { });
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|