Files
emsfront/src/views/ems/dzjk/sbjk/dtdc/index.vue

168 lines
5.4 KiB
Vue
Raw Normal View History

<template>
2025-06-28 14:52:49 +08:00
<el-card v-loading="loading" shadow="always" class="common-card-container common-card-container-no-title-bg">
<div slot="header">
<span class="large-title">单体电池实时数据</span>
</div>
<!-- 搜索栏-->
2025-06-24 22:48:33 +08:00
<el-form :inline="true" class="select-container">
<el-form-item label="电池堆">
2025-06-28 14:52:49 +08:00
<el-select v-model="search.stackId" placeholder="请选择" @change="changeStackId">
<el-option :label="item.deviceName" :value="item.id" v-for="(item,index) in stackOptions" :key="index+'stackOptions'"></el-option>
2025-06-24 22:48:33 +08:00
</el-select>
</el-form-item>
<el-form-item label="电池簇">
2025-06-28 14:52:49 +08:00
<el-select v-model="search.clusterId" :no-data-text="!search.stackId && stackOptions.length > 0 ? '请先选择电池堆':'无数据'" placeholder="请选择" :loading="clusterloading" loading-text="正在加载数据">
<el-option :label="item.deviceName" :value="item.id" v-for="(item,index) in clusterOptions" :key="index+'clusterOptions'"></el-option>
2025-06-24 22:48:33 +08:00
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSearch" native-type="button">搜索</el-button>
</el-form-item>
<el-form-item>
<el-button @click="onReset" native-type="button">重置</el-button>
</el-form-item>
</el-form>
<!-- 图表-->
2025-06-30 17:32:04 +08:00
<!-- <div style="margin:30px 0;box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);">-->
<!-- <el-row style="background:#fff;margin:30px 0;">-->
<!-- <el-col :xs="24" :sm="24" :lg="24">-->
<!-- <bar-chart ref="barChart"/>-->
<!-- </el-col>-->
<!-- </el-row>-->
<!-- </div>-->
<el-table
class="common-table"
:data="tableData"
stripe
style="width: 100%;margin-top: 25px">
<el-table-column
2025-06-30 19:06:56 +08:00
prop="deviceId"
2025-06-30 17:32:04 +08:00
label="单体编号">
</el-table-column>
<el-table-column
2025-06-30 18:37:37 +08:00
prop="voltage"
2025-06-30 17:32:04 +08:00
label="电压V"
>
</el-table-column>
<el-table-column
2025-06-30 18:37:37 +08:00
prop="voltage"
2025-06-30 17:32:04 +08:00
label="温度(℃)">
</el-table-column>
<el-table-column
prop="soc"
label="SOC%">
</el-table-column>
<el-table-column
prop="soh"
label="SOH%">
</el-table-column>
</el-table>
<el-pagination
2025-06-30 18:37:37 +08:00
v-show="tableData.length>0"
2025-06-30 17:32:04 +08:00
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pageNum"
:page-size="pageSize"
2025-06-30 19:06:56 +08:00
layout=" prev, pager, next, jumper"
:total="totalSize"
2025-06-30 18:37:37 +08:00
style="margin-top:15px;text-align: center"
>
2025-06-30 17:32:04 +08:00
</el-pagination>
2025-06-30 18:37:37 +08:00
<!-- :total="totalSize" :page-sizes="[10, 20, 30, 40]" layout="total, sizes, prev, pager, next, jumper" -->
</el-card>
</template>
<script>
import BarChart from './BarChart'
2025-06-30 18:37:37 +08:00
import {getStackNameList, getClusterNameList, getClusterDataInfoList} from '@/api/ems/dzjk'
2025-06-28 14:52:49 +08:00
import getQuerySiteId from "@/mixins/ems/getQuerySiteId";
export default {
name:'DzjkSbjkDtdc',
2025-06-28 14:52:49 +08:00
mixins:[getQuerySiteId],
components:{BarChart},
data() {
return {
loading:false,
2025-06-28 14:52:49 +08:00
clusterloading:false,
search:{stackId:'',clusterId:''},
stackOptions:[],//{id:'',deviceName:''}
2025-06-30 17:32:04 +08:00
clusterOptions:[],//{id:'',deviceName:''}
tableData:[],
pageSize:10,//分页栏当前每个数据总数
pageNum:1,//分页栏当前页数
2025-06-30 19:06:56 +08:00
totalSize:0,//table表格数据总数
}
},
methods:{
2025-06-30 17:32:04 +08:00
// 分页
handleSizeChange(val) {
this.pageSize = val;
this.$nextTick(()=>{
2025-06-30 18:37:37 +08:00
this.getTableData()
2025-06-30 17:32:04 +08:00
})
},
handleCurrentChange(val) {
this.pageNum = val
this.$nextTick(()=>{
2025-06-30 18:37:37 +08:00
this.getTableData()
2025-06-30 17:32:04 +08:00
})
},
// 搜索
onSearch(){
2025-06-30 18:37:37 +08:00
this.getTableData()
},
// 重置
2025-06-28 14:52:49 +08:00
// 清空搜索栏选中数据
// 清空电池簇列表,保留电池堆列表
onReset(){
2025-06-28 14:52:49 +08:00
this.search={stackId:'',clusterId:''}
this.clusterOptions=[]
2025-06-30 18:37:37 +08:00
this.getTableData()
},
2025-06-28 14:52:49 +08:00
changeStackId(val){
if(val){
console.log('选择了电池堆,需要获取对应的电池簇',val,this.search.stackId)
this.search.clusterId=''
this.getClusterList()
}
},
2025-06-30 18:37:37 +08:00
//表格数据
getTableData(){
this.loading=true;
getClusterDataInfoList(this.search.stackId,this.search.clusterId,this.pageNum).then(response => {
2025-06-30 19:06:56 +08:00
this.tableData=response?.rows || [];
this.totalSize = response?.total || 0
2025-06-30 18:37:37 +08:00
}).finally(()=>{
this.loading=false;
})
},
2025-06-28 14:52:49 +08:00
getStackList(){
getStackNameList(this.siteId).then(response => {
this.stackOptions = JSON.parse(JSON.stringify(response?.data || []))
})
},
getClusterList(){
this.clusterloading =true
getClusterNameList(this.search.stackId).then(response => {
this.clusterOptions = JSON.parse(JSON.stringify(response?.data || []))
}).finally(() => {this.clusterloading =false})
},
2025-06-30 18:37:37 +08:00
init(){
// 只有页面初次加载或切换站点的时候调用电池堆列表,其他情况不需要
2025-06-30 18:37:37 +08:00
this.search={stackId:'',clusterId:''}//保证切换站点时,清空选择项
this.getStackList()
this.getTableData()
2025-06-28 14:52:49 +08:00
}
},
mounted(){
2025-06-28 14:52:49 +08:00
}
}
</script>