Files
energy_storage/web/src/views/monitor.vue

253 lines
5.8 KiB
Vue
Raw Normal View History

<template>
<div class="monitor">
<div class="search">
<div class="left">
<div class="search-item">
<span>场站切换</span>
<a-select v-model:value="selectStationId" style="width: 220px" @change="getStationChange">
<a-select-option v-for="station in stations" :value="station['station_id']"
>{{ station.name }}
</a-select-option>
</a-select>
</div>
</div>
<div class="right">
<div class="search-item">
<span>运行模式</span>
<a-select v-model:value="workMode" style="width: 220px">
<a-select-option :value="item.value" v-for="item in workModes">{{ item.label }}</a-select-option>
</a-select>
</div>
<div class="search-item">
<a-button type="primary">下发</a-button>
</div>
</div>
</div>
<div class="content">
<div class="stations">
<div
class="station-item"
v-for="system in systems"
:key="system.name"
@click="chooseStation(system)"
:class="systemType == system.systemType ? 'active' : ''"
>
<span class="name">{{ system.name }}</span>
<span class="des">边缘网关{{ system.power }} W</span>
<span class="des">总有功功率(台区){{ system.num }}</span>
</div>
</div>
<div class="container">
<videos v-if="systemType == 4" :station-id="selectStationId"/>
<device v-else :station-id="selectStationId" :system-type="systemType"/>
</div>
</div>
</div>
</template>
<script>
import device from '@/components/monitor/device.vue'
import videos from '@/components/monitor/videos.vue'
import { postReq, getReq } from '@/request/api'
export default {
name: 'MonitorView',
components: {
device,
videos
},
data() {
return {
// currentKey: '储能系统',
systemType: 1,
value: [],
stations: [],
selectStationId:'',
systems: [
{
name: '储能系统',
power: 60,
num: 62,
systemType: 1
},
{
name: '充电系统',
power: 60,
num: 62,
systemType: 2
},
{
name: '光伏系统',
power: 60,
num: 62,
systemType: 3
},
{
name: '安防系统',
power: 60,
num: 62,
systemType: 4
}
// {
// name: "储能系统4",
// }
],
workMode:'',
workModes:[
// 0手动1峰谷套利2增网配容3应急供电4并网保电5自定时段
{
value:0,
label:'手动'
},
{
value:1,
label:'峰谷套利'
},
{
value:2,
label:'增网配容'
},
{
value:3,
label:'应急供电'
},
{
value:4,
label:'并网保电'
},
{
value:5,
label:'自定时段'
}
],
deviceGroup:[]
}
},
mounted() {
this.getStations()
},
methods: {
//场站切换
getStationChange(val){
console.log(val);
this.getStationAttr()
},
//查询场站列表
async getStations() {
try {
const res = await getReq('/queryStationList', { page: 0, 'page_size': 10000 })
this.stations = res.data
this.selectStationId=this.stations[0]['station_id']
this.getStationAttr()
} catch (error) {
this.stations = []
this.selectStationId=''
this.$message.error(error.message)
}
},
// 查询场站的参数
async getStationAttr(){
try {
const res = await getReq('/queryStationOverview', { station_id: this.selectStationId })
res.data.device_group.forEach((Element,index) => {
this.systems[index].num=Element.count
this.systems[index].power=Element.power
});
this.workMode=res.data.work_mode
} catch (error) {
this.deviceGroup = []
this.workMode=''
// this.$message.error(error.errmsg)
}
},
chooseStation(system) {
this.systemType = system.systemType
}
}
}
</script>
<style scoped lang="scss">
@import url(@/style/color.scss);
.monitor {
width: 100%;
height: 100%;
padding: 20px;
background: $bg1-color;
border-radius: 15px;
.search {
display: flex;
justify-content: space-between;
.search-item {
span {
margin-right: 20px;
}
color: #fff;
margin-left: 30px;
&:first-child {
margin-left: 0;
}
}
.left,
.right {
display: flex;
}
}
.content {
width: 100%;
height: calc(100% - 32px - 20px);
margin-top: 20px;
display: flex;
justify-content: space-between;
.stations {
min-width: 155px;
max-width: 235px;
width: 13%;
height: 100%;
border-radius: 12px;
background: $bg2-color;
padding: 15px 0;
overflow-y: auto;
.station-item {
width: calc(100% - 30px);
margin: 0 15px 15px 15px;
border-radius: 12px;
min-width: 150px;
display: flex;
flex-direction: column;
color: #fff;
padding: 10px 15px;
cursor: pointer;
.name {
font-size: 20px;
font-weight: 700;
line-height: 50px;
}
.des {
font-size: 14px;
font-weight: 600;
line-height: 40px;
}
}
.active {
background: $bg3-color;
}
}
.container {
width: 100%;
display: flex;
justify-content: space-between;
}
}
}
</style>