2025-07-29 23:05:58 +08:00
|
|
|
<template>
|
|
|
|
|
<view class="page-container">
|
|
|
|
|
<uni-collapse ref="collapse" accordion v-if="list.length > 0">
|
|
|
|
|
<uni-collapse-item v-for="(item,index) in list" :key="item.deviceId+'bmszl'" :open="index===0"
|
2026-01-23 20:28:39 +08:00
|
|
|
class="common-collapse-item" :class="handleCardClass(item,index)">
|
2026-01-15 17:51:09 +08:00
|
|
|
|
|
|
|
|
<template v-slot:title>
|
|
|
|
|
<view class='title-wrapper'>
|
|
|
|
|
<view class="top">
|
2026-01-23 20:28:39 +08:00
|
|
|
<view class="status">{{STACKWorkStatusOptions[item.workStatus] || '暂无数据'}}</view>
|
2026-01-15 17:51:09 +08:00
|
|
|
<text class="name">{{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
|
2026-01-23 20:28:39 +08:00
|
|
|
class="text work-status-color">{{STACKWorkStatusOptions[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-03-05 16:34:25 +08:00
|
|
|
</view>
|
|
|
|
|
</uni-collapse-item>
|
|
|
|
|
</uni-collapse>
|
2025-07-29 23:05:58 +08:00
|
|
|
<view class="no-data" v-else>
|
|
|
|
|
暂无数据
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
2026-03-05 16:34:25 +08:00
|
|
|
<script>
|
|
|
|
|
import {
|
|
|
|
|
getProjectDisplayData,
|
|
|
|
|
getStackNameList
|
|
|
|
|
} from '@/api/ems/site.js'
|
|
|
|
|
import {
|
|
|
|
|
mapState
|
|
|
|
|
} from 'vuex'
|
|
|
|
|
export default {
|
2025-07-29 23:05:58 +08:00
|
|
|
computed: {
|
|
|
|
|
...mapState({
|
2026-01-23 20:28:39 +08:00
|
|
|
STACKWorkStatusOptions: (state) =>
|
|
|
|
|
state.ems.STACKWorkStatusOptions,
|
2025-07-29 23:05:58 +08:00
|
|
|
communicationStatusOptions: (state) =>
|
|
|
|
|
state.ems.communicationStatusOptions,
|
|
|
|
|
})
|
|
|
|
|
},
|
2026-03-05 16:34:25 +08:00
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
displayData: [],
|
|
|
|
|
stackDeviceList: [],
|
|
|
|
|
list: [],
|
|
|
|
|
siteId: '',
|
|
|
|
|
infoData: [{
|
2025-07-29 23:05:58 +08:00
|
|
|
label: '电池堆总电压',
|
|
|
|
|
attr: 'stackVoltage',
|
2025-10-15 18:16:56 +08:00
|
|
|
unit: 'V',
|
|
|
|
|
pointName: '电池堆电压'
|
2025-07-29 23:05:58 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '可充电量',
|
|
|
|
|
attr: 'availableChargeCapacity',
|
2025-10-15 18:16:56 +08:00
|
|
|
unit: 'kWh',
|
|
|
|
|
pointName: '可充电量'
|
2025-07-29 23:05:58 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '累计充电量',
|
|
|
|
|
attr: 'totalChargeCapacity',
|
2025-10-15 18:16:56 +08:00
|
|
|
unit: 'kWh',
|
|
|
|
|
pointName: '累计充电量'
|
2025-07-29 23:05:58 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '电池堆总电流',
|
|
|
|
|
attr: 'stackCurrent',
|
2025-10-15 18:16:56 +08:00
|
|
|
unit: 'A',
|
|
|
|
|
pointName: '电池堆总电流'
|
2025-07-29 23:05:58 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '可放电量',
|
|
|
|
|
attr: 'availableDischargeCapacity',
|
2025-10-15 18:16:56 +08:00
|
|
|
unit: 'kWh',
|
|
|
|
|
pointName: '可放电量'
|
2025-07-29 23:05:58 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '累计放电量',
|
|
|
|
|
attr: 'totalDischargeCapacity',
|
2025-10-15 18:16:56 +08:00
|
|
|
unit: 'kWh',
|
|
|
|
|
pointName: '累计放电量'
|
2025-07-29 23:05:58 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: 'SOH',
|
|
|
|
|
attr: 'stackSoh',
|
2025-10-15 18:16:56 +08:00
|
|
|
unit: '%',
|
|
|
|
|
pointName: 'SOH'
|
2025-07-29 23:05:58 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '平均温度',
|
|
|
|
|
attr: 'operatingTemp',
|
2025-10-15 18:16:56 +08:00
|
|
|
unit: '℃',
|
|
|
|
|
pointName: '平均温度'
|
2025-07-29 23:05:58 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '绝缘电阻',
|
|
|
|
|
attr: 'stackInsulationResistance',
|
2025-10-15 18:16:56 +08:00
|
|
|
unit: 'Ω',
|
|
|
|
|
pointName: '绝缘电阻'
|
2025-07-29 23:05:58 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '当前SOC',
|
|
|
|
|
attr: 'stackSoc',
|
2025-10-15 18:16:56 +08:00
|
|
|
unit: '%',
|
|
|
|
|
pointName: '当前SOC'
|
2025-07-29 23:05:58 +08:00
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
}
|
2026-03-05 16:34:25 +08:00
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
getModuleRows(menuCode, sectionName) {
|
|
|
|
|
return (this.displayData || []).filter(item => item.menuCode === menuCode && item.sectionName === sectionName)
|
|
|
|
|
},
|
|
|
|
|
getFieldName(fieldCode) {
|
|
|
|
|
const raw = String(fieldCode || '').trim()
|
|
|
|
|
if (!raw) return ''
|
|
|
|
|
const index = raw.lastIndexOf('__')
|
|
|
|
|
return index >= 0 ? raw.slice(index + 2) : raw
|
|
|
|
|
},
|
|
|
|
|
isEmptyValue(value) {
|
|
|
|
|
return value === undefined || value === null || value === ''
|
|
|
|
|
},
|
|
|
|
|
getFieldRowMap(rows = [], deviceId = '') {
|
|
|
|
|
const map = {}
|
|
|
|
|
const targetDeviceId = String(deviceId || '')
|
|
|
|
|
rows.forEach(item => {
|
|
|
|
|
if (!item || !item.fieldCode) return
|
|
|
|
|
const itemDeviceId = String(item.deviceId || '')
|
|
|
|
|
if (itemDeviceId !== targetDeviceId) return
|
|
|
|
|
map[this.getFieldName(item.fieldCode)] = item
|
|
|
|
|
})
|
|
|
|
|
rows.forEach(item => {
|
|
|
|
|
if (!item || !item.fieldCode) return
|
|
|
|
|
const itemDeviceId = String(item.deviceId || '')
|
|
|
|
|
if (itemDeviceId !== '') return
|
|
|
|
|
const fieldName = this.getFieldName(item.fieldCode)
|
|
|
|
|
const existRow = map[fieldName]
|
|
|
|
|
if (!existRow || this.isEmptyValue(existRow.fieldValue)) {
|
|
|
|
|
map[fieldName] = item
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
return map
|
|
|
|
|
},
|
|
|
|
|
getFieldMap(rowMap = {}) {
|
|
|
|
|
const map = {}
|
|
|
|
|
Object.keys(rowMap || {}).forEach((fieldName) => {
|
|
|
|
|
map[fieldName] = rowMap[fieldName]?.fieldValue
|
|
|
|
|
})
|
|
|
|
|
return map
|
|
|
|
|
},
|
|
|
|
|
buildBaseInfoList() {
|
|
|
|
|
const devices = (this.stackDeviceList && this.stackDeviceList.length > 0) ? this.stackDeviceList : [{
|
|
|
|
|
deviceId: this.siteId,
|
|
|
|
|
deviceName: 'BMS总览'
|
|
|
|
|
}]
|
|
|
|
|
this.list = devices.map(device => {
|
|
|
|
|
const id = device.deviceId || device.id || this.siteId
|
|
|
|
|
const infoRowMap = this.getFieldRowMap(this.getModuleRows('SBJK_BMSZL', '堆信息'), id)
|
|
|
|
|
const statusRowMap = this.getFieldRowMap(this.getModuleRows('SBJK_BMSZL', '状态'), id)
|
|
|
|
|
const infoMap = this.getFieldMap(infoRowMap)
|
|
|
|
|
const statusMap = this.getFieldMap(statusRowMap)
|
|
|
|
|
return {
|
|
|
|
|
...infoMap,
|
|
|
|
|
workStatus: statusMap.workStatus,
|
|
|
|
|
pcsCommunicationStatus: statusMap.pcsCommunicationStatus,
|
|
|
|
|
emsCommunicationStatus: statusMap.emsCommunicationStatus,
|
|
|
|
|
siteId: this.siteId,
|
|
|
|
|
deviceId: id,
|
|
|
|
|
deviceName: device.deviceName || device.name || device.deviceId || device.id || 'BMS总览',
|
|
|
|
|
batteryDataList: []
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleCardClass(item) {
|
|
|
|
|
const {
|
|
|
|
|
workStatus = ''
|
|
|
|
|
} = item
|
|
|
|
|
return !Object.keys(this.STACKWorkStatusOptions).find(i => i === workStatus) ? "timing-collapse-item" :
|
|
|
|
|
workStatus === '9' ? 'warning-collapse-item' : 'running-collapse-item'
|
|
|
|
|
},
|
|
|
|
|
updateData() {
|
|
|
|
|
return Promise.all([
|
|
|
|
|
getProjectDisplayData(this.siteId),
|
|
|
|
|
getStackNameList(this.siteId)
|
|
|
|
|
]).then(([displayResponse, stackResponse]) => {
|
|
|
|
|
this.displayData = displayResponse?.data || []
|
|
|
|
|
this.stackDeviceList = stackResponse?.data || []
|
|
|
|
|
this.buildBaseInfoList()
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
this.displayData = []
|
|
|
|
|
this.stackDeviceList = []
|
|
|
|
|
this.list = []
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onLoad(options) {
|
|
|
|
|
uni.showLoading()
|
|
|
|
|
this.siteId = options.siteId || ''
|
|
|
|
|
this.updateData().then(() => {
|
|
|
|
|
if (this.list.length === 0) {
|
|
|
|
|
uni.hideLoading()
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.$refs.collapse && this.$refs.collapse.resize()
|
|
|
|
|
uni.hideLoading()
|
|
|
|
|
}, 100)
|
|
|
|
|
})
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
uni.hideLoading()
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|