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

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']]
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
})
}
},

View File

@ -48,18 +48,50 @@
prop="voltage"
label="电压V"
>
<template slot-scope="scope">
<el-button
@click="chartDetail(scope.row,'voltage')"
type="text"
size="small">
{{scope.row.voltage}}
</el-button>
</template>
</el-table-column>
<el-table-column
prop="temperature"
label="温度(℃)">
<template slot-scope="scope">
<el-button
@click="chartDetail(scope.row,'temperature')"
type="text"
size="small">
{{scope.row.temperature}}
</el-button>
</template>
</el-table-column>
<el-table-column
prop="soc"
label="SOC%">
<template slot-scope="scope">
<el-button
@click="chartDetail(scope.row,'soc')"
type="text"
size="small">
{{scope.row.soc}}
</el-button>
</template>
</el-table-column>
<el-table-column
prop="soh"
label="SOH%">
<template slot-scope="scope">
<el-button
@click="chartDetail(scope.row,'soh')"
type="text"
size="small">
{{scope.row.soh}}
</el-button>
</template>
</el-table-column>
<el-table-column
label="曲线图">
@ -115,9 +147,9 @@ export default {
},
methods:{
//查看表格行图表
chartDetail(row){
chartDetail(row,dataType = ''){
const { clusterDeviceId, deviceId} = row,{siteId} = this
this.$refs.chartDetail.initChart({siteId,clusterDeviceId,deviceId})
this.$refs.chartDetail.initChart({siteId,clusterDeviceId,deviceId},dataType)
},
// 分页
handleSizeChange(val) {