投运时间,系统总览刷新,图表警告处理等

This commit is contained in:
ym1026
2025-09-17 14:54:33 +08:00
parent 9377e7f8e6
commit a94ad0f8f8
18 changed files with 85 additions and 437 deletions

View File

@@ -48,7 +48,7 @@
:page-option="tableList[activeKey].pageOption"
:table-info="tableList[activeKey].tableInfo"
:table-data="tableList[activeKey].tableData"
@pagesizeChange="pagesizeChange()"
@pagesizeChange="pagesizeChange"
></energyEchart>
</a-spin>
</div>
@@ -60,6 +60,7 @@ import energyEchart from '@/components/statisticalAnalysis/energyEchart.vue'
import searchBox from '@/components/SearchBox.vue'
import { postReq, getReq } from '@/request/api'
import { getRunDays, getDateDaysAgo } from '@/utils/dealWithData'
import { contentQuotesLinter } from 'ant-design-vue/es/_util/cssinjs/linters'
export default {
name: 'StatisicalAnView',
@@ -509,7 +510,7 @@ export default {
this.renderKey += 1
},
resetDataForInactiveKey() {
// 重置非当前激活页面的数据,减少内存占用
// 重置非当前激活页面的数据
Object.keys(this.echartsInfo).forEach((key) => {
if (key != this.activeKey) {
this.echartsInfo[key].chartData = {}
@@ -519,7 +520,11 @@ export default {
Object.keys(this.tableList).forEach((key) => {
if (key != this.activeKey) {
this.echartsInfo[key].tableData = {}
this.tableList[key].tableData = []
this.tableList[key].pageOption={
page: 1,
pageSize: 10,
count: 1 }
}
})
},
@@ -556,21 +561,25 @@ export default {
...this.paramsDate,
category: this.activeKey,
page_size: currentInfo.pageOption.pageSize,
pageNumber: currentInfo.pageOption.page
page: currentInfo.pageOption.page
}
try {
const res = await getReq('/queryStatDetailList', query)
if (res.errcode === 0) {
this.tableList[this.activeKey].tableData = res.data.list || res.data
this.tableList[this.activeKey].pageOption.count = res.data.count || 0
this.tableList[this.activeKey].pageOption.count = res.count || 0
this.tableList[this.activeKey].pageOption.page = res.page || 0
this.tableList[this.activeKey].pageOption.pageSize = res.page_size || 0
this.loading.table = false
} else {
throw res
}
} catch (error) {
this.tableList[this.activeKey].tableData = []
this.tableList[this.activeKey].pageOption.count = 0
this.tableList[this.activeKey].pageOption.count = 0
this.tableList[this.activeKey].pageOption.page = 0
this.tableList[this.activeKey].pageOption.pageSize = 0
this.loading.table = false
}
},
@@ -579,7 +588,7 @@ export default {
if (this.activeKey) {
this.getStatCharts() // 定时获取最新实时数据
}
}, 10000) // 30秒刷新一次
}, 10000)
},
async getStationList() {
@@ -601,7 +610,6 @@ export default {
if (!this.stationId) {
this.stationId = this.stationList[0].value
}
//V I P
}
} else {
const err = { tip: res.errmsg }
@@ -619,7 +627,6 @@ export default {
onSearch(data) {
this.paramsDate.start_date = data.time ? data.time[0] : ''
this.paramsDate.end_date = data.time ? data.time[1] : ''
this.tableList[this.activeKey].pageOption.page = 1
this.getStationList(), this.getEchartsListForActiveKey(), this.getTableListForActiveKey()
},
@@ -628,7 +635,6 @@ export default {
},
async getStatCharts() {
const currentInfo = this.echartsInfo[this.activeKey]
const query = {
dt: this.paramsDate.end_date,
station_id: this.stationId,
@@ -638,16 +644,11 @@ export default {
const res = await getReq('/queryStatCharts', query)
if (res.errcode === 0) {
this.echartsInfo[this.activeKey].chartDatav = res.data
// x轴0点到24点
} else {
throw res
}
} catch (error) {
this.echartsInfo[this.activeKey].chartDatav = {
V: [100.0, 100.0, 100.0], // 电压曲线
I: [10.0, 10.0, 10.0], // 电流曲线
P: [1000.0, 1000.0, 1000.0] // 功率曲线
}
this.echartsInfo[this.activeKey].chartDatav = {}
}
}
}

View File

@@ -54,6 +54,7 @@ export default {
components: { Map },
data() {
return {
refreshInterval:null,
showFlag: false,
stationId: null,
deviceInfo: {},
@@ -109,31 +110,44 @@ export default {
return this.list.filter((_, index) => index % 2 !== 0).slice(0, 3) // 右列取前3个奇数索引
}
},
beforeUnmount() {
if(this.refreshInterval){
clearInterval(this.refreshInterval)
this.refreshInterval=null
}
},
async mounted() {
await Promise.all([
this.getOnLineList(),
this.getStatTotalList(),
this.getOperTotalList(),
this.getStatDayList(1),
this.getStatDayList(2),
this.getStatDayList(3)
]).then((r) => {
if (
this.deviceInfo.energy &&
this.deviceInfo.charge &&
this.deviceInfo.pv
) {
const newArr = this.mergedArray(
this.deviceInfo.energy,
this.deviceInfo.charge,
this.deviceInfo.pv
)
this.deviceInfo.alarm = newArr
}
})
await this.loadAllData()
this.refreshInterval=setInterval(async()=>{
await this.loadAllData()
},30000) //30s刷新一次
},
methods: {
async loadAllData(){
await Promise.all([
this.getOnLineList(),
this.getStatTotalList(),
this.getOperTotalList(),
this.getStatDayList(1),
this.getStatDayList(2),
this.getStatDayList(3)
]).then((r) => {
if (
this.deviceInfo.energy &&
this.deviceInfo.charge &&
this.deviceInfo.pv
) {
const newArr = this.mergedArray(
this.deviceInfo.energy,
this.deviceInfo.charge,
this.deviceInfo.pv
)
this.deviceInfo.alarm = newArr
}
})
},
getCurrentStation(e) {
this.stationId = e
},

View File

@@ -238,19 +238,16 @@ export default {
stationOptions.forEach((e, index) => {
e.list.forEach((i) => {
if (i.key == 'work_mode') {
console.log(row[i.key], 'rrrrrrrrr')
switch (row[i.key]) {
case '1':
case '5':
e.ruleForm[i.key] =row[i.key]
// this.$refs.EditCom.workModeIdSelect = row[i.key]
e.ruleForm['policy_id'] = row ? row['policy_id'] : ''
stationOptions[0].list[stationOptions[0].list.length - 1].type = 'select'
break
default:
e.ruleForm[i.key] =row[i.key]
console.log('1245')
stationOptions[0].list[stationOptions[0].list.length - 1].type = 'unshow'
break