Merge branch 'pc-master' of https://git.lihe-control.com/xiaomeng/wszhyWx into pc-master

pull/40/head
孙萌 2023-11-17 11:50:53 +08:00
commit adba9271e6
3 changed files with 965 additions and 40 deletions

View File

@ -196,5 +196,9 @@ export default {
// 控制器状态值获取 Copy
readControl_getState(deviceId, data) {
return sendGetRequest(`/readControl/getState?deviceId=${deviceId}`, data);
},
getcontrol_rtDatastation(equipmentId,data){
return sendGetRequest(`/getcontrol/rtDatastation?equipmentId=${equipmentId}`, data)
}
};
};

View File

@ -9,13 +9,13 @@
<div class="yuan">
<img src="../../assets/img/big.png" alt="">
</div>
<div class="calendar">
<div class="calendar" v-if="time">
<img src="../../assets/img/calendar.png" alt="">
<span>2023.10.30</span>
<span>{{ getNowTime() }}</span>
<span class="line"></span>
<span>星期一</span>
<span>{{ time.week }}</span>
<span class="line"></span>
<span>14:17</span>
<span>{{ time.time }}</span>
</div>
<div class="nav">
<div class="item">
@ -42,8 +42,12 @@
<div class="weather">
<div>
<marquee behavior="" direction="">
今日天气晴转多云温度16~28东北风三级湿度
<marquee behavior="" direction="" scrollamount="3">
<div class="item" v-for="(item, index) in weatherDataList" :key="index">
<img :src="require(`../../assets/image/real-time-${item.formula}.png`)" alt="">
<span>{{ item.environmentDataId }} : </span>
<span>{{ item.environmentData + getTypeList(item.formula) }}</span>
</div>
</marquee>
</div>
</div>
@ -134,8 +138,8 @@
<div :class="current == index
? 'swiper-slide swiper-slide2'
: 'swiper-slide swiper-slide1'
" v-for="(item, index) in dataList" :key="index" :style="styleItem" @click="getCurrent(index)">
{{ item }}
" v-for="(item, index) in dataList" :key="index" :style="styleItem" @click="getCurrent(index,item)">
{{ item.greenhouseName + '温室' }}
</div>
</div>
</div>
@ -150,41 +154,66 @@
</div>
<div class="device_content scroll">
<div class="content_item" v-for="(content_item, index) in 6" :key="index">
<div class="i_title">
<div class="content_item">
<div class="i_title" v-if="fanStatus.open != 0">
<img src="../../assets/img/i_title_img.png" alt="">
<span>卷膜天窗</span>
<span>风机</span>
<span class="line"></span>
<span>打开</span>
<span>{{ fanStatus.open == 1 ? '自动控制' : '手机控制' }}</span>
<span class="line"></span>
<span>位置50%</span>
<span @click="i_contentHandler(index)"></span>
<span>菜单</span>
</div>
<div class="i_content" v-if="menu_current == true && content_item_current == index">
<div class="i_title" v-else>
<img src="../../assets/img/i_title_img.png" alt="">
<span>风机</span>
<span class="line"></span>
<span>无效</span>
<span class="line"></span>
<span>菜单</span>
</div>
<div class="i_content">
<div class="i_content_item">
<span>1#风机</span>
<span>开启</span>
<span :style="fanStatus.status[0] == 1 ? '':'color:#86C2FF;'">{{ fanStatus.status[0] == 1 ? '打开' : '关闭' }}</span>
<span class="line"></span>
<span>2#风机</span>
<span>开启</span>
<span :style="fanStatus.status[1] == 1 ? '':'color:#86C2FF;'">{{ fanStatus.status[1] == 1 ? '打开' : '关闭' }}</span>
</div>
<div class="line1"></div>
<div class="i_content_item">
<span>3#风机</span>
<span>开启</span>
<span :style="fanStatus.status[2] == 1 ? '':'color:#86C2FF;'">{{ fanStatus.status[2] == 1 ? '打开' : '关闭' }}</span>
<span class="line"></span>
<span>4#风机</span>
<span>开启</span>
<span :style="fanStatus.status[3] == 1 ? '':'color:#86C2FF;'">{{ fanStatus.status[3] == 1 ? '打开' : '关闭' }}</span>
</div>
<div class="line1"></div>
<div class="i_content_item">
<div class="i_content_item" style="width:50%">
<span>5#风机</span>
<span>开启</span>
<span :style="fanStatus.status[4] == 1 ? '':'color:#86C2FF;'">{{ fanStatus.status[4] == 1 ? '打开' : '关闭' }}</span>
<span class="line"></span>
<span>6#风机</span>
<span>开启</span>
</div>
</div>
<div class="i_title_" style="margin-top: 0.2rem;" v-for="(item, index) in statusList" :key="index">
<template v-if="item.open != 0">
<img src="../../assets/img/i_title_img.png" alt="">
<span>{{ item.name }}</span>
<span class="line"></span>
<span>{{ item.open == 1 ? '自动控制' : '手机控制' }}</span>
<span class="line"></span>
<span>位置{{ item.progress }}%</span>
<span>菜单</span>
</template>
<template v-else>
<img src="../../assets/img/i_title_img.png" alt="">
<span>{{ item.name }}</span>
<span class="line"></span>
<span>无效</span>
<span class="line"></span>
<span>位置{{ item.progress }}%</span>
<span>菜单</span>
</template>
</div>
</div>
</div>
</div>
@ -194,6 +223,7 @@
</template>
<script>
import { getnowtime } from '../../assets/js/nowTime'
import Swiper from '@/assets/js/swiper.min.js'
import '@/assets/js/swiper.min.css'
import { weather_echart, thisWeekTemperature_echart } from '@/assets/js/echarts'
@ -226,9 +256,11 @@ export default {
menu_current: false,
content_item_current: -1,
current: 0,
current: 5,
dataList: ["一号温室", "二号温室", "三号温室", "四号温室", "五号温室", "六号温室",],
dataList: [
// "", "", "", "", "", ""
],
styleContainer: {
width: "3.5rem",
height: "0.5rem",
@ -262,7 +294,371 @@ export default {
// Copy
getVideoDataList: [],
url: ''
url: '',
fanStatus: {
name: '风机', open: 0, status: []
},
statusList: [],
time: '',//
weatherDataList: [],
typeList: [{
label: '无意义的传感器',
value: 0,
countType: 0
},
{
label: '空气温度',
value: 1,
countType: 3,
unit: '℃'
},
{
label: '空气湿度',
value: 2,
countType: 2,
unit: '%'
},
{
label: '光亮度',
value: 3,
countType: 2,
unit: 'Klux'
},
{
label: '二氧化碳',
value: 4,
countType: 0,
unit: 'ppm'
},
{
label: '土壤温度',
value: 5,
countType: 3,
unit: '℃'
},
{
label: '土壤湿度',
value: 6,
countType: 2,
unit: '%'
},
{
label: '水温',
value: 7,
countType: 3,
unit: '℃'
},
{
label: '水肥PH',
value: 8,
countType: 2,
unit: ''
},
{
label: '水肥EC',
value: 9,
countType: 2,
unit: 'mS/cm'
},
{
label: '压差',
value: 10,
countType: 0,
unit: 'Pa'
},
{
label: '风速',
value: 11,
countType: 2,
unit: 'm/s'
},
{
label: '风向',
value: 12,
countType: 0,
unit: '°'
},
{
label: '雨雪信号',
value: 13,
countType: 0,
unit: ''
},
{
label: '降雨量',
value: 14,
countType: 2,
unit: 'mm'
},
{
label: '光合有效辐射',
value: 15,
countType: 2,
unit: 'umol/m2.s'
},
{
label: '太阳总辐射',
value: 16,
countType: 0,
unit: 'W/m2'
},
{
label: '流量',
value: 17,
countType: 0,
unit: 'L/H'
},
{
label: '大气压强',
value: 18,
countType: 2,
unit: 'KPa'
},
{
label: '土壤PH',
value: 19,
countType: 2,
unit: ''
},
{
label: '土壤EC',
value: 20,
countType: 0,
unit: 'uS/cm'
},
{
label: '叶面温度',
value: 21,
countType: 3,
unit: '℃'
},
{
label: '叶面湿度',
value: 22,
countType: 2,
unit: '%'
},
{
label: '果实直径',
value: 23,
countType: 0,
unit: 'mm'
},
{
label: '茎秆直径',
value: 24,
countType: 0,
unit: 'mm'
},
{
label: '流速',
value: 25,
countType: 2,
unit: 'm/s'
},
{
label: '瞬时流量',
value: 26,
countType: 2,
unit: 'm3'
},
{
label: '当日流量',
value: 27,
countType: 2,
unit: 'T'
},
{
label: '累计流量',
value: 28,
countType: 0,
unit: 'T'
},
{
label: '无线气象站电池电压',
value: 29,
countType: 2,
unit: 'V'
},
{
label: '无线气象站无线信号强度',
value: 30,
countType: 1,
unit: 'dBm'
},
{
label: '无线气象站信噪比SNR',
value: 31,
countType: 1,
unit: 'dB'
},
{
label: 'PM1.0',
value: 32,
countType: 0,
unit: 'μg/m2'
},
{
label: 'PM2.5',
value: 33,
countType: 0,
unit: 'μg/m2'
},
{
label: 'PM10',
value: 34,
countType: 0,
unit: 'μg/m2'
},
{
label: '紫外辐射',
value: 35,
countType: 0,
unit: 'W/m2'
},
{
label: '蒸发量',
value: 36,
countType: 2,
unit: 'mm'
},
{
label: '负氧离子',
value: 37,
countType: 0,
unit: '个/cm3'
},
{
label: '露点温度',
value: 38,
countType: 3,
unit: '℃'
},
{
label: '设备电压',
value: 39,
countType: 2,
unit: 'V'
},
{
label: '设备电流',
value: 40,
countType: 2,
unit: 'A'
},
{
label: '土壤氮含量',
value: 41,
countType: 0,
unit: 'mg/kg'
},
{
label: '土壤磷含量',
value: 42,
countType: 0,
unit: 'mg/kg'
},
{
label: '土壤钾含量',
value: 43,
countType: 0,
unit: 'mg/kg'
},
{
label: '管道压力',
value: 44,
countType: 0,
unit: 'Kpa'
},
{
label: '一氧化碳',
value: 45,
countType: 0,
unit: 'ppm'
},
{
label: '氨气',
value: 46,
countType: 0,
unit: 'ppm'
},
{
label: '硫化氢',
value: 47,
countType: 0,
unit: 'ppm'
},
{
label: '氧气',
value: 48,
countType: 2,
unit: '%vol'
},
{
label: '甲烷',
value: 49,
countType: 2,
unit: '%vol'
},
{
label: '铜CU',
value: 50,
countType: 0,
unit: 'mg/kg'
},
{
label: '镉CD',
value: 51,
countType: 2,
unit: 'mg/kg'
},
{
label: '铅PB',
value: 52,
countType: 0,
unit: 'mg/kg'
},
{
label: '噪声',
value: 53,
countType: 0,
unit: 'dB'
},
{
label: '叶面面积',
value: 54,
countType: 0,
unit: 'mm'
},
{
label: '虫数量',
value: 55,
countType: 0,
unit: '个'
},
{
label: '无线传感器电池电压',
value: 56,
countType: 2,
unit: 'V'
},
{
label: '无线传感器无线信号强度',
value: 57,
countType: 1,
unit: 'dBm'
},
{
label: '无线传感器信噪比SNR',
value: 58,
countType: 1,
unit: 'dB'
},
],
}
},
mounted() {
@ -291,6 +687,12 @@ export default {
this.login()
this.getTime()
setInterval(() => {
this.getNowTime()
}, 1000)
},
destroyed() {
this.timer_ = null
@ -299,14 +701,18 @@ export default {
// id
dataInit(userid) {
this.api.Bigdata_getAllControl(userid).then(res => {
console.log('根据用户id查询对应的设备大数据信息', res);
// console.log('id', res);
this.dataList = res.data.data
if (res.status === 200) {
res.data.data.forEach(el => {
this.get_weather_echart_data(el.deviceId)
this.get_thisWeekTemperature_echart_data(el.deviceId)
this.get_environmentData(el.deviceId)
this.get_readControl_getState(2023042214250018)
this.get_readControl_getState(el.deviceId)
});
// this.get_readControl_getState(2023042214250018)
this.getWeatherData(2023042214250027)
}
})
},
@ -420,13 +826,69 @@ export default {
})
},
padString(str, length) {
return str.padStart(length, '0');
},
getTime() {
this.time = getnowtime()
// console.log(this.time);
const that = this
setInterval(() => {
that.time = getnowtime()
}, 1000);
},
getNowTime() {
const now = new Date();
const year = now.getFullYear();
const month = (now.getMonth() + 1).toString().padStart(2, '0');
const day = now.getDate().toString().padStart(2, '0');
const formattedDate = `${year}.${month}.${day}`;
return formattedDate
},
// Copy
get_readControl_getState(deviceId) {
this.api.readControl_getState(deviceId).then(res => {
console.log('控制器状态值获取 Copy', res);
// console.log(' Copy', res);
if (res.data.code == 200) {
this.fanStatus.open = res.data.data['1023']
this.fanStatus.status = []
var num = res.data.data['1024']
var num1 = this.padString(num.toString(2), 5)
var openListNew = []
openListNew = num1.split("")
this.fanStatus.status = openListNew.reverse()
this.statusList = []
for (var i = 0; i < 4; i++) {
var statusData = { name: `顶卷膜${i + 1}`, open: res.data.data[(1025 + (i * 3))], progress: res.data.data[(1027 + (i * 3))], index: res.data.data[(1026 + (i * 3))] }
this.statusList.push(statusData)
}
// console.log(this.statusList);
}
})
},
//
getWeatherData(equipmentId) {
this.api.getcontrol_rtDatastation(equipmentId).then(res => {
// console.log('', res);
if (res.data.code == 200) {
this.weatherDataList = res.data.data
}
})
},
//
getTypeList(val) {
let typeList1 = []
typeList1 = this.typeList.filter(item => {
return item.value == val
})
return typeList1[0].unit
},
// useridtoken
login() {
// var data = {
@ -452,7 +914,7 @@ export default {
},
createVideoNew(accessToken, url, index) {
console.log(accessToken, url, index, 111);
// console.log(accessToken, url, index, 111);
// divWdivH 使div
let divW = document.getElementById('monitor' + index).clientWidth
let divH = document.getElementById('monitor' + index).clientHeight
@ -500,8 +962,10 @@ export default {
this.$router.push({ path: '/realTime' });
},
getCurrent(index) {
getCurrent(index,item) {
this.current = index;
// console.log(item,'00000000000000');
this.get_readControl_getState(item.deviceId)
},
drag_boxHandler() {
@ -791,6 +1255,34 @@ export default {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
marquee {
width: 100%;
height: 100%;
.item {
height: 100%;
margin-right: 0.1rem;
display: inline-block;
>img {
width: 0.3rem;
height: 0.3rem;
position: relative;
top: 0.01rem;
margin-right: 0.05rem;
}
>span {
font-size: 0.16rem;
font-weight: 400;
color: #fff;
font-family: Microsoft YaHei;
position: relative;
top: -0.08rem;
}
}
}
}
}
@ -1260,7 +1752,72 @@ export default {
color: #4EFFD5;
}
// >span:nth-child(6) {
// font-size: .14rem;
// font-family: MicrosoftYaHei;
// font-weight: 400;
// color: #7AE1FF;
// margin-right: 0.47rem;
// }
>span:nth-child(6) {
width: .66rem;
height: .30rem;
background: linear-gradient(-35deg, rgba(122, 225, 255, 0.49) 1%, rgba(122, 225, 255, 0.5) 100%);
border: .01rem solid rgba(122, 225, 255, 0.5);
border-radius: .15rem;
font-size: .14rem;
font-family: MicrosoftYaHei;
font-weight: 400;
color: #7AE1FF;
text-align: center;
line-height: 0.3rem;
}
}
.i_title_ {
// width: 4rem;
height: .5rem;
background: url('../../assets/img/i_title_bg.png') center no-repeat;
background-size: 100% 100%;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 0 0.1rem 0 0.05rem;
>img {
width: .5rem;
height: .5rem;
}
>span:nth-child(2) {
width: 18%;
font-size: .16rem;
font-family: MicrosoftYaHei-Bold;
font-weight: bold;
color: #FFFFFF;
}
.line {
width: .01rem;
height: .20rem;
background: #7ABAFF;
opacity: 0.2;
margin-right: 0.1rem;
}
>span:nth-child(4) {
width: 18%;
font-size: .14rem;
font-family: MicrosoftYaHei;
font-weight: 400;
color: #4EFFD5;
}
>span:nth-child(6) {
width: 18%;
font-size: .14rem;
font-family: MicrosoftYaHei;
font-weight: 400;

View File

@ -111,7 +111,7 @@
<img :src="require('../../assets/image/real-time-'+item1.formula+'.png')" alt="">
<div>
<span>{{ item1.environmentDataId }}</span>
<span>{{ item1.environmentData }}</span>
<span>{{ item1.environmentData + getTypeList(item1.formula) }}</span>
</div>
</div>
</div>
@ -185,7 +185,362 @@ export default {
left_: 2,
popContentList: [],
popContentCurrent: 5
popContentCurrent: 5,
typeList: [{
label: '无意义的传感器',
value: 0,
countType: 0
},
{
label: '空气温度',
value: 1,
countType: 3,
unit: '℃'
},
{
label: '空气湿度',
value: 2,
countType: 2,
unit: '%'
},
{
label: '光亮度',
value: 3,
countType: 2,
unit: 'Klux'
},
{
label: '二氧化碳',
value: 4,
countType: 0,
unit: 'ppm'
},
{
label: '土壤温度',
value: 5,
countType: 3,
unit: '℃'
},
{
label: '土壤湿度',
value: 6,
countType: 2,
unit: '%'
},
{
label: '水温',
value: 7,
countType: 3,
unit: '℃'
},
{
label: '水肥PH',
value: 8,
countType: 2,
unit: ''
},
{
label: '水肥EC',
value: 9,
countType: 2,
unit: 'mS/cm'
},
{
label: '压差',
value: 10,
countType: 0,
unit: 'Pa'
},
{
label: '风速',
value: 11,
countType: 2,
unit: 'm/s'
},
{
label: '风向',
value: 12,
countType: 0,
unit: '°'
},
{
label: '雨雪信号',
value: 13,
countType: 0,
unit: ''
},
{
label: '降雨量',
value: 14,
countType: 2,
unit: 'mm'
},
{
label: '光合有效辐射',
value: 15,
countType: 2,
unit: 'umol/m2.s'
},
{
label: '太阳总辐射',
value: 16,
countType: 0,
unit: 'W/m2'
},
{
label: '流量',
value: 17,
countType: 0,
unit: 'L/H'
},
{
label: '大气压强',
value: 18,
countType: 2,
unit: 'KPa'
},
{
label: '土壤PH',
value: 19,
countType: 2,
unit: ''
},
{
label: '土壤EC',
value: 20,
countType: 0,
unit: 'uS/cm'
},
{
label: '叶面温度',
value: 21,
countType: 3,
unit: '℃'
},
{
label: '叶面湿度',
value: 22,
countType: 2,
unit: '%'
},
{
label: '果实直径',
value: 23,
countType: 0,
unit: 'mm'
},
{
label: '茎秆直径',
value: 24,
countType: 0,
unit: 'mm'
},
{
label: '流速',
value: 25,
countType: 2,
unit: 'm/s'
},
{
label: '瞬时流量',
value: 26,
countType: 2,
unit: 'm3'
},
{
label: '当日流量',
value: 27,
countType: 2,
unit: 'T'
},
{
label: '累计流量',
value: 28,
countType: 0,
unit: 'T'
},
{
label: '无线气象站电池电压',
value: 29,
countType: 2,
unit: 'V'
},
{
label: '无线气象站无线信号强度',
value: 30,
countType: 1,
unit: 'dBm'
},
{
label: '无线气象站信噪比SNR',
value: 31,
countType: 1,
unit: 'dB'
},
{
label: 'PM1.0',
value: 32,
countType: 0,
unit: 'μg/m2'
},
{
label: 'PM2.5',
value: 33,
countType: 0,
unit: 'μg/m2'
},
{
label: 'PM10',
value: 34,
countType: 0,
unit: 'μg/m2'
},
{
label: '紫外辐射',
value: 35,
countType: 0,
unit: 'W/m2'
},
{
label: '蒸发量',
value: 36,
countType: 2,
unit: 'mm'
},
{
label: '负氧离子',
value: 37,
countType: 0,
unit: '个/cm3'
},
{
label: '露点温度',
value: 38,
countType: 3,
unit: '℃'
},
{
label: '设备电压',
value: 39,
countType: 2,
unit: 'V'
},
{
label: '设备电流',
value: 40,
countType: 2,
unit: 'A'
},
{
label: '土壤氮含量',
value: 41,
countType: 0,
unit: 'mg/kg'
},
{
label: '土壤磷含量',
value: 42,
countType: 0,
unit: 'mg/kg'
},
{
label: '土壤钾含量',
value: 43,
countType: 0,
unit: 'mg/kg'
},
{
label: '管道压力',
value: 44,
countType: 0,
unit: 'Kpa'
},
{
label: '一氧化碳',
value: 45,
countType: 0,
unit: 'ppm'
},
{
label: '氨气',
value: 46,
countType: 0,
unit: 'ppm'
},
{
label: '硫化氢',
value: 47,
countType: 0,
unit: 'ppm'
},
{
label: '氧气',
value: 48,
countType: 2,
unit: '%vol'
},
{
label: '甲烷',
value: 49,
countType: 2,
unit: '%vol'
},
{
label: '铜CU',
value: 50,
countType: 0,
unit: 'mg/kg'
},
{
label: '镉CD',
value: 51,
countType: 2,
unit: 'mg/kg'
},
{
label: '铅PB',
value: 52,
countType: 0,
unit: 'mg/kg'
},
{
label: '噪声',
value: 53,
countType: 0,
unit: 'dB'
},
{
label: '叶面面积',
value: 54,
countType: 0,
unit: 'mm'
},
{
label: '虫数量',
value: 55,
countType: 0,
unit: '个'
},
{
label: '无线传感器电池电压',
value: 56,
countType: 2,
unit: 'V'
},
{
label: '无线传感器无线信号强度',
value: 57,
countType: 1,
unit: 'dBm'
},
{
label: '无线传感器信噪比SNR',
value: 58,
countType: 1,
unit: 'dB'
},
],
}
},
mounted() {
@ -248,30 +603,39 @@ export default {
if (name == '二号') {
// this.top_ = 1;
// this.left_ = 6.2
return 'top:1rem;left:6.2rem'
return 'top:1rem;left:8rem'
} else if (name == '一号') {
// this.top_ = 3.5;
// this.left_ = 3.8
return 'top:3.5rem;left:3.8rem'
return 'top:3.5rem;left:4.8rem'
} else if (name == '3号') {
// this.top_ = 2;
// this.left_ = 9
return 'top:2rem;left:9rem'
return 'top:2rem;left:11.5rem'
} else if (name == '4号') {
// this.top_ = 2;
// this.left_ = 9.3
return 'top:2rem;left:9.3rem'
return 'top:2rem;left:14rem'
} else if (name == '5') {
// this.top_ = 3.5;
// this.left_ = 6.5
return 'top:3.5rem;left:6.5rem'
return 'top:6.5rem;left:10.5rem'
} else if (name == '6') {
// this.top_ = 0.8;
// this.left_ = 7.2
return 'top:0.8rem;left:7.2rem'
return 'top:0.8rem;left:11rem'
}
},
//
getTypeList(val) {
let typeList1 = []
typeList1 = this.typeList.filter(item => {
return item.value == val
})
return typeList1[0].unit
},
// useridtoken
login() {
// var data = {