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

216 lines
5.2 KiB
Vue
Raw Normal View History

2025-07-29 23:05:58 +08:00
<template>
<view class="page-container">
2026-01-15 17:51:09 +08:00
<uni-collapse ref="collapse" accordion v-if="list.length > 0">
<uni-collapse-item v-for="(item,index) in list" :key="index+'dbList'" :open="index===0"
class="common-collapse-item" :class="{
'timing-collapse-item':!['0','2'].includes(item.emsCommunicationStatus),
'warning-collapse-item':item.emsCommunicationStatus === '2',
'running-collapse-item':item.emsCommunicationStatus === '0'
}">
2025-07-29 23:05:58 +08:00
<template v-slot:title>
2026-01-15 17:51:09 +08:00
<view class='title-wrapper'>
<view class="top">
<view class="status">{{communicationStatusOptions[item.emsCommunicationStatus] || '暂无数据'}}
</view>
<text class="name">{{item.deviceName}}</text>
2025-07-29 23:05:58 +08:00
</view>
</view>
</template>
2026-01-23 21:46:21 +08:00
<view class='content'>
2026-01-15 17:51:09 +08:00
<uni-group mode="card" class="data-card-group">
<uni-row v-for="(tempDataItem,tempDataIndex) in
2026-01-23 21:46:21 +08:00
(deviceIdTypeMsg[item.deviceId] || otherTypeMsg)" :key="tempDataIndex+'dbTempData'" class="data-row">
2026-01-15 17:51:09 +08:00
<uni-col :span="8">
2025-10-15 18:16:56 +08:00
<view class="title">{{tempDataItem.name}}</view>
2026-01-15 17:51:09 +08:00
</uni-col>
<uni-col :span="16">
<view class="value">{{item[tempDataItem.attr] | formatNumber}}
2026-01-23 21:46:21 +08:00
<text v-if="tempDataItem.unit" v-html="tempDataItem.unit"></text>
2026-01-15 17:51:09 +08:00
</view>
</uni-col>
</uni-row>
</uni-group>
</view>
2025-07-29 23:05:58 +08:00
</uni-collapse-item>
</uni-collapse>
2026-01-15 17:51:09 +08:00
<view class="no-data" v-else>
暂无数据
</view>
2025-07-29 23:05:58 +08:00
</view>
</template>
<script>
import {
getAmmeterDataList
} from '@/api/ems/site.js'
import {
mapState
} from 'vuex'
export default {
computed: {
...mapState({
communicationStatusOptions: (state) =>
state.ems.communicationStatusOptions,
})
},
data() {
return {
siteId: '',
2025-10-15 18:16:56 +08:00
list: [],
deviceIdTypeMsg: {
'LOAD': [{
name: '正向有功电能',
attr: 'forwardActive',
2026-01-23 21:46:21 +08:00
pointName: '正向有功电能',
unit: 'kWh'
2025-10-15 18:16:56 +08:00
},
{
name: '反向有功电能',
attr: 'reverseActive',
2026-01-23 21:46:21 +08:00
pointName: '反向有功电能',
unit: 'kWh'
2025-10-15 18:16:56 +08:00
},
{
name: '正向无功电能',
attr: 'forwardReactive',
2026-01-23 21:46:21 +08:00
pointName: '正向无功电能',
unit: 'kvarh'
2025-10-15 18:16:56 +08:00
},
{
name: '反向无功电能',
attr: 'reverseReactive',
2026-01-23 21:46:21 +08:00
pointName: '反向无功电能',
unit: 'kvarh'
2025-10-15 18:16:56 +08:00
},
{
name: '有功功率',
attr: 'activePower',
2026-01-23 21:46:21 +08:00
pointName: '总有功功率',
unit: 'kW'
2025-10-15 18:16:56 +08:00
},
{
name: '无功功率',
attr: 'reactivePower',
2026-01-23 21:46:21 +08:00
pointName: '总无功功率',
unit: 'kvar'
2025-10-15 18:16:56 +08:00
}
],
'METE': [{
name: '正向有功电能',
attr: 'forwardActive',
2026-01-23 21:46:21 +08:00
pointName: '正向有功电能',
unit: 'kWh'
2025-10-15 18:16:56 +08:00
},
{
name: '反向有功电能',
attr: 'reverseActive',
2026-01-23 21:46:21 +08:00
pointName: '反向有功电能',
unit: 'kWh'
2025-10-15 18:16:56 +08:00
},
{
name: '正向无功电能',
attr: 'forwardReactive',
2026-01-23 21:46:21 +08:00
pointName: '正向无功电能',
unit: 'kvarh'
2025-10-15 18:16:56 +08:00
},
{
name: '反向无功电能',
attr: 'reverseReactive',
2026-01-23 21:46:21 +08:00
pointName: '反向无功电能',
unit: 'kvarh'
2025-10-15 18:16:56 +08:00
},
{
name: '有功功率',
attr: 'activePower',
2026-01-23 21:46:21 +08:00
pointName: '总有功功率',
unit: 'kW'
2025-10-15 18:16:56 +08:00
},
{
name: '无功功率',
attr: 'reactivePower',
2026-01-23 21:46:21 +08:00
pointName: '总无功功率',
unit: 'kvar'
2025-10-15 18:16:56 +08:00
}
],
'METEGF': [{
name: '有功电能',
attr: 'activeEnergy',
2026-01-23 21:46:21 +08:00
pointName: '有功电能',
unit: 'kWh'
2025-10-15 18:16:56 +08:00
},
{
name: '无功电能',
attr: 'reactiveEnergy',
2026-01-23 21:46:21 +08:00
pointName: '无功电能',
unit: 'kvarh'
2025-10-15 18:16:56 +08:00
},
{
name: '有功功率',
attr: 'activePower',
2026-01-23 21:46:21 +08:00
pointName: '总有功功率',
unit: 'kW'
2025-10-15 18:16:56 +08:00
},
{
name: '无功功率',
attr: 'reactivePower',
2026-01-23 21:46:21 +08:00
pointName: '总无功功率',
unit: 'kvar'
2025-10-15 18:16:56 +08:00
}
]
2026-01-23 21:46:21 +08:00
},
otherTypeMsg: [{
name: '正向有功电能',
attr: 'forwardActive',
pointName: '正向有功电能',
unit: 'kWh'
},
{
name: '反向有功电能',
attr: 'reverseActive',
pointName: '反向有功电能',
unit: 'kWh'
},
{
name: '有功功率',
attr: 'activePower',
pointName: '总有功功率',
unit: 'kW'
},
]
2025-07-29 23:05:58 +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
getAmmeterDataList({
siteId: this.siteId
}).then(response => {
2025-10-15 18:16:56 +08:00
this.list = response?.data || []
2026-01-19 17:30:03 +08:00
if (this.list.length > 0) {
this.$nextTick(() => {
setTimeout(() => {
this.$refs.collapse.resize()
uni.hideLoading()
}, 1000)
})
} else {
uni.hideLoading()
}
2025-07-29 23:05:58 +08:00
}).catch(() => {
uni.hideLoading()
})
}
}
</script>
<style lang="scss" scoped>
2026-01-15 17:51:09 +08:00
.unknow-bd-device {
text-align: center;
padding: 20rpx;
font-size: 28rpx;
line-height: 50rpx;
2025-10-15 18:16:56 +08:00
background-color: #fff;
2026-01-15 17:51:09 +08:00
color: #000;
2025-07-29 23:05:58 +08:00
}
</style>