站点首页优化

This commit is contained in:
白菜
2026-01-22 17:27:03 +08:00
parent 823c0949d0
commit fb90d81bb3
6 changed files with 350 additions and 1423 deletions

View File

@ -1,30 +1,29 @@
<template>
<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>
<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" :showIcon="true" :mini-time-picker="true" @updateDate="updateDate"/>
</div>
<div style="height: 310px" id="activeChart"></div>
</el-card>
</template>
<script>
import * as echarts from 'echarts'
import resize from '@/mixins/ems/resize'
import DateRangeSelect from '@/components/Ems/DateRangeSelect/index.vue'
import { getPointData } from '@/api/ems/dzjk'
import {getPointData} from '@/api/ems/dzjk'
import intervalUpdate from "@/mixins/ems/intervalUpdate";
export default {
mixins: [resize,intervalUpdate],
mixins: [resize, intervalUpdate],
components: {DateRangeSelect},
data() {
return {
chart: null,
timeRange:[],
siteId:'',
isInit:true
timeRange: [],
siteId: '',
isInit: true
}
},
mounted() {
@ -41,23 +40,23 @@ export default {
},
methods: {
// 更新时间范围 重置图表
updateDate(data){
this.timeRange=data
updateDate(data) {
this.timeRange = data
!this.isInit && this.getGVQXData()
this.isInit = false
},
getGVQXData(){
getGVQXData() {
this.showLoading()
const {siteId,timeRange}=this
getPointData({siteId,startDate:timeRange[0],endDate:timeRange[1]}).then(response => {
const {siteId, timeRange} = this
getPointData({siteId, startDate: timeRange[0], endDate: timeRange[1]}).then(response => {
this.setOption(response?.data || [])
}).finally(()=>this.hideLoading())
}).finally(() => this.hideLoading())
},
init(siteId){
init(siteId) {
//初始化 清空数据
this.siteId = siteId
this.isInit = true
this.timeRange=[]
this.timeRange = []
this.$refs.dateRangeSelect.init(true)
this.getGVQXData()
this.updateInterval(this.getGVQXData)
@ -65,17 +64,17 @@ export default {
initChart() {
this.chart = echarts.init(document.querySelector('#activeChart'))
},
showLoading(){
showLoading() {
this.chart && this.chart.showLoading()
},
hideLoading(){
hideLoading() {
this.chart && this.chart.hideLoading()
},
setOption(data) {
const source = [['日期','电网功率','负载功率','储能功率','光伏功率','soc平均值','soh平均值','电池平均温度平均值']]
console.log('source.slice(1)',source[0].slice(1))
this.chart && data.forEach((item)=>{
source.push([item.statisDate,item.gridPower,item.loadPower,item.storagePower,item.pvPower,item.avgSoc,item.avgSoh,item.avgTemp])
const source = [['日期', '电网功率', '负载功率', '储能功率', '光伏功率', 'soc平均值', 'soh平均值', '电池平均温度平均值']]
console.log('source.slice(1)', source[0].slice(1))
this.chart && data.forEach((item) => {
source.push([item.statisDate, item.gridPower, item.loadPower, item.storagePower, item.pvPower, item.avgSoc, item.avgSoh, item.avgTemp])
})
this.chart.setOption({
grid: {
@ -91,8 +90,8 @@ export default {
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
textStyle:{
color:"#333333",
textStyle: {
color: "#333333",
},
xAxis: {
type: 'category',
@ -105,11 +104,17 @@ export default {
type: 'value',
},
],
dataset:{source},
series: source[0].slice(1).map((item,index)=>{
dataset: {source},
series: source[0].slice(1).map((item, index) => {
return {
type: 'line',
yAxisIndex:index<=4 ? 0 : 1
type: 'line',//index === 5 ? 'bar' : 'line',
showSymbol: false,
symbolSize: 2,
smooth: true,
areaStyle: {
opacity: 0.5,
},
yAxisIndex: index <= 4 ? 0 : 1
}
})
})