This commit is contained in:
hzz 2025-02-12 08:08:41 +08:00
parent 3550242cc9
commit 56b07ac5ed
4 changed files with 166 additions and 206 deletions

View File

@ -74,6 +74,16 @@ const useR_D_EnvironmentStore = defineStore(
"deptId": "113", "deptId": "113",
"deptName": "4楼", "deptName": "4楼",
"status": false "status": false
},
{
"deviceId": "1111",
"humidity": "0",
"name": "温湿度监测2",
"label": "temp_humi_2",
"temp": "0",
"deptId": "114",
"deptName": "5楼",
"status": false
} }
], ],
"TVOC_CH2O": [ "TVOC_CH2O": [
@ -126,10 +136,8 @@ const useR_D_EnvironmentStore = defineStore(
}, },
} }
let sensorData = state.sensorData let sensorData = state.sensorData
console.log(sensorData, '123');
if (sensorData['temp_humi'] && sensorData['temp_humi'].length > 0) { if (sensorData['temp_humi'] && sensorData['temp_humi'].length > 0) {
console.log(sensorData['temp_humi'], '12113');
let fourTemp = 0 let fourTemp = 0
let fourHumi = 0 let fourHumi = 0
let fourCount = 0 let fourCount = 0

View File

@ -27,14 +27,14 @@ export const connectWebsocket = (url = null, agentData, successCallback, errCall
if (import.meta.env.VITE_APP_ENV == "production") { if (import.meta.env.VITE_APP_ENV == "production") {
wsUrl = `ws://${window.document.location.hostname}:9018/` wsUrl = `ws://${window.document.location.hostname}:9018/`
} else { } else {
console.log(import.meta.env,'11111111'); //console.log(import.meta.env,'11111111');
wsUrl = import.meta.env.VITE_APP_WS_API wsUrl = import.meta.env.VITE_APP_WS_API
} }
} else { } else {
wsUrl = url wsUrl = url
} }
console.log('socket地址:',wsUrl); //console.log('socket地址:',wsUrl);
createWebSoket() createWebSoket()
messageCallback = successCallback messageCallback = successCallback
errorCallback = errCallback errorCallback = errCallback

View File

@ -15,12 +15,12 @@ import u918 from './../image/u918.png';
import { computed } from 'vue'; import { computed } from 'vue';
const prop = defineProps({ const prop = defineProps({
option: { data: {
type: Object, type: Object,
default: () => { default: () => {
return { return {
xData: [], ch2o: [],
seriesData: [], tvoc: []
} }
} }
} }
@ -31,9 +31,9 @@ const options = computed(() => {
tooltip: { tooltip: {
trigger: 'axis' trigger: 'axis'
}, },
legend: { // legend: {
data: ['Email', 'Union Ads', 'Video Ads', 'Direct', 'Search Engine'] // data: ['Email', 'Union Ads', 'Video Ads', 'Direct', 'Search Engine']
}, // },
grid: { grid: {
left: '3%', left: '3%',
right: '4%', right: '4%',
@ -42,9 +42,8 @@ const options = computed(() => {
}, },
backgroundColor: 'transparent', backgroundColor: 'transparent',
xAxis: { xAxis: {
type: 'category', type: 'time',
boundaryGap: false, boundaryGap: false,
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
}, },
yAxis: { yAxis: {
type: 'value' type: 'value'
@ -56,7 +55,7 @@ const options = computed(() => {
areaStyle: { areaStyle: {
opacity: 0.3 opacity: 0.3
}, },
data: [120, 132, 101, 134, 90, 230, 210] data: prop.data.ch2o
}, },
{ {
name: 'TVOC', name: 'TVOC',
@ -64,7 +63,7 @@ const options = computed(() => {
areaStyle: { areaStyle: {
opacity: 0.3 opacity: 0.3
}, },
data: [220, 182, 191, 234, 290, 330, 310] data: prop.data.tvoc
} }
] ]
}; };

View File

@ -12,13 +12,13 @@
<Lr1 :data="avg_temp_humi.four" /> <Lr1 :data="avg_temp_humi.four" />
<Lr2 :deptId="'113'" /> <Lr2 :deptId="'113'" />
<Lr3 :public_list="noiseDataList.four.public_noise" :office_list="noiseDataList.four.office_noise" /> <Lr3 :public_list="noiseDataList.four.public_noise" :office_list="noiseDataList.four.office_noise" />
<Lr4 /> <Lr4 :data="TVOC_CH2O['4f']" />
</div> </div>
<div class="right-content left-right" ref="rightContentRef"> <div class="right-content left-right" ref="rightContentRef">
<Lr1 :data="avg_temp_humi.five" /> <Lr1 :data="avg_temp_humi.five" />
<Lr2 :deptId="'114'" /> <Lr2 :deptId="'114'" />
<Lr3 :public_list="noiseDataList.five.public_noise" :office_list="noiseDataList.five.office_noise" /> <Lr3 :public_list="noiseDataList.five.public_noise" :office_list="noiseDataList.five.office_noise" />
<Lr4 /> <Lr4 :data="TVOC_CH2O['5f']" />
</div> </div>
<div class="bottom-content" ref="bottomContentRef"> <div class="bottom-content" ref="bottomContentRef">
@ -45,6 +45,7 @@ import Lr4 from './component/Lr4.vue';
import ZdScrollBoard from "@/components/ZdScrollBoard/index.vue"; import ZdScrollBoard from "@/components/ZdScrollBoard/index.vue";
import SensorNumLoop from './component/SensorNumLoop.vue'; import SensorNumLoop from './component/SensorNumLoop.vue';
import useR_D_EnvironmentStore from '@/store/modules/r_d_environment' import useR_D_EnvironmentStore from '@/store/modules/r_d_environment'
import { connectWebsocket, closeWebsocket} from "@/utils/websocket";
import { getSensorByDept } from '@/api/screen/R_D_Environment'; import { getSensorByDept } from '@/api/screen/R_D_Environment';
@ -56,81 +57,14 @@ let avg_temp_humi = computed(() => {
let noiseDataList = computed(() => { let noiseDataList = computed(() => {
return R_D_EnvironmentStore.getNoiseData return R_D_EnvironmentStore.getNoiseData
}) })
let humi = ref({ let TVOC_CH2O = reactive({
"Humiture": [ '4f': {
{ ch2o: [],
"devId": "eb98cb70-158f-11ee-b4df-a9653aef169c", tvoc: []
"name": "服装军团",
"temp": "15.4",
"humidity": "14.6",
"status": true
}, },
{ '5f': {
"devId": "50633690-158f-11ee-b4df-a9653aef169c", ch2o: [],
"name": "家纺军团", tvoc: []
"temp": "16.3",
"humidity": "54.1",
"status": false
},
{
"devId": "e07dee00-158f-11ee-b4df-a9653aef169c",
"name": "医防军团",
"temp": "15.2",
"humidity": "12.3",
"status": true
},
{
"devId": "5b01df20-158f-11ee-b4df-a9653aef169c",
"name": "配套中心",
"temp": "11.4",
"humidity": "20",
"status": true
},
{
"devId": "c524cfd0-4bb2-11ee-864d-e941de71fb47",
"name": "东气泵房",
"temp": "26.9",
"humidity": "10",
"status": true
},
{
"devId": "e7868a00-4bb2-11ee-864d-e941de71fb47",
"name": "西气泵房",
"temp": "34.4",
"humidity": "6",
"status": true
},
{
"devId": "7cd36740-158f-11ee-b4df-a9653aef169c",
"name": "东莞分公司",
"temp": "27.7",
"humidity": "38.9",
"status": false
},
{
"devId": "c502b660-158f-11ee-b4df-a9653aef169c",
"name": "东莞分公司",
"temp": "29.5",
"humidity": "56.3",
"status": false
},
{
"devId": "57d4bbc0-1bc9-11ee-93b4-8d0afc6a8fe9",
"name": "微工厂",
"temp": "14.7",
"humidity": "17.1",
"status": false
}
],
"top": {
"temp": 45,
"humidity": 75,
"name": "温湿度上限值"
},
"bottom": {
"temp": -15,
"humidity": 15,
"name": "温湿度下限值"
} }
}) })
let sensor_list = computed(() => { let sensor_list = computed(() => {
@ -272,6 +206,7 @@ function reqSensorByDept() {
if (res.code === 200) { if (res.code === 200) {
let sensorData = res.data let sensorData = res.data
let temp_humi = sensorData.temp_humi let temp_humi = sensorData.temp_humi
let TVOC_CH2O = sensorData.TVOC_CH2O
let temp = [] let temp = []
temp_humi.map(item => { temp_humi.map(item => {
let index = temp.find(item2 => { return item2.deviceId == item.deviceId }) let index = temp.find(item2 => { return item2.deviceId == item.deviceId })
@ -308,6 +243,23 @@ function reqSensorByDept() {
} }
} }
}) })
let now = +new Date()
TVOC_CH2O.map(item => {
if (item.deptId == '113') {
if (item.type === 'CH2O') {
TVOC_CH2O['4f'].ch2o.push([now,item.data])
} else if (item.type === 'TVOC') {
TVOC_CH2O['4f'].tvoc.push([now,item.data])
}
} else if(item.deptId == '114') {
if (item.type === 'CH2O') {
TVOC_CH2O['5f'].ch2o.push([now,item.data])
} else if (item.type === 'TVOC') {
TVOC_CH2O['5f'].tvoc.push([now,item.data])
}
}
})
sensorData.temp_humi = temp sensorData.temp_humi = temp
R_D_EnvironmentStore.sensorData = sensorData R_D_EnvironmentStore.sensorData = sensorData
// noiseDataList.value = res.data // noiseDataList.value = res.data
@ -426,6 +378,7 @@ onMounted(() => {
// deltaY.value = 0 // deltaY.value = 0
// } // }
}, { passive: false }); }, { passive: false });
//connectWebsocket('','',getWebsocket, errWebsocket)
}); });
</script> </script>