2025-06-22 17:22:40 +08:00
|
|
|
<template>
|
2025-08-13 17:49:25 +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>
|
|
|
|
|
<!-- 搜索栏-->
|
|
|
|
|
<el-form :inline="true" class="select-container">
|
|
|
|
|
<el-form-item label="编号">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="search.deviceId"
|
|
|
|
|
placeholder="请输入"
|
|
|
|
|
clearable
|
|
|
|
|
style="width: 150px"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="电池堆">
|
|
|
|
|
<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>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="电池簇">
|
|
|
|
|
<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>
|
|
|
|
|
</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>
|
|
|
|
|
<!-- 表格 -->
|
|
|
|
|
<dtdc-table
|
|
|
|
|
:tableData="tableData"
|
|
|
|
|
:pageNum="pageNum"
|
|
|
|
|
:pageSize="pageSize"
|
|
|
|
|
:totalSize="totalSize"
|
|
|
|
|
@chart="chartDetail"
|
|
|
|
|
@handleSizeChange="handleSizeChange"
|
|
|
|
|
@handleCurrentChange="handleCurrentChange"
|
|
|
|
|
/>
|
|
|
|
|
<chart-detail ref="chartDetail" />
|
|
|
|
|
</el-card>
|
2025-06-22 17:22:40 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2025-08-13 17:49:25 +08:00
|
|
|
import BarChart from "./BarChart";
|
|
|
|
|
import {
|
|
|
|
|
getStackNameList,
|
|
|
|
|
getClusterNameList,
|
|
|
|
|
getClusterDataInfoList,
|
|
|
|
|
} from "@/api/ems/dzjk";
|
2025-06-28 14:52:49 +08:00
|
|
|
import getQuerySiteId from "@/mixins/ems/getQuerySiteId";
|
2025-07-17 17:47:18 +08:00
|
|
|
import ChartDetail from "./ChartDetail.vue";
|
2025-08-13 17:49:25 +08:00
|
|
|
import Table from "./Table.vue";
|
2025-06-22 17:22:40 +08:00
|
|
|
export default {
|
2025-08-13 17:49:25 +08:00
|
|
|
name: "DzjkSbjkDtdc",
|
|
|
|
|
mixins: [getQuerySiteId],
|
|
|
|
|
components: { BarChart, ChartDetail, DtdcTable: Table },
|
2025-06-22 17:22:40 +08:00
|
|
|
data() {
|
|
|
|
|
return {
|
2025-08-13 17:49:25 +08:00
|
|
|
loading: false,
|
|
|
|
|
clusterloading: false,
|
|
|
|
|
search: { stackId: "", clusterId: "", deviceId: "" },
|
|
|
|
|
stackOptions: [], //{id:'',deviceName:''}
|
|
|
|
|
clusterOptions: [], //{id:'',deviceName:''}
|
|
|
|
|
tableData: [],
|
|
|
|
|
pageSize: 10, //分页栏当前每个数据总数
|
|
|
|
|
pageNum: 1, //分页栏当前页数
|
|
|
|
|
totalSize: 0, //table表格数据总数
|
|
|
|
|
};
|
2025-06-22 17:22:40 +08:00
|
|
|
},
|
2025-08-13 17:49:25 +08:00
|
|
|
methods: {
|
2025-07-17 17:47:18 +08:00
|
|
|
//查看表格行图表
|
2025-08-13 17:49:25 +08:00
|
|
|
chartDetail({ clusterDeviceId, deviceId, dataType = "" }) {
|
|
|
|
|
const { siteId } = this;
|
|
|
|
|
this.$refs.chartDetail.initChart(
|
|
|
|
|
{ siteId, clusterDeviceId, deviceId },
|
|
|
|
|
dataType
|
|
|
|
|
);
|
2025-07-17 17:47:18 +08:00
|
|
|
},
|
2025-06-30 17:32:04 +08:00
|
|
|
// 分页
|
|
|
|
|
handleSizeChange(val) {
|
|
|
|
|
this.pageSize = val;
|
2025-08-13 17:49:25 +08:00
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.getTableData();
|
|
|
|
|
});
|
2025-06-30 17:32:04 +08:00
|
|
|
},
|
|
|
|
|
handleCurrentChange(val) {
|
2025-08-13 17:49:25 +08:00
|
|
|
this.pageNum = val;
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.getTableData();
|
|
|
|
|
});
|
2025-06-30 17:32:04 +08:00
|
|
|
},
|
2025-06-22 17:22:40 +08:00
|
|
|
// 搜索
|
2025-08-13 17:49:25 +08:00
|
|
|
onSearch() {
|
|
|
|
|
this.pageNum = 1; //每次搜索从1开始搜索
|
|
|
|
|
this.getTableData();
|
2025-06-22 17:22:40 +08:00
|
|
|
},
|
|
|
|
|
// 重置
|
2025-06-28 14:52:49 +08:00
|
|
|
// 清空搜索栏选中数据
|
|
|
|
|
// 清空电池簇列表,保留电池堆列表
|
2025-08-13 17:49:25 +08:00
|
|
|
onReset() {
|
|
|
|
|
this.search = { stackId: "", clusterId: "", deviceId: "" };
|
|
|
|
|
this.clusterOptions = [];
|
|
|
|
|
this.pageNum = 1;
|
|
|
|
|
this.getTableData();
|
2025-06-22 17:22:40 +08:00
|
|
|
},
|
2025-08-13 17:49:25 +08:00
|
|
|
changeStackId(val) {
|
|
|
|
|
if (val) {
|
|
|
|
|
console.log(
|
|
|
|
|
"选择了电池堆,需要获取对应的电池簇",
|
|
|
|
|
val,
|
|
|
|
|
this.search.stackId
|
|
|
|
|
);
|
|
|
|
|
this.search.clusterId = "";
|
|
|
|
|
this.getClusterList();
|
2025-06-22 17:22:40 +08:00
|
|
|
}
|
|
|
|
|
},
|
2025-06-30 18:37:37 +08:00
|
|
|
//表格数据
|
2025-08-13 17:49:25 +08:00
|
|
|
getTableData() {
|
|
|
|
|
this.loading = true;
|
|
|
|
|
const {
|
|
|
|
|
stackId: stackDeviceId,
|
|
|
|
|
clusterId: clusterDeviceId,
|
|
|
|
|
deviceId,
|
|
|
|
|
} = this.search;
|
|
|
|
|
const { siteId, pageNum, pageSize } = this;
|
|
|
|
|
getClusterDataInfoList({
|
|
|
|
|
stackDeviceId,
|
|
|
|
|
clusterDeviceId,
|
|
|
|
|
siteId,
|
|
|
|
|
// deviceId,
|
|
|
|
|
pageNum,
|
|
|
|
|
pageSize,
|
2025-06-30 18:37:37 +08:00
|
|
|
})
|
2025-08-13 17:49:25 +08:00
|
|
|
.then((response) => {
|
|
|
|
|
this.tableData = response?.rows || [];
|
|
|
|
|
this.totalSize = response?.total || 0;
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
this.loading = false;
|
|
|
|
|
});
|
2025-06-30 18:37:37 +08:00
|
|
|
},
|
2025-08-13 17:49:25 +08:00
|
|
|
getStackList() {
|
|
|
|
|
getStackNameList(this.siteId).then((response) => {
|
|
|
|
|
this.stackOptions = JSON.parse(JSON.stringify(response?.data || []));
|
|
|
|
|
});
|
2025-06-28 14:52:49 +08:00
|
|
|
},
|
2025-08-13 17:49:25 +08:00
|
|
|
getClusterList() {
|
|
|
|
|
this.clusterloading = true;
|
|
|
|
|
getClusterNameList({
|
|
|
|
|
stackDeviceId: this.search.stackId,
|
|
|
|
|
siteId: this.siteId,
|
|
|
|
|
})
|
|
|
|
|
.then((response) => {
|
|
|
|
|
this.clusterOptions = JSON.parse(
|
|
|
|
|
JSON.stringify(response?.data || [])
|
|
|
|
|
);
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
this.clusterloading = false;
|
|
|
|
|
});
|
2025-06-28 14:52:49 +08:00
|
|
|
},
|
2025-08-13 17:49:25 +08:00
|
|
|
init() {
|
2025-06-28 15:22:08 +08:00
|
|
|
// 只有页面初次加载或切换站点的时候调用电池堆列表,其他情况不需要
|
2025-08-13 17:49:25 +08:00
|
|
|
this.search = { stackId: "", clusterId: "" }; //保证切换站点时,清空选择项
|
|
|
|
|
this.getStackList();
|
|
|
|
|
this.getTableData();
|
|
|
|
|
},
|
2025-06-22 17:22:40 +08:00
|
|
|
},
|
2025-08-13 17:49:25 +08:00
|
|
|
mounted() {},
|
|
|
|
|
};
|
2025-06-22 17:22:40 +08:00
|
|
|
</script>
|