视频监控

This commit is contained in:
liuye
2021-12-22 18:15:08 +08:00
parent 2494123b6d
commit af67ad1055
2 changed files with 109 additions and 20 deletions

View File

@@ -15,11 +15,27 @@
<u-icon name="arrow-down" color="#666" size="24" /> <u-icon name="arrow-down" color="#666" size="24" />
</AiAreaPicker> </AiAreaPicker>
</div> </div>
<div class="num-content">
<img src="./img/on-icon.png" alt="">在线 {{count.online || 0}}
<img src="./img/off-icon.png" alt="" class="mar-l40">离线 {{count.sum - count.online || 0}}
</div>
</AiTopFixed> </AiTopFixed>
<div class="num-content">
<!-- <img src="./img/on-icon.png" alt="">在线 {{count.online || 0}}
<img src="./img/off-icon.png" alt="" class="mar-l40">离线 {{count.sum - count.online || 0}} -->
<div class="item">
<div id="echarts" style="width:100%;height:100%;"></div>
<img src="./img/monitor-icon.png" alt="" class="monitor-icon">
</div>
<div class="item">
<h3>{{count.online || 0}}</h3>
<p>在线</p>
</div>
<div class="item">
<h3>{{count.sum - count.online || 0}}</h3>
<p>离线</p>
</div>
<div class="item">
<h3>{{onlineRate*100 || 0}}%</h3>
<p>在线率</p>
</div>
</div>
<!-- <div class="list"> <!-- <div class="list">
<div class="item" v-for="row in monitors" :key="row.nodeId" :class="{online:!row.online}"> <div class="item" v-for="row in monitors" :key="row.nodeId" :class="{online:!row.online}">
<template v-if="!!row.deviceId"> <template v-if="!!row.deviceId">
@@ -46,6 +62,7 @@
</section> </section>
</template> </template>
<script> <script>
import echarts from 'echarts'
import { mapState } from 'vuex' import { mapState } from 'vuex'
export default { export default {
name: "AppVideoSurveillance", name: "AppVideoSurveillance",
@@ -60,7 +77,10 @@ export default {
areaId: '', areaId: '',
areaName: '', areaName: '',
list: [], list: [],
count: {} count: {},
Echart: null,
onlineRate: '',
offlineRate: ''
} }
}, },
computed: { ...mapState(['user']) }, computed: { ...mapState(['user']) },
@@ -93,6 +113,9 @@ export default {
if (res.code == 0) { if (res.code == 0) {
this.list = res.data.list this.list = res.data.list
this.count = res.data.count this.count = res.data.count
this.onlineRate = (this.count.online / this.count.sum).toFixed(2)
this.offlineRate = (1-this.onlineRate).toFixed(2)
this.initEchart()
} }
}) })
}, },
@@ -105,12 +128,59 @@ export default {
if(row.deviceStatus != 1) return if(row.deviceStatus != 1) return
uni.navigateTo({url: `./monitorDetail?id=${row.id}`}) uni.navigateTo({url: `./monitorDetail?id=${row.id}`})
}, },
initEchart() {
var option = {
series: [
{
type: 'pie',
radius: ['50%', '60%'],
avoidLabelOverlap: false,
label: {
show: false,
position: 'center'
},
emphasis: {
label: {
show: false,
}
},
labelLine: {
show: false
},
data: [
{ value: this.onlineRate},
{ value: this.offlineRate},
],
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
},
normal:{
color:function(params) {
//自定义颜色
var colorList = ['#3192F4','#ccc',];
return colorList[params.dataIndex]
}
}
}
}
]
};
option && this.Echart.setOption(option)
},
}, },
created() { created() {
this.areaId = this.user.areaId this.areaId = this.user.areaId
this.areaName = this.user.areaName this.areaName = this.user.areaName
this.getList() this.getList()
// this.getMonitors() // this.getMonitors()
},
mounted() {
this.Echart = echarts.init(document.getElementById('echarts'))
} }
} }
</script> </script>
@@ -188,7 +258,7 @@ export default {
.area-content{ .area-content{
display: inline-block; display: inline-block;
width: 45%; width: 100%;
line-height: 64px; line-height: 64px;
img{ img{
width: 42px; width: 42px;
@@ -200,20 +270,39 @@ export default {
} }
} }
.num-content{ .num-content{
display: inline-block; width: calc(100% - 40px);
width: 55%; height: 164px;
font-size: 34px; background: #EEE;
font-family: PingFangSC-Regular, PingFang SC; border-radius: 16px;
color: #333; margin: 32px 0 0 20px;
line-height: 48px; display: flex;
text-align: right; .item{
img{ flex: 1;
width: 48px; text-align: center;
margin-right: 16px; position: relative;
vertical-align: bottom; .monitor-icon{
} width: 48px;
.mar-l40{ height: 48px;
margin-left: 20px; position: absolute;
top: 50%;
left: 50%;
margin-left: -24px;
margin-top: -24px;
}
h3{
font-size: 44px;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #333;
line-height: 60px;
margin-top: 32px;
}
p{
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
color: #666;
line-height: 40px;
}
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB