mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
各模块样式等布局优化,运行分析接口联调
This commit is contained in:
@@ -48,46 +48,45 @@ import Alarm from '@/components/Home/Alarm.vue'
|
||||
import Map from '@/components/Home/Map.vue'
|
||||
import { getReq, postReq } from '@/request/api'
|
||||
import { getRunDays, getDateDaysAgo } from '@/utils/dealWithData'
|
||||
import { markRaw } from 'vue';
|
||||
import { markRaw } from 'vue'
|
||||
export default {
|
||||
name: 'Home',
|
||||
components: { Map },
|
||||
data() {
|
||||
return {
|
||||
showFlag: false,
|
||||
|
||||
stationId: null,
|
||||
deviceInfo: {},
|
||||
list: [
|
||||
{
|
||||
title: '运行状况',
|
||||
class: 'online-status',
|
||||
componentId:markRaw(onLine),
|
||||
componentId: markRaw(onLine),
|
||||
infoKey: 'onLineTotal'
|
||||
},
|
||||
{
|
||||
title: '运行分析',
|
||||
class: 'stats-cards',
|
||||
componentId:markRaw( Operational),
|
||||
infoKey: ''
|
||||
componentId: markRaw(Operational),
|
||||
infoKey: 'operationTotal'
|
||||
},
|
||||
{
|
||||
title: '储能设备',
|
||||
class: 'energy-status',
|
||||
componentId:markRaw( Energy),
|
||||
componentId: markRaw(Energy),
|
||||
infoKey: 'energy'
|
||||
},
|
||||
{
|
||||
title: '充电设备',
|
||||
class: 'charge-analysis',
|
||||
componentId:markRaw( Charge),
|
||||
componentId: markRaw(Charge),
|
||||
infoKey: 'charge'
|
||||
},
|
||||
|
||||
{
|
||||
title: '光伏设备',
|
||||
class: 'work-order',
|
||||
componentId:markRaw( Pv),
|
||||
componentId: markRaw(Pv),
|
||||
infoKey: 'pv'
|
||||
},
|
||||
{
|
||||
@@ -114,14 +113,15 @@ export default {
|
||||
await Promise.all([
|
||||
this.getOnLineList(),
|
||||
this.getStatTotalList(),
|
||||
this.getOperTotalList(),
|
||||
this.getStatDayList(1),
|
||||
this.getStatDayList(2),
|
||||
this.getStatDayList(3)
|
||||
]).then((r)=>{
|
||||
]).then((r) => {
|
||||
if (
|
||||
this.deviceInfo.energy.length &&
|
||||
this.deviceInfo.charge.length &&
|
||||
this.deviceInfo.pv.length
|
||||
this.deviceInfo.charge.length &&
|
||||
this.deviceInfo.pv.length
|
||||
) {
|
||||
const newArr = this.mergedArray(
|
||||
this.deviceInfo.energy,
|
||||
@@ -130,15 +130,11 @@ export default {
|
||||
)
|
||||
this.deviceInfo.alarm = newArr
|
||||
}
|
||||
console.log(r,'11111')
|
||||
|
||||
})
|
||||
// this.showFlag=true
|
||||
},
|
||||
|
||||
methods: {
|
||||
getCurrentStation(e) {
|
||||
console.log(e, 'getCurrentStation')
|
||||
this.stationId = e
|
||||
},
|
||||
// 查询系统统计信息
|
||||
@@ -149,7 +145,6 @@ export default {
|
||||
if (res.errcode === 0) {
|
||||
this.deviceInfo.onLine = JSON.parse(JSON.stringify(res.data))
|
||||
this.deviceInfo.onLine.runDays = getRunDays(res.data.launch_date)
|
||||
console.log(JSON.parse(JSON.stringify(res.data)), this.deviceInfo.onLine, '111111111111')
|
||||
} else {
|
||||
throw res
|
||||
}
|
||||
@@ -166,7 +161,7 @@ export default {
|
||||
// station_id:场站ID,为0或不传查询所有场站总计
|
||||
// category:类别,1:储能设备,2:充电设备,3:光伏设备,为0或不传查询所有类别总计
|
||||
const query = {
|
||||
date: new Date(),
|
||||
date: getDateDaysAgo(0),
|
||||
stationId: this.stationId,
|
||||
category: 0
|
||||
}
|
||||
@@ -176,35 +171,31 @@ export default {
|
||||
const { income_charge: incomeCharge, income_elect: incomeElect } =
|
||||
this.deviceInfo.allTotal
|
||||
this.deviceInfo.allTotal.incomeTotal = +incomeCharge + +incomeElect
|
||||
console.log(
|
||||
this.deviceInfo.allTotal.incomeTotal,
|
||||
incomeCharge,
|
||||
incomeElect,
|
||||
' this.deviceInfo.allTotal.incomeTotal'
|
||||
)
|
||||
} else {
|
||||
throw res
|
||||
}
|
||||
} catch (error) {
|
||||
this.deviceInfo.allTotal = {
|
||||
storageElectIn: 2,
|
||||
storageElectOut: 5,
|
||||
chargeElect: 4,
|
||||
chargeNum: 5,
|
||||
incomeCharge: 7,
|
||||
incomeElect: 7,
|
||||
solarElectGen: 7,
|
||||
solarElectGrid: 7
|
||||
this.deviceInfo.allTotal = {}
|
||||
this.deviceInfo.allTotal.incomeTotal = 0
|
||||
}
|
||||
},
|
||||
// 运行分析 联调
|
||||
async getOperTotalList() {
|
||||
try {
|
||||
const res = await getReq('/queryStatStation', {})
|
||||
if (res.errcode === 0) {
|
||||
this.deviceInfo.operationTotal = res.data
|
||||
} else {
|
||||
throw res
|
||||
}
|
||||
this.deviceInfo.allTotal.incomeTotal =
|
||||
this.deviceInfo.allTotal.incomeCharge + this.deviceInfo.allTotal.incomeElect
|
||||
} catch (error) {
|
||||
this.deviceInfo.operationTotal = [ ]
|
||||
}
|
||||
},
|
||||
|
||||
// 示例:获取7天前的日期
|
||||
// 查询场站日统计信息
|
||||
async getStatDayList(category) {
|
||||
console.log(category,"category")
|
||||
try {
|
||||
// station_id: 场站ID
|
||||
// category: 类别: 1:储能设备,2:充电设备,3:光伏设备
|
||||
@@ -221,7 +212,6 @@ export default {
|
||||
if (res.errcode === 0) {
|
||||
this.list.forEach((item) => {
|
||||
this.deviceInfo[arr[category]] = res.data
|
||||
|
||||
})
|
||||
} else {
|
||||
throw res
|
||||
|
||||
Reference in New Issue
Block a user