2025-08-06 17:34:35 +08:00
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<el-row style="background:#fff;margin-top:30px;">
|
|
|
|
|
<el-col :xs="24" :sm="24" :lg="24">
|
|
|
|
|
<el-card shadow="always" class="common-card-container common-card-container-body-no-padding">
|
|
|
|
|
<div slot="header">
|
|
|
|
|
<span class="card-title">当日功率曲线</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div style="height: 310px" id="activeChart"></div>
|
|
|
|
|
</el-card>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import * as echarts from 'echarts'
|
|
|
|
|
import resize from '@/mixins/ems/resize'
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
mixins: [resize],
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
chart: null
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.initChart()
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
beforeDestroy() {
|
|
|
|
|
if (!this.chart) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.chart.dispose()
|
|
|
|
|
this.chart = null
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
initChart() {
|
|
|
|
|
this.chart = echarts.init(document.querySelector('#activeChart'))
|
|
|
|
|
},
|
2025-08-06 23:06:12 +08:00
|
|
|
showLoading(){
|
|
|
|
|
this.chart && this.chart.showLoading()
|
|
|
|
|
},
|
2025-08-06 17:34:35 +08:00
|
|
|
setOption(data) {
|
2025-08-06 23:06:12 +08:00
|
|
|
const source = [['日期','电网功率']]
|
|
|
|
|
data.forEach((item)=>{
|
|
|
|
|
source.push([item.statisDate,item.gridPower])
|
2025-08-06 17:34:35 +08:00
|
|
|
})
|
|
|
|
|
this.chart.setOption({
|
2025-08-06 23:06:12 +08:00
|
|
|
color:['#FFBD00','#3C81FF'],
|
|
|
|
|
legend: {
|
|
|
|
|
left: 'center',
|
|
|
|
|
bottom: '10',
|
2025-08-06 17:34:35 +08:00
|
|
|
},
|
|
|
|
|
tooltip: {
|
|
|
|
|
trigger: 'axis',
|
|
|
|
|
axisPointer: { // 坐标轴指示器,坐标轴触发有效
|
|
|
|
|
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
textStyle:{
|
|
|
|
|
color:"#333333",
|
|
|
|
|
},
|
|
|
|
|
xAxis: {
|
|
|
|
|
type: 'category',
|
|
|
|
|
},
|
|
|
|
|
yAxis: {
|
|
|
|
|
type: 'value',
|
|
|
|
|
},
|
2025-08-06 23:06:12 +08:00
|
|
|
dataset:{source},
|
2025-08-06 17:34:35 +08:00
|
|
|
series: [
|
|
|
|
|
{
|
2025-08-06 23:06:12 +08:00
|
|
|
name:'电网功率',
|
2025-08-06 17:34:35 +08:00
|
|
|
type: 'line',
|
2025-08-06 23:06:12 +08:00
|
|
|
}
|
|
|
|
|
]
|
2025-08-06 17:34:35 +08:00
|
|
|
})
|
2025-08-06 23:06:12 +08:00
|
|
|
this.chart.hideLoading()
|
|
|
|
|
},
|
|
|
|
|
|
2025-08-06 17:34:35 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|