单体电池数据点击可以查看表格

This commit is contained in:
2025-07-18 19:15:05 +08:00
parent 62eb0e7e7d
commit 658fa5042c
2 changed files with 79 additions and 24 deletions

View File

@ -46,6 +46,7 @@ export default {
siteId:'',
deviceId:'',
clusterDeviceId:'',
dataType:'',//展示的数据类型 空值展示所有数据
pickerOptions:{
disabledDate(time) {
return time.getTime() > Date.now();
@ -82,10 +83,11 @@ export default {
this.dateRange=[]
this.getData()
},
initChart({siteId, clusterDeviceId, deviceId}) {
initChart({siteId, clusterDeviceId, deviceId},dataType) {
this.siteId=siteId
this.clusterDeviceId=clusterDeviceId
this.deviceId=deviceId
this.dataType=dataType
this.dateRange=[]
this.dialogTableVisible = true
this.$nextTick(()=>{
@ -94,10 +96,47 @@ export default {
})
},
setOption(data) {
const source = [['日期','电压','温度','SOC','SOH']]
data.forEach(item => {
source.push([item.dataTimestamp,item.voltage,item.temperature,item.soc,item.soh])
})
const obj = {
voltage:'电压',
temperature:'温度',
soc:'SOC',
soh:'SOH',
}
let source,series,{dataType} = this
if(dataType){
source = [['日期',obj[dataType]]]
data.forEach(item => {
source.push([item.dataTimestamp,item[dataType]])
})
series=[{
name:obj[dataType],
type: 'line',
}]
}else{
source = [['日期','电压','温度','SOC','SOH']]
data.forEach(item => {
source.push([item.dataTimestamp,item.voltage,item.temperature,item.soc,item.soh])
})
series=[
{
name:'电压',
type: 'line',
},{
name:'温度',
type: 'line',
},
{
name:'SOC',
type: 'line',
},{
name:'SOH',
type: 'line',
}]
}
this.chart && this.chart.setOption({
color:['#FFBD00','#3C81FF','#05AEA3','#F86F70'],
legend: {
@ -121,23 +160,7 @@ export default {
dataset:{
source
},
series: [
{
name:'电压',
type: 'line',
},{
name:'温度',
type: 'line',
},
{
name:'SOC',
type: 'line',
},{
name:'SOH',
type: 'line',
}]
series
})
}
},