jsy-app/pages/fourmonitor/weatherstation.vue

313 lines
7.6 KiB
Vue

<template>
<view class="page">
<uni-row style="height: 30px;">
<uni-col :span="24" >
<u-button text="历史" type="info"
style="height: 30px;width: 60px;margin-bottom: 2px;margin-top: 2px;float: right;margin-right: 5px;" @click="openH(item)"></u-button>
</uni-col>
</uni-row>
<uni-row class="rowstyle">
<view class="rowview">
<uni-col :span="6">
<u-icon label="风力:" labelPos="right" label-color="white" size="30" labelSize="10"
name="../../static/images/qxzfj.png"></u-icon>
</uni-col>
<uni-col :span="6" >
<view class="valuecol">
{{itemProperty.wc===null?"--":itemProperty.wc}}
</view>
</uni-col>
<uni-col :span="6" >
<u-icon label="风速:" labelPos="right" label-color="white" size="30" labelSize="10"
name="../../static/images/header-fengsu.png"></u-icon>
</uni-col>
<uni-col :span="6" >
<view class="valuecol">
{{itemProperty.ws===null?"--":itemProperty.ws}}m/s
</view>
</uni-col>
</view>
</uni-row>
<uni-row class="rowstyle">
<view class="rowview">
<uni-col :span="6" >
<u-icon label="风向:" labelPos="right" label-color="white" size="30" labelSize="10"
name="../../static/images/header-fengxiang.png"></u-icon>
</uni-col>
<uni-col :span="6" >
<view class="valuecol">
{{itemProperty.wd===null?"--":itemProperty.wd}}
</view>
</uni-col>
<uni-col :span="6">
<u-icon label="大气压力:" labelPos="right" label-color="white" size="30" labelSize="10"
name="../../static/images/header-daqiyali.png"></u-icon>
</uni-col>
<uni-col :span="6" >
<view class="valuecol">
{{itemProperty.p===null?"--":itemProperty.p}}hpa
</view>
</uni-col>
</view>
</uni-row>
<uni-row class="rowstyle">
<view class="rowview">
<uni-col :span="6" >
<u-icon label="温度:" labelPos="right" label-color="white" size="30" labelSize="10"
name="../../static/images/header-wendu.png"></u-icon>
</uni-col>
<uni-col :span="6" >
<view class="valuecol">
{{itemProperty.t===null?"--":itemProperty.t}}
</view>
</uni-col>
<uni-col :span="6" >
<u-icon label="湿度:" labelPos="right" label-color="white" size="30" labelSize="10"
name="../../static/images/header-shidu.png"></u-icon>
</uni-col>
<uni-col :span="6" >
<view class="valuecol">
{{itemProperty.h===null?"--":itemProperty.h}}%
</view>
</uni-col>
</view>
</uni-row>
<uni-row class="rowstyle">
<view class="rowview" >
<uni-col :span="6">
<u-icon label="当前雨量:" labelPos="right" label-color="white" size="30" labelSize="10"
name="../../static/images/qxzylc.png"></u-icon>
</uni-col>
<uni-col :span="6" >
<view class="valuecol">
{{itemProperty.rt===null?"--":itemProperty.rt}}mm
</view>
</uni-col>
<uni-col :span="6">
<u-icon label="瞬时雨量:" labelPos="right" label-color="white" size="30" labelSize="10"
name="../../static/images/qxzdqyl.png"></u-icon>
</uni-col>
<uni-col :span="6" >
<view class="valuecol">
{{itemProperty.ri===null?"--":itemProperty.ri}}mm
</view>
</uni-col>
</view>
</uni-row>
<uni-row class="rowstyle">
<view class="rowview" >
<uni-col :span="6">
<u-icon label="累计雨量:" labelPos="right" label-color="white" size="30" labelSize="10"
name="../../static/images/qxzljjyl.png"></u-icon>
</uni-col>
<uni-col :span="6">
<view class="valuecol">
{{itemProperty.r===null?"--":itemProperty.r}}mm
</view>
</uni-col>
<uni-col :span="6">
<u-icon label="设备状态:" labelPos="right" label-color="white" size="30" labelSize="10"
name="../../static/images/sbzt.png"></u-icon>
</uni-col>
<uni-col :span="6" >
<view class="valuecol">
{{itemProperty.s =="online"?"在线":"离线" }}
</view>
</uni-col>
</view>
</uni-row>
<u-popup :show="showDeviceLog" mode="center">
<view class="dialog-container">
<view class="dialog-title">
<text>气象站历史记录</text>
<u-icon name="reload" size="20" class="reload-btn" @click="reload"></u-icon>
<u-icon name="close" size="20" class="close-btn" @click="closeLog"></u-icon>
</view>
<view class="dialog-body">
<weatherstation-logs :passParams="passParams"></weatherstation-logs>
</view>
</view>
</u-popup>
</view>
</template>
<script setup>
import {
ref
} from "vue"
import {
onLoad,
onUnload
} from '@dcloudio/uni-app'
import plugin from '@/plugins'
import store from '@/store'
const item = ref({})
const itemProperty = ref({})
const time3 = ref({});
const Intervalflag = ref(true);
const showDeviceLog = ref(false);
const passParams = ref({});
//页面跳转值
onLoad(info => {
if (info.item != null) {
item.value = JSON.parse(decodeURIComponent(info.item));
queryList();
time3.value = setInterval(() => {
if (Intervalflag.value) {
queryList();
} else {
clearInterval(time3.value);
}
}, 5000);
}
})
onUnload(info => {
Intervalflag.value = false;
clearInterval(time3);
})
function queryList() {
let par = {
"deviceCode": item.value.deviceCode,
"iotId": item.value.iotId,
"deviceTypeId": 6
};
store.dispatch('getWeatherStationDevicePropertyStatus', par)
.then(res => {
itemProperty.value = res.data
}).catch(error => {
plugin.modal.msgError(error);
}).finally(() => {})
}
//打开历史界面
function openH(item){
showDeviceLog.value = true
passParams.value = item
}
function reload(){
uni.$emit("reloadlogs")
}
function closeLog(){
showDeviceLog.value = false;
}
</script>
<style lang="scss">
.page{
background-color:cadetblue;
height: 1200px;
width: 100%;
}
.uni-page-head {
display: none
}
.demo-uni-col {
height: 32px;
border-radius: 2px;
}
.dark {
background-color: cadetblue;
}
.light {
background-color: cadetblue;
}
.rowstyle{
height: 60px;
left: 10px;
}
.rowview {
margin-top: 5px;
height: 100%;
width: 100%;
line-height: 60px;
}
.valuecol {
height: 80%;
margin-top: 2px;
margin-bottom: 2px;
text-align: left;
line-height: 28px;
font-size: 10px;
// border: 1px solid black;
width: 95%;
// background-color: white;
color: white;
}
// 弹窗
.dialog-container {
width: 90vw;
height: 90vh;
overflow: hidden;
.dialog-title {
width: 100%;
height: 34px;
font-size: 16px;
line-height: 34px;
text-align: center;
font-weight: bold;
border-bottom: 1px solid #999;
position: relative;
.reload-btn {
position: absolute;
top: 50%;
right: 56px;
transform: translateY(-50%);
}
.close-btn {
position: absolute;
top: 50%;
right: 10px;
transform: translateY(-50%);
}
}
.dialog-body {
height: calc(100% - 35px);
overflow: hidden;
position: relative;
background-color: #f7f7f7;
//扫码的弹窗
.scancode-device-info {
height: 100%;
padding: 0 20px;
overflow-x: hidden;
overflow-y: auto;
display: flex;
flex-direction: column;
justify-content: space-evenly;
& > view {
width: 100%;
line-height: 40px;
font-size: 18px;
color: gray;
.label {
display: inline-block;
width: 30%;
color: black;
margin-right: 2px;
white-space: nowrap;
}
}
}
}
.control-panel {
height: 100px;
display: flex;
align-items: center;
flex-wrap: nowrap;
justify-content: space-evenly;
& > view {
padding: 6px 10px;
color: #007acc;
font-size: 14px;
border: 1px solid #ccc;
border-radius: 4px;
}
}
}
</style>