2025-08-06 17:34:35 +08:00
|
|
|
|
|
|
|
|
<template>
|
2025-08-11 17:34:39 +08:00
|
|
|
<el-card shadow="always" class="common-card-container common-card-container-body-no-padding time-range-card">
|
|
|
|
|
<div slot="header" class="time-range-header">
|
|
|
|
|
<span class="card-title">当日功率曲线</span>
|
|
|
|
|
<date-range-select ref="dateRangeSelect" @updateDate="updateDate"/>
|
|
|
|
|
</div>
|
|
|
|
|
<div style="height: 310px" id="activeChart"></div>
|
|
|
|
|
</el-card>
|
2025-08-06 17:34:35 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import * as echarts from 'echarts'
|
|
|
|
|
import resize from '@/mixins/ems/resize'
|
2025-08-11 21:50:38 +08:00
|
|
|
import DateRangeSelect from '@/components/Ems/DateRangeSelect/index.vue'
|
2025-09-17 11:15:54 +08:00
|
|
|
import { getPointData } from '@/api/ems/dzjk'
|
2025-09-25 17:30:16 +08:00
|
|
|
import intervalUpdate from "@/mixins/ems/intervalUpdate";
|
2025-08-06 17:34:35 +08:00
|
|
|
|
|
|
|
|
export default {
|
2025-09-25 17:30:16 +08:00
|
|
|
mixins: [resize,intervalUpdate],
|
2025-08-11 17:34:39 +08:00
|
|
|
components: {DateRangeSelect},
|
2025-08-06 17:34:35 +08:00
|
|
|
data() {
|
|
|
|
|
return {
|
2025-08-11 17:34:39 +08:00
|
|
|
chart: null,
|
|
|
|
|
timeRange:[],
|
|
|
|
|
siteId:'',
|
2025-09-17 11:15:54 +08:00
|
|
|
isInit:true
|
2025-08-06 17:34:35 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.initChart()
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
beforeDestroy() {
|
|
|
|
|
if (!this.chart) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.chart.dispose()
|
|
|
|
|
this.chart = null
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
2025-08-11 17:34:39 +08:00
|
|
|
// 更新时间范围 重置图表
|
|
|
|
|
updateDate(data){
|
|
|
|
|
this.timeRange=data
|
2025-09-17 11:15:54 +08:00
|
|
|
!this.isInit && this.getGVQXData()
|
|
|
|
|
this.isInit = false
|
2025-08-11 17:34:39 +08:00
|
|
|
},
|
|
|
|
|
getGVQXData(){
|
|
|
|
|
this.showLoading()
|
2025-09-17 11:15:54 +08:00
|
|
|
const {siteId,timeRange}=this
|
|
|
|
|
getPointData({siteId,startDate:timeRange[0],endDate:timeRange[1]}).then(response => {
|
2025-08-11 17:34:39 +08:00
|
|
|
this.setOption(response?.data || [])
|
|
|
|
|
}).finally(()=>this.hideLoading())
|
|
|
|
|
},
|
|
|
|
|
init(siteId){
|
|
|
|
|
//初始化 清空数据
|
|
|
|
|
this.siteId = siteId
|
2025-09-17 11:15:54 +08:00
|
|
|
this.isInit = true
|
2025-08-11 17:34:39 +08:00
|
|
|
this.timeRange=[]
|
2025-09-08 18:01:48 +08:00
|
|
|
this.$refs.dateRangeSelect.init(true)
|
2025-09-17 11:15:54 +08:00
|
|
|
this.getGVQXData()
|
2025-09-25 17:30:16 +08:00
|
|
|
this.updateInterval(this.getGVQXData)
|
2025-08-11 17:34:39 +08:00
|
|
|
},
|
2025-08-06 17:34:35 +08:00
|
|
|
initChart() {
|
|
|
|
|
this.chart = echarts.init(document.querySelector('#activeChart'))
|
|
|
|
|
},
|
2025-08-06 23:06:12 +08:00
|
|
|
showLoading(){
|
|
|
|
|
this.chart && this.chart.showLoading()
|
|
|
|
|
},
|
2025-08-11 17:34:39 +08:00
|
|
|
hideLoading(){
|
|
|
|
|
this.chart && this.chart.hideLoading()
|
|
|
|
|
},
|
2025-08-06 17:34:35 +08:00
|
|
|
setOption(data) {
|
2025-09-17 11:15:54 +08:00
|
|
|
const source = [['日期','电网功率','负载功率','储能功率','光伏功率','soc平均值','soh平均值','电池平均温度平均值']]
|
|
|
|
|
console.log('source.slice(1)',source[0].slice(1))
|
2025-08-11 17:34:39 +08:00
|
|
|
this.chart && data.forEach((item)=>{
|
2025-09-17 11:15:54 +08:00
|
|
|
source.push([item.statisDate,item.gridPower,item.loadPower,item.storagePower,item.pvPower,item.avgSoc,item.avgSoh,item.avgTemp])
|
2025-08-06 17:34:35 +08:00
|
|
|
})
|
|
|
|
|
this.chart.setOption({
|
2025-08-13 14:51:26 +08:00
|
|
|
grid: {
|
|
|
|
|
containLabel: true
|
|
|
|
|
},
|
2025-08-06 23:06:12 +08:00
|
|
|
legend: {
|
|
|
|
|
left: 'center',
|
2025-08-11 17:34:39 +08:00
|
|
|
bottom: '15',
|
2025-08-06 17:34:35 +08:00
|
|
|
},
|
|
|
|
|
tooltip: {
|
|
|
|
|
trigger: 'axis',
|
|
|
|
|
axisPointer: { // 坐标轴指示器,坐标轴触发有效
|
|
|
|
|
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
textStyle:{
|
|
|
|
|
color:"#333333",
|
|
|
|
|
},
|
|
|
|
|
xAxis: {
|
|
|
|
|
type: 'category',
|
|
|
|
|
},
|
2025-09-17 11:15:54 +08:00
|
|
|
yAxis: [
|
2025-08-06 17:34:35 +08:00
|
|
|
{
|
2025-09-17 11:15:54 +08:00
|
|
|
type: 'value',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'value',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
dataset:{source},
|
|
|
|
|
series: source[0].slice(1).map((item,index)=>{
|
|
|
|
|
return {
|
2025-08-06 17:34:35 +08:00
|
|
|
type: 'line',
|
2025-09-17 11:15:54 +08:00
|
|
|
yAxisIndex:index<=4 ? 0 : 1
|
2025-08-06 23:06:12 +08:00
|
|
|
}
|
2025-09-17 11:15:54 +08:00
|
|
|
})
|
2025-08-06 17:34:35 +08:00
|
|
|
})
|
2025-08-06 23:06:12 +08:00
|
|
|
},
|
|
|
|
|
|
2025-08-06 17:34:35 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|