站点首页-当日功率曲线
This commit is contained in:
@ -291,3 +291,11 @@ export function curveList({siteId,strategyId}) {
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
//单站监控 首页 当日功率曲线
|
||||
export function getPointData({siteId,startDate,endDate}) {
|
||||
return request({
|
||||
url: `/ems/siteMonitor/getPointData?siteId=${siteId}&startDate=${startDate}&endDate=${endDate}`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
@ -13,7 +13,7 @@
|
||||
import * as echarts from 'echarts'
|
||||
import resize from '@/mixins/ems/resize'
|
||||
import DateRangeSelect from '@/components/Ems/DateRangeSelect/index.vue'
|
||||
import {getPcsNameList, getPowerData} from '@/api/ems/dzjk'
|
||||
import { getPointData } from '@/api/ems/dzjk'
|
||||
|
||||
export default {
|
||||
mixins: [resize],
|
||||
@ -23,7 +23,7 @@ export default {
|
||||
chart: null,
|
||||
timeRange:[],
|
||||
siteId:'',
|
||||
deviceId:''
|
||||
isInit:true
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -42,33 +42,23 @@ export default {
|
||||
// 更新时间范围 重置图表
|
||||
updateDate(data){
|
||||
this.timeRange=data
|
||||
this.getGVQXData()
|
||||
!this.isInit && this.getGVQXData()
|
||||
this.isInit = false
|
||||
},
|
||||
getGVQXData(){
|
||||
this.showLoading()
|
||||
const {siteId,deviceId,timeRange}=this
|
||||
if(!deviceId) return this.hideLoading()
|
||||
getPowerData({siteId,deviceId,startDate:timeRange[0],endDate:timeRange[1],dataType:'1'}).then(response => {
|
||||
const {siteId,timeRange}=this
|
||||
getPointData({siteId,startDate:timeRange[0],endDate:timeRange[1]}).then(response => {
|
||||
this.setOption(response?.data || [])
|
||||
}).finally(()=>this.hideLoading())
|
||||
},
|
||||
init(siteId){
|
||||
//初始化 清空数据
|
||||
this.siteId = siteId
|
||||
this.isInit = true
|
||||
this.timeRange=[]
|
||||
this.deviceId=''
|
||||
this.$refs.dateRangeSelect.init(true)
|
||||
this.showLoading()
|
||||
getPcsNameList(siteId).then(response=>{
|
||||
const data=response?.data || [];
|
||||
if(data.length>0){
|
||||
this.deviceId=data[0].id
|
||||
//接口调用完成之后 设置图表、结束loading
|
||||
this.getGVQXData()
|
||||
}else{
|
||||
this.hideLoading()
|
||||
}
|
||||
})
|
||||
this.getGVQXData()
|
||||
},
|
||||
initChart() {
|
||||
this.chart = echarts.init(document.querySelector('#activeChart'))
|
||||
@ -80,12 +70,12 @@ export default {
|
||||
this.chart && this.chart.hideLoading()
|
||||
},
|
||||
setOption(data) {
|
||||
const source = [['日期','电网功率']]
|
||||
const source = [['日期','电网功率','负载功率','储能功率','光伏功率','soc平均值','soh平均值','电池平均温度平均值']]
|
||||
console.log('source.slice(1)',source[0].slice(1))
|
||||
this.chart && data.forEach((item)=>{
|
||||
source.push([item.statisDate,item.gridPower])
|
||||
source.push([item.statisDate,item.gridPower,item.loadPower,item.storagePower,item.pvPower,item.avgSoc,item.avgSoh,item.avgTemp])
|
||||
})
|
||||
this.chart.setOption({
|
||||
color:['#FFBD00','#3C81FF'],
|
||||
grid: {
|
||||
containLabel: true
|
||||
},
|
||||
@ -105,16 +95,21 @@ export default {
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
},
|
||||
dataset:{source},
|
||||
series: [
|
||||
yAxis: [
|
||||
{
|
||||
name:'电网功率',
|
||||
type: 'value',
|
||||
},
|
||||
{
|
||||
type: 'value',
|
||||
},
|
||||
],
|
||||
dataset:{source},
|
||||
series: source[0].slice(1).map((item,index)=>{
|
||||
return {
|
||||
type: 'line',
|
||||
yAxisIndex:index<=4 ? 0 : 1
|
||||
}
|
||||
]
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user