Files
emsfront/src/views/ems/dzjk/home/NllzChart.vue

149 lines
3.5 KiB
Vue
Raw Normal View History

2025-06-18 01:01:17 +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="nllzChart"></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: {
2025-06-28 14:52:49 +08:00
initChart() {
this.chart = echarts.init(document.querySelector('#nllzChart'))
2025-06-18 01:01:17 +08:00
},
setOption(data) {
const {siteMonitorDataVo=[],gridNrtPower,loadNrtPower,energyStorageNrtPower,energyStorageAvailElec} = data
const source = [['日期','充电量','放电量']]
siteMonitorDataVo.forEach(item=>{
source.push([item.ammeterDate, item.chargedCap,item.disChargedCap])
})
const filterValue=(num)=>{return num || num === 0 ? num : '-'}
2025-06-18 01:01:17 +08:00
this.chart.setOption({
title: [
// 右上角
{
text: `电网 实时功率:${filterValue(gridNrtPower)} kW`,
2025-06-18 01:01:17 +08:00
top: 10,
right: 10,
textStyle:{
fontSize:12,
color:'#666666'
}
},
// 右下角
{
text: `负载 实时功率:${filterValue(loadNrtPower)} kW`,
2025-06-18 01:01:17 +08:00
bottom: 10,
right: 10,
textStyle:{
fontSize:12,
color:'#666666'
}
},
// 左下角第一行
{
text: '储能',
bottom: 40,
left: 10,
textStyle:{
fontSize:12,
color:'#666666'
}
},
// 左下角第二行
2025-06-18 01:01:17 +08:00
{
text: `实时功率:${filterValue(energyStorageNrtPower)} kW`,
2025-06-18 01:01:17 +08:00
bottom: 26,
left: 10,
textStyle:{
fontSize:12,
color:'#666666'
}
},
// 左下角第三行
2025-06-18 01:01:17 +08:00
{
text: `可用电量:${filterValue(energyStorageAvailElec)} kWh`,
2025-06-18 01:01:17 +08:00
bottom: 10,
left: 10,
textStyle:{
fontSize:12,
color:'#666666'
}
}
],
grid:{
left:200
},
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
textStyle:{
color:"#333333",
},
xAxis: {
type: 'category',
2025-06-18 01:01:17 +08:00
axisLine: {
lineStyle:{
color: '#333333',
}
}
},
yAxis: {
type: 'value',
axisLine: {
lineStyle:{
color: '#333333',
}
}
},
dataset:{
source
2025-06-28 14:52:49 +08:00
// source: [['日期','充电量','放电量']]
},
2025-06-18 01:01:17 +08:00
series: [
{
name:'充电量',
type: 'line',
},{
name:'放电量',
type: 'line',
}]
})
}
}
}
</script>