548 lines
13 KiB
Vue
548 lines
13 KiB
Vue
<template>
|
||
<div class="qixiang">
|
||
<div class="block1">
|
||
<layout-title title="气象监测数据"/>
|
||
<div class="options">
|
||
<div class="bg"/>
|
||
<div v-for="(item,index) in block1OptionsList" :key="index" class="option">
|
||
<div class="label">{{ item.title }}:</div>
|
||
<div class="info">
|
||
<span class="count">{{ item.count }}</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="block2">
|
||
<layout-title title="监测设备状态"/>
|
||
<div class="options">
|
||
<div v-for="(item,index) in block2OptionsList" :key="index" class="option">
|
||
<div class="title">{{ item.title }}</div>
|
||
<div class="info">
|
||
<div class="img"><img :src="item.img" alt=""></div>
|
||
<div v-if="item.title == '监测站数'" class="count">
|
||
<div>在线数:<count-to :start-val="0" :end-val="+item.onlinecount" :duration="3600"/></div>
|
||
<div>离线数:<count-to :start-val="0" :end-val="+item.Offlinecount" :duration="3600"/></div>
|
||
</div>
|
||
<div v-else class="count">
|
||
<div>在线数:-</div>
|
||
<div>离线数:-</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="block3">
|
||
<layout-title title="设备监测详情"/>
|
||
<div class="content">
|
||
<div class="options">
|
||
<div
|
||
v-for="(item,index) in block3OptionsList"
|
||
:key="index"
|
||
:class="['title', {active:index === block3OptionsIndex}]"
|
||
@click="block3OptionsClick(index)"
|
||
>
|
||
{{ item }}
|
||
</div>
|
||
</div>
|
||
<div class="table">
|
||
<div class="tr">
|
||
<div class="td">气象设备类型</div>
|
||
<div class="td">气象设备名称</div>
|
||
<div class="td">状态</div>
|
||
</div>
|
||
<div class="scroll">
|
||
<div v-for="(item,index) in block3List" :key="index" class="tr">
|
||
<div class="td">{{ item.EQUIPMENTTYPE_NAME }}</div>
|
||
<div class="td">{{ item.NAME }}</div>
|
||
<div :class="['td',{green:item.isshow === '1',red:item.isshow === '2'}]">
|
||
{{ item.isshow === '2' ? '离线' : '在线' }}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import layoutTitle from './title.vue'
|
||
import CountTo from 'vue-count-to'
|
||
import { requestFN } from '@/utils/request'
|
||
|
||
export default {
|
||
components: {
|
||
CountTo,
|
||
layoutTitle
|
||
},
|
||
props: {
|
||
corpInfoId: {
|
||
type: String,
|
||
default: ''
|
||
},
|
||
area: {
|
||
type: String,
|
||
default: ''
|
||
},
|
||
gangkou: {
|
||
type: String,
|
||
default: ''
|
||
}
|
||
},
|
||
data() {
|
||
return {
|
||
block1OptionsList: [
|
||
{
|
||
title: '风速监测',
|
||
img: require('../../../assets/map/qixiang/ico1.png'),
|
||
count: '-'
|
||
},
|
||
{
|
||
title: '温度监测',
|
||
img: require('../../../assets/map/qixiang/ico2.png'),
|
||
count: '-'
|
||
},
|
||
{
|
||
title: '风向监测',
|
||
img: require('../../../assets/map/qixiang/ico3.png'),
|
||
count: '-'
|
||
},
|
||
{
|
||
title: '监测数据来源',
|
||
img: require('../../../assets/map/qixiang/ico4.png'),
|
||
count: '-'
|
||
}
|
||
],
|
||
loading: false,
|
||
block2OptionsList: [
|
||
{
|
||
title: '监测站数',
|
||
img: require('../../../assets/map/qixiang/img2ico1.png'),
|
||
onlinecount: '0',
|
||
Offlinecount: '0'
|
||
|
||
},
|
||
{
|
||
title: '报警数',
|
||
img: require('../../../assets/map/qixiang/img2ico2.png'),
|
||
onlinecount: 0,
|
||
Offlinecount: 0
|
||
}
|
||
|
||
],
|
||
block3OptionsList: ['传感器数据列表', '报警信息列表'],
|
||
block3OptionsIndex: 0,
|
||
block3List: []
|
||
}
|
||
},
|
||
mounted() {
|
||
this.getMeteorologicalinfo()
|
||
this.getMeteorologicaltype(0)
|
||
this.getMeteorologicalcount()
|
||
this.start()
|
||
},
|
||
beforeDestroy() {
|
||
console.log('定时器关闭')
|
||
clearInterval(this.timer)
|
||
},
|
||
methods: {
|
||
// 定时器
|
||
start() {
|
||
console.log('定时器开启')
|
||
this.timer = setInterval(this.getMeteorologicalinfo, 90000) // 注意: 第一个参数为方法名的时候不要加括号;
|
||
},
|
||
over() {
|
||
clearInterval(this.timer)
|
||
},
|
||
block3OptionsClick(index) {
|
||
this.block3OptionsIndex = index
|
||
this.block3List = []
|
||
this.currentPage = 1
|
||
this.getMeteorologicaltype(index)
|
||
},
|
||
getMeteorologicalcount() {
|
||
this.listLoading = true
|
||
console.log(this.area)
|
||
requestFN(
|
||
'/map/listbyequipmentcount',
|
||
{
|
||
CORPINFO_ID: this.corpInfoId,
|
||
AREA: this.area,
|
||
GANGKOU: this.gangkou
|
||
}
|
||
).then((data) => {
|
||
this.listLoading = false
|
||
this.block2OptionsList[0].onlinecount = data.pd.onlinecount || '0'
|
||
this.block2OptionsList[0].Offlinecount = data.pd.offlinecount || '0'
|
||
}).catch((e) => {
|
||
this.listLoading = false
|
||
})
|
||
},
|
||
getMeteorologicaltype(index) {
|
||
this.listLoading = true
|
||
requestFN(
|
||
'/map/listbyType',
|
||
{
|
||
CORPINFO_ID: this.corpInfoId,
|
||
TYPE: this.TYPE,
|
||
AREA: this.area,
|
||
GANGKOU: this.gangkou,
|
||
INDEX: index
|
||
}
|
||
).then((data) => {
|
||
// this.listLoading = false
|
||
// this.varList = data.varList
|
||
this.block3List = data.varList
|
||
}).catch((e) => {
|
||
this.listLoading = false
|
||
})
|
||
},
|
||
getMeteorologicalinfo() {
|
||
this.listLoading = true
|
||
requestFN(
|
||
'/map/listbymeteorological',
|
||
{
|
||
CORPINFO_ID: this.corpInfoId || '035958e685cf4850bc40151c5e0617a6'
|
||
}
|
||
).then((data) => {
|
||
this.listLoading = false
|
||
this.block1OptionsList[0].count = data.pd.WINDSPEED || '-'
|
||
this.block1OptionsList[1].count = data.pd.TEMPERATURE || '-'
|
||
this.block1OptionsList[2].count = this.calculateWindDirection(data.pd.WINDDIRECTION) || '-'
|
||
this.block1OptionsList[3].count = data.pd.EQUIPMENTNAME || '-'
|
||
}).catch((e) => {
|
||
this.listLoading = false
|
||
})
|
||
},
|
||
calculateWindDirection(angle) {
|
||
const arr = [
|
||
{
|
||
directions: '北',
|
||
minAngle: '348.76',
|
||
maxAngle: '11.25'
|
||
},
|
||
{
|
||
directions: '北东北',
|
||
minAngle: '11.26',
|
||
maxAngle: '33.75'
|
||
},
|
||
{
|
||
directions: '东北',
|
||
minAngle: '33.76',
|
||
maxAngle: '56.25'
|
||
},
|
||
{
|
||
directions: '东东北',
|
||
minAngle: '56.26',
|
||
maxAngle: '78.75'
|
||
},
|
||
{
|
||
directions: '东',
|
||
minAngle: '78.76',
|
||
maxAngle: '101.25'
|
||
},
|
||
{
|
||
directions: '东东南',
|
||
minAngle: '101.26',
|
||
maxAngle: '123.75'
|
||
},
|
||
{
|
||
directions: '东南',
|
||
minAngle: '123.76',
|
||
maxAngle: '146.25'
|
||
},
|
||
{
|
||
directions: '南东南',
|
||
minAngle: '146.26',
|
||
maxAngle: '168.75'
|
||
},
|
||
{
|
||
directions: '南',
|
||
minAngle: '168.76',
|
||
maxAngle: '191.25'
|
||
},
|
||
{
|
||
directions: '南西南',
|
||
minAngle: '191.26',
|
||
maxAngle: '213.75'
|
||
},
|
||
{
|
||
directions: '西南',
|
||
minAngle: '213.76',
|
||
maxAngle: '236.25'
|
||
},
|
||
{
|
||
directions: '西西南',
|
||
minAngle: '236.26',
|
||
maxAngle: '258.75'
|
||
},
|
||
{
|
||
directions: '西',
|
||
minAngle: '258.76',
|
||
maxAngle: '281.25'
|
||
},
|
||
{
|
||
directions: '西西北',
|
||
minAngle: '281.26',
|
||
maxAngle: '303.75'
|
||
},
|
||
{
|
||
directions: '西北',
|
||
minAngle: '303.76',
|
||
maxAngle: '326.25'
|
||
},
|
||
{
|
||
directions: '北西北',
|
||
minAngle: '326.26',
|
||
maxAngle: '348.75'
|
||
}
|
||
]
|
||
for (let i = 0; i < arr.length; i++) {
|
||
if (+angle >= +arr[i].minAngle && +angle <= +arr[i].maxAngle) {
|
||
return arr[i].directions + '风'
|
||
}
|
||
}
|
||
return '静风'
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.qixiang {
|
||
.title {
|
||
background-image: url("../../../assets/map/menjin/title_on.png");
|
||
background-size: 100% 100%;
|
||
background-repeat: no-repeat;
|
||
width: 113px;
|
||
height: 26px;
|
||
font-size: 14px;
|
||
line-height: 26px;
|
||
text-align: center;
|
||
color: #fff;
|
||
|
||
&.active {
|
||
background-image: url("../../../assets/map/menjin/title.png");
|
||
}
|
||
}
|
||
|
||
.block1 {
|
||
width: 410px;
|
||
background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8));
|
||
margin-top: 20px;
|
||
|
||
.options {
|
||
padding: 10px 15px;
|
||
border: 1px solid;
|
||
border-image: linear-gradient(to bottom, rgba(58, 122, 149, 0), rgba(58, 122, 149, 1)) 1;
|
||
border-top: none;
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
position: relative;
|
||
height: 189px;
|
||
|
||
.bg {
|
||
background-image: url("../../../assets/map/qixiang/img1.png");
|
||
background-size: 100% 100%;
|
||
background-repeat: no-repeat;
|
||
width: 217px;
|
||
height: 159px;
|
||
position: absolute;
|
||
left: 50%;
|
||
top: 50%;
|
||
transform: translate(-50%, -50%);
|
||
}
|
||
|
||
.option {
|
||
flex-basis: 35%;
|
||
text-align: center;
|
||
|
||
.label {
|
||
font-size: 14px;
|
||
color: #fff;
|
||
}
|
||
|
||
.info {
|
||
.count {
|
||
font-size: 24px;
|
||
background: linear-gradient(to top, #48bbf0, #ffffff);
|
||
-webkit-background-clip: text;
|
||
-webkit-text-fill-color: transparent;
|
||
font-weight: bold;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
.block2 {
|
||
width: 410px;
|
||
background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8));
|
||
margin-top: 10px;
|
||
|
||
.options {
|
||
padding: 10px 15px;
|
||
border: 1px solid;
|
||
border-image: linear-gradient(to bottom, rgba(58, 122, 149, 0), rgba(58, 122, 149, 1)) 1;
|
||
border-top: none;
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
align-items: center;
|
||
|
||
.option {
|
||
display: flex;
|
||
width: 50%;
|
||
align-items: center;
|
||
padding-left: 20px;
|
||
|
||
.title {
|
||
width: 24px;
|
||
height: 111px;
|
||
background-image: url("../../../assets/map/qixiang/titbg.png");
|
||
background-size: 100% 100%;
|
||
background-repeat: no-repeat;
|
||
text-align: center;
|
||
font-size: 14px;
|
||
color: #FFFFFF;
|
||
font-weight: normal;
|
||
display: flex;
|
||
align-items: center;
|
||
|
||
}
|
||
|
||
.info {
|
||
color: #FFFFFF;
|
||
padding-left: 20px;
|
||
|
||
.img {
|
||
width: 50px;
|
||
height:50px;
|
||
background-image: url("../../../assets/map/qixiang/img2bg.png");
|
||
background-size: 100% 100%;
|
||
background-repeat: no-repeat;
|
||
text-align: center;
|
||
padding-top: 15px;
|
||
margin: 0 auto;
|
||
|
||
img {
|
||
width: 22px;
|
||
height: 22px;
|
||
animation: scale 2s infinite;
|
||
}
|
||
}
|
||
|
||
.count {
|
||
font-size: 12px;
|
||
line-height: 1.6;
|
||
margin-top: 5px;
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|
||
}
|
||
|
||
.block3 {
|
||
margin-top: 10px;
|
||
width: 410px;
|
||
background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8));
|
||
|
||
.content {
|
||
border: 1px solid;
|
||
border-image: linear-gradient(to bottom, rgba(58, 122, 149, 0), rgba(58, 122, 149, 1)) 1;
|
||
border-top: none;
|
||
padding: 10px;
|
||
|
||
.options {
|
||
display: flex;
|
||
justify-content: flex-end;
|
||
|
||
.title {
|
||
cursor: pointer;
|
||
}
|
||
}
|
||
|
||
.table {
|
||
margin-top: 5px;
|
||
.scroll {
|
||
max-height: 300px;
|
||
overflow-y: auto;
|
||
|
||
&::-webkit-scrollbar {
|
||
width: 5px;
|
||
}
|
||
|
||
&::-webkit-scrollbar-thumb {
|
||
border-radius: 5px;
|
||
background: rgba(2, 30, 81, 0.851);
|
||
}
|
||
|
||
&::-webkit-scrollbar-track {
|
||
border-radius: 5px;
|
||
background: rgba(255, 255, 255, 0.1);
|
||
}
|
||
|
||
.tr {
|
||
&:nth-child(odd) {
|
||
background-color: transparent;
|
||
}
|
||
}
|
||
}
|
||
.tr {
|
||
display: flex;
|
||
background-color: rgba(42, 86, 158, 0.53);
|
||
|
||
&:nth-child(odd) {
|
||
background-color: rgba(42, 86, 158, 0.53);
|
||
}
|
||
|
||
.td {
|
||
flex: 1;
|
||
text-align: center;
|
||
font-size: 12px;
|
||
color: #fff;
|
||
padding: 5px;
|
||
|
||
&.green {
|
||
color: #7ccf41;
|
||
}
|
||
|
||
&.red {
|
||
color: #f90102;
|
||
}
|
||
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
@keyframes slideY {
|
||
0% {
|
||
transform: translateY(0);
|
||
}
|
||
50% {
|
||
transform: translateY(5px);
|
||
}
|
||
100% {
|
||
transform: translateY(0);
|
||
}
|
||
}
|
||
|
||
@keyframes scale {
|
||
0% {
|
||
transform: scale(1);
|
||
}
|
||
50% {
|
||
transform: scale(0.8);
|
||
}
|
||
100% {
|
||
transform: scale(1);
|
||
}
|
||
}
|
||
</style>
|