Files
dvcp_v2_wechat_app/src/mods/AppVideoSurve/AppVideoSurve.vue

221 lines
5.1 KiB
Vue
Raw Normal View History

2022-02-15 11:18:26 +08:00
<template>
2022-02-17 15:57:33 +08:00
<section class="videoSurveillance">
<div class="area-content">
<AiAreaPicker class="ai-area" :value="areaId" :areaId="areaId" :name.sync="areaName" @select="areaSelect">
2022-02-15 11:18:26 +08:00
<div class="ai-area__wrapper">
<span class="label" v-if="areaName">{{ areaName }}</span>
<span v-else>请选择</span>
2022-02-17 15:57:33 +08:00
<u-icon name="arrow-down" color="#666" size="24"></u-icon>
2022-02-15 11:18:26 +08:00
</div>
2022-02-15 15:38:20 +08:00
</AiAreaPicker>
2022-02-17 15:57:33 +08:00
</div>
2022-02-15 11:18:26 +08:00
2022-02-17 15:57:33 +08:00
<div class="num-content">
<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>
2022-02-15 11:18:26 +08:00
</div>
</div>
2022-02-17 15:57:33 +08:00
<div class="list-content">
<div class="item" v-for="(item, index) in list" :key="index" @click="showMonitor(item)">
<img class="img" :src="item.indexUrl" alt="" v-if="item.deviceStatus == 1" />
<img class="img" src="../../static/AppVideoSurve/offline.png" alt="" v-else />
<p>{{ item.name }}</p>
<img class="icon" src="../../static/AppVideoSurve/play-icon.png" alt="" v-if="item.deviceStatus == 1" />
<img class="icon" src="../../static/AppVideoSurve/not-play-icon.png" alt="" v-else />
2022-02-15 11:18:26 +08:00
</div>
2022-02-17 15:57:33 +08:00
<AiEmpty v-if="!list.length" />
2022-02-15 11:18:26 +08:00
</div>
2022-02-17 15:57:33 +08:00
</section>
2022-02-15 11:18:26 +08:00
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'AppVideoSurve',
appName: '视频监控',
data() {
return {
2022-02-17 15:57:33 +08:00
nodes: [{ nodeName: '首页' }],
monitors: [],
2022-02-15 11:18:26 +08:00
areaId: '',
areaName: '',
2022-02-17 15:57:33 +08:00
list: [],
count: {},
Echart: null,
onlineRate: '',
offlineRate: '',
2022-02-15 11:18:26 +08:00
}
},
2022-02-17 15:57:33 +08:00
computed: { ...mapState(['user']) },
onLoad() {},
onShow() {
2022-02-15 11:18:26 +08:00
this.areaId = this.$areaId
this.areaName = this.$areaName
2022-02-17 15:57:33 +08:00
this.getList()
2022-02-15 11:18:26 +08:00
},
methods: {
2022-02-17 15:57:33 +08:00
getMonitors(nodeId, queryType = 0) {
this.monitors = []
this.$instance
.post('/app/appzyvideoequipment/getTree', {
nodeId,
queryType,
})
.then((res) => {
if (res?.data) {
this.monitors = JSON.parse(res.data)?.[queryType == 0 ? 'node' : 'device'] || []
}
})
},
getMore(row) {
this.nodes.push(row)
this.getMonitors(row.nodeId, row.hasChild == 1 ? 0 : 1)
},
isCurrent(index) {
return index == Math.max(this.nodes?.length - 1, 0)
},
gotoNode(node, index) {
this.nodes.splice(index + 1)
this.getMonitors(node.nodeId)
},
getList() {
this.$instance.post(`/app/appzyvideoequipment/getAreaEquipment?areaId=${this.areaId}`).then((res) => {
if (res?.data) {
this.list = res.data.list
this.count = res.data.count
this.onlineRate = (this.count.online / this.count.sum).toFixed(2)
this.offlineRate = (1 - this.onlineRate).toFixed(2)
}
})
},
2022-02-15 11:18:26 +08:00
areaSelect(e) {
2022-02-17 15:57:33 +08:00
this.areaId = e
this.getList()
},
showMonitor(row) {
if (row.deviceStatus != 1) return
uni.navigateTo({ url: `./monitorDetail?id=${row.id}` })
2022-02-15 11:18:26 +08:00
},
},
}
</script>
2022-02-17 15:57:33 +08:00
<style lang="scss" scoped>
.videoSurveillance {
background: #fff;
padding: 0 32px;
.area-content {
2022-02-15 11:18:26 +08:00
.ai-area {
.ai-area__wrapper {
padding: 28px 0;
.label {
font-size: 40px;
font-weight: 600;
}
2022-02-17 15:57:33 +08:00
.u-icon {
margin-left: 6px;
}
2022-02-15 11:18:26 +08:00
}
}
2022-02-17 15:57:33 +08:00
}
2022-02-15 11:18:26 +08:00
2022-02-17 15:57:33 +08:00
.num-content {
// width: calc(100% - 40px);
height: 164px;
background: #eee;
border-radius: 16px;
margin: 32px 0 0 0;
display: flex;
.item {
flex: 1;
text-align: center;
position: relative;
.monitor-icon {
width: 48px;
height: 48px;
position: absolute;
top: 50%;
left: 50%;
margin-left: -24px;
margin-top: -24px;
2022-02-15 11:18:26 +08:00
}
2022-02-17 15:57:33 +08:00
h3 {
font-size: 44px;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #333;
line-height: 60px;
margin-top: 32px;
2022-02-15 11:18:26 +08:00
}
2022-02-17 15:57:33 +08:00
p {
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
color: #666;
line-height: 40px;
2022-02-15 11:18:26 +08:00
}
}
}
2022-02-17 15:57:33 +08:00
.list-content {
width: 100%;
padding: 38px 0 0 0;
box-sizing: border-box;
overflow: hidden;
2022-02-15 11:18:26 +08:00
2022-02-17 15:57:33 +08:00
.item {
display: inline-block;
width: calc(50% - 36px);
// margin-right: 36px;
border-radius: 16px;
position: relative;
margin-bottom: 32px;
vertical-align: top;
.img {
width: 100%;
height: 218px;
margin-bottom: 8px;
border-radius: 16px;
2022-02-15 11:18:26 +08:00
}
2022-02-17 15:57:33 +08:00
p {
width: 100%;
font-size: 34px;
font-family: PingFangSC-Regular, PingFang SC;
color: #333;
line-height: 48px;
word-break: break-all;
2022-02-15 11:18:26 +08:00
}
2022-02-17 15:57:33 +08:00
.icon {
width: 40px;
height: 48px;
position: absolute;
top: 84px;
left: 158px;
2022-02-15 11:18:26 +08:00
}
}
2022-02-17 15:57:33 +08:00
.item:nth-child(2n + 0) {
margin-left: 36px;
}
2022-02-15 11:18:26 +08:00
}
}
</style>