db接口参数更新,实时运行接口联调

This commit is contained in:
白菜
2025-07-07 22:10:25 +08:00
parent 21a8871e3c
commit 6523e061bd
10 changed files with 245 additions and 129 deletions

View File

@ -66,7 +66,7 @@ export default {
this.dateRange=[]
this.getData()
},
setOption(data){
setOption(data,unit){
const source = [['日期','充电量','放电量','效率']]
data.forEach(item=>{
source.push([item.ammeterDate, item.chargedCap,item.disChargedCap,item.dailyEfficiency])
@ -78,7 +78,11 @@ export default {
// bottom: '10',
// },
tooltip: {},
xAxis: { type: 'category' },
xAxis: {
type: 'category',
name:unit,
nameLocation:'center'
},
yAxis: [{
type: 'value',
name:'充电量/放电量kWh',
@ -124,8 +128,8 @@ export default {
const [start='',end='']=this.dateRange || [];
const startDate=formatDate(start),endDate = formatDate(end)
getElectricData({siteId:this.siteId,startDate,endDate}).then(response => {
const {totalChargedCap='',totalDisChargedCap='',efficiency='',sevenDayDisChargeStats=[]}=response?.data || {}
this.setOption(sevenDayDisChargeStats || [])
const {totalChargedCap='',totalDisChargedCap='',efficiency='',sevenDayDisChargeStats=[],unit=''}=response?.data || {}
this.setOption(sevenDayDisChargeStats || [],unit)
this.totalChargedCap=totalChargedCap
this.totalDisChargedCap=totalDisChargedCap
this.efficiency=efficiency