Files
emsapp/pages/work/bmsdcc/index.vue

213 lines
6.1 KiB
Vue
Raw Normal View History

2025-07-29 23:05:58 +08:00
<template>
<view class="page-container">
<uni-collapse ref="collapse" accordion v-if="list.length > 0">
2026-01-15 17:51:09 +08:00
<uni-collapse-item v-for="(item,index) in list" :key="item.deviceId+'bmscc'" :open="index===0"
2026-01-23 22:33:18 +08:00
class="common-collapse-item" :class="handleCardClass(item)">
2026-01-15 17:51:09 +08:00
<template v-slot:title>
<view class='title-wrapper'>
<view class="top">
<view class="status">{{CLUSTERWorkStatusOptions[item.workStatus] || '暂无数据'}}</view>
2026-01-15 17:51:09 +08:00
<text
class="name">{{`${item.parentDeviceName?`${item.parentDeviceName} -> ` : ''}${item.deviceName}`}}</text>
</view>
</view>
</template>
<view class='content'>
<!-- 设备状态栏 -->
<uni-group mode="card" class="status-card-group">
2026-01-19 17:30:03 +08:00
<view class="flex-container">
<view class="flex-lists">
2025-07-29 23:05:58 +08:00
<view class="grid-item-box">
<view class="title">工作状态</view>
2026-01-15 17:51:09 +08:00
<text
class="text work-status-color">{{CLUSTERWorkStatusOptions[item.workStatus] || '-'}}</text>
2025-07-29 23:05:58 +08:00
</view>
2026-01-19 17:30:03 +08:00
</view>
<view class="flex-lists">
2025-07-29 23:05:58 +08:00
<view class="grid-item-box">
<view class="title">与PCS通信</view>
<text
2026-01-15 17:51:09 +08:00
class="text">{{communicationStatusOptions[item.pcsCommunicationStatus] || '-'}}</text>
2025-07-29 23:05:58 +08:00
</view>
2026-01-19 17:30:03 +08:00
</view>
<view class="flex-lists">
2025-07-29 23:05:58 +08:00
<view class="grid-item-box">
<view class="title">与EMS通信</view>
<text
2026-01-15 17:51:09 +08:00
class="text">{{communicationStatusOptions[item.emsCommunicationStatus] || '-'}}</text>
2025-07-29 23:05:58 +08:00
</view>
2026-01-19 17:30:03 +08:00
</view>
</view>
2025-07-29 23:05:58 +08:00
</uni-group>
2026-01-15 17:51:09 +08:00
<!-- 设备数据 -->
<uni-group mode="card" class="data-card-group">
<uni-row v-for="(infoDataItem,infoDataIndex) in infoData" :key="infoDataIndex+'infoData'"
class="data-row">
<uni-col :span="8">
<view class="title">{{infoDataItem.label}}</view>
</uni-col>
<uni-col :span="16">
<view class="value">{{item[infoDataItem.attr] | formatNumber}}
<text v-if="infoDataItem.unit" v-html="infoDataItem.unit"></text>
2025-07-29 23:05:58 +08:00
</view>
2026-01-15 17:51:09 +08:00
</uni-col>
</uni-row>
2025-07-29 23:05:58 +08:00
</uni-group>
2026-01-15 17:51:09 +08:00
<!-- 子设备表格 -->
<uni-group mode="card" class="child-card-group" style="margin-bottom:20rpx;">
<uni-table border stripe emptyText="暂无数据" class="child-table">
2025-07-29 23:05:58 +08:00
<!-- 表头行 -->
<uni-tr>
<uni-th align="center">名称</uni-th>
<uni-th align="center">单体平均值</uni-th>
<uni-th align="center">单体最小值</uni-th>
<uni-th align="center">单体最小值ID</uni-th>
<uni-th align="center">单体最大值</uni-th>
<uni-th align="center">单体最大值ID</uni-th>
</uni-tr>
<!-- 表格数据行 -->
<uni-tr v-for="(tableItem, tableIndex) in item.batteryDataList"
:key="tableIndex+'batteryDataList'">
<uni-td align="center"
v-html="`${tableItem.dataName}${unitObj[tableItem.dataName]}`"></uni-td>
<uni-td align="center">{{tableItem.avgData}}</uni-td>
<uni-td align="center">{{tableItem.minData}}</uni-td>
<uni-td align="center">{{tableItem.minDataID}}</uni-td>
<uni-td align="center">{{tableItem.maxData}}</uni-td>
<uni-td align="center">{{tableItem.maxDataID}}</uni-td>
</uni-tr>
</uni-table>
</uni-group>
</view>
</uni-collapse-item>
</uni-collapse>
<view class="no-data" v-else>
暂无数据
</view>
</view>
</template>
<script>
import {
getBMSBatteryCluster
} from '@/api/ems/site.js'
import {
mapState
} from 'vuex'
export default {
computed: {
...mapState({
CLUSTERWorkStatusOptions: (state) =>
state.ems.CLUSTERWorkStatusOptions,
2025-07-29 23:05:58 +08:00
communicationStatusOptions: (state) =>
state.ems.communicationStatusOptions,
})
},
data() {
return {
unitObj: {
'电压': 'V',
'温度': '&#8451;',
'SOC': '%'
},
list: [],
siteId: '',
infoData: [{
label: '簇电压',
attr: 'clusterVoltage',
2025-10-15 18:16:56 +08:00
unit: 'V',
pointName: '簇电压'
2025-07-29 23:05:58 +08:00
},
{
label: '可充电量',
attr: 'chargeableCapacity',
2025-10-15 18:16:56 +08:00
unit: 'kWh',
pointName: '可充电量'
2025-07-29 23:05:58 +08:00
},
{
label: '累计充电量',
attr: 'totalChargedCapacity',
2025-10-15 18:16:56 +08:00
unit: 'kWh',
pointName: '累计充电量'
2025-07-29 23:05:58 +08:00
},
{
label: '簇电流',
attr: 'clusterCurrent',
2025-10-15 18:16:56 +08:00
unit: 'A',
pointName: '簇电流'
2025-07-29 23:05:58 +08:00
},
{
label: '可放电量',
attr: 'dischargeableCapacity',
2025-10-15 18:16:56 +08:00
unit: 'kWh',
pointName: '可放电量'
2025-07-29 23:05:58 +08:00
},
{
label: '累计放电量',
attr: 'totalDischargedCapacity',
2025-10-15 18:16:56 +08:00
unit: 'kWh',
pointName: '累计放电量'
2025-07-29 23:05:58 +08:00
},
{
label: 'SOH',
attr: 'soh',
2025-10-15 18:16:56 +08:00
unit: '%',
pointName: 'SOH'
2025-07-29 23:05:58 +08:00
},
{
label: '平均温度',
attr: 'averageTemperature',
2025-10-15 18:16:56 +08:00
unit: '&#8451;',
pointName: '平均温度'
2025-07-29 23:05:58 +08:00
},
{
label: '绝缘电阻',
attr: 'insulationResistance',
2025-10-15 18:16:56 +08:00
unit: '&Omega;',
pointName: '绝缘电阻'
2025-07-29 23:05:58 +08:00
},
{
label: '当前SOC',
attr: 'currentSoc',
2025-10-15 18:16:56 +08:00
unit: '%',
pointName: '当前SOC'
2025-07-29 23:05:58 +08:00
},
]
}
},
2026-01-23 22:33:18 +08:00
methods: {
handleCardClass(item) {
const {
workStatus = ''
} = item
return !(Object.keys(this.CLUSTERWorkStatusOptions).includes(item.workStatus)) ? "timing-collapse-item" :
workStatus === '9' ? 'warning-collapse-item' : 'running-collapse-item'
2026-01-23 22:33:18 +08:00
},
},
2026-01-19 17:30:03 +08:00
onLoad(options) {
2025-07-29 23:05:58 +08:00
uni.showLoading()
2026-01-19 17:30:03 +08:00
this.siteId = options.siteId || ''
2025-07-29 23:05:58 +08:00
getBMSBatteryCluster({
siteId: this.siteId
}).then(response => {
this.list = response?.data || []
if (this.list.length > 0) {
this.$nextTick(() => {
setTimeout(() => {
2026-01-19 17:30:03 +08:00
// this.$refs.collapse.resize()
2025-07-29 23:05:58 +08:00
uni.hideLoading()
}, 100)
})
} else {
uni.hideLoading()
}
}).catch(() => {
uni.hideLoading()
})
}
}
2026-01-15 17:51:09 +08:00
</script>