This commit is contained in:
hzz 2025-02-08 17:03:51 +08:00
parent c28eba6e1f
commit 3550242cc9
11 changed files with 472 additions and 277 deletions

View File

@ -10,11 +10,17 @@ export function getNoiseData(query) {
}) })
} }
// 查询公区传感器数据 // 查询公区传感器数据
export function getTopData(query) { export function getTopData(deptId) {
return request({ return request({
url: '/screen/goaSensor/getTopData?depts=100', url: '/screen/goaSensor/getTopData?depts=' + deptId,
method: 'get',
})
}
// 查询公区传感器数据
export function getSensorByDept(deptIds) {
return request({
url: '/screen/goaSensor/getSensorByDept?depts=' + deptIds,
method: 'get', method: 'get',
params: query
}) })
} }

View File

@ -77,12 +77,12 @@ export const constantRoutes = [
hidden: true, hidden: true,
redirect: 'noredirect', redirect: 'noredirect',
children: [ children: [
// { {
// path: "/screen/R_D_Environment", path: "/screen/R_D_Environment",
// name: "R_D_Environment", name: "R_D_Environment",
// component: () => import("../views/screen/R_D_Environment/index.vue"), component: () => import("../views/screen/R_D_Environment/index.vue"),
// hidden: true hidden: true
// }, },
{ {
path: "/screen/R_D_Environment1", path: "/screen/R_D_Environment1",
name: "R_D_Environment1", name: "R_D_Environment1",

View File

@ -0,0 +1,185 @@
const useR_D_EnvironmentStore = defineStore(
'r_d_environment',
{
state: () => ({
sensorData: {
"noise": [
{
"deviceId": "41210bb0-1591-11ee-b4df-a9653aef169c",
"data": "16",
"field": null,
"name": "噪声监测1",
"typeId": "noise",
"label": "noise-1",
"deptId": "113",
"type": "Noise_Reg",
"x": null,
"y": null,
"deptName": "4楼",
"status": false
}
],
"Smoke": [
{
"deviceId": "14927870-969d-11ef-91f3-abd609c7e488",
"data": "0",
"field": null,
"name": "烟雾传感器10",
"typeId": "Smoke",
"label": "Smoke-10",
"deptId": "113",
"type": null,
"x": null,
"y": null,
"deptName": "4楼",
"status": false
}
],
"dust": [
{
"deviceId": "25c78580-1594-11ee-b4df-a9653aef1699",
"data": "0",
"field": null,
"name": "粉尘监测传感器",
"typeId": "dust",
"label": "Dust_02",
"deptId": "113",
"type": "HIGH_PM25_Reg",
"x": null,
"y": null,
"deptName": "4楼",
"status": false
}, {
"deviceId": "25c78580-1594-11ee-b4df-a9653aef169c",
"data": "25",
"field": null,
"name": "粉尘监测传感器",
"typeId": "dust",
"label": "Dust_01",
"deptId": "114",
"type": "HIGH_PM10_Reg",
"x": null,
"y": null,
"deptName": "5楼",
"status": false
}
],
"temp_humi": [
{
"deviceId": "1",
"humidity": "0",
"name": "温湿度监测1",
"label": "temp_humi_1",
"temp": "0",
"deptId": "113",
"deptName": "4楼",
"status": false
}
],
"TVOC_CH2O": [
{
"deviceId": "c65d80e0-158e-11ee-b4df-a9653aef1191",
"data": "0",
"field": null,
"name": "TVOC/甲醛监测传感器",
"typeId": "TVOC_CH2O",
"label": "TVOC_CH2O_01",
"deptId": "113",
"type": "CH2O",
"x": null,
"y": null,
"deptName": "4楼",
"status": false
},
{
"deviceId": "c65d80e0-158e-11ee-b4df-a9653aef169c",
"data": "0.41",
"field": null,
"name": "TVOC/甲醛监测传感器",
"typeId": "TVOC_CH2O",
"label": "TVOC_CH2O_02",
"deptId": "114",
"type": "TVOC",
"x": null,
"y": null,
"deptName": "5楼",
"status": false
}
]
}
}),
actions: {},
getters: {
//获取四层,五层的平均温湿度
getLayerData: (state) => {
let layerData = {
four: {
title: '研发中心四楼',
temp: 0,
humi: 0
},
five: {
title: '研发中心五楼',
temp: 0,
humi: 0
},
}
let sensorData = state.sensorData
console.log(sensorData, '123');
if (sensorData['temp_humi'] && sensorData['temp_humi'].length > 0) {
console.log(sensorData['temp_humi'], '12113');
let fourTemp = 0
let fourHumi = 0
let fourCount = 0
let fiveTemp = 0
let fiveHumi = 0
let fiveCount = 0
sensorData['temp_humi'].forEach(item => {
if (item.deptId === '113') {
fourTemp += +item.temp
fourHumi += +item.humidity
fourCount++
} else if (item.deptId === '114') {
fiveTemp += +item.temp
fiveHumi += +item.humidity
fiveCount++
}
})
layerData.four.temp = (fourTemp / fourCount).toFixed(1)
layerData.four.humi = (fourHumi / fourCount).toFixed(1)
layerData.five.temp = (fiveTemp / fiveCount).toFixed(1)
layerData.five.humi = (fiveHumi / fiveCount).toFixed(1)
}
return layerData
},
//获取四层,五层的噪声传感器数据
getNoiseData: (state) => {
let resNoiseData = {
four: {
public_noise: {},
office_noise: []
},
five: {
public_noise: {},
office_noise: []
}
}
let noiseData = state.sensorData['noise'] || []
let fourNoiseData = noiseData.filter(item => item.deptId === '113')
let fiveNoiseData = noiseData.filter(item => item.deptId === '114')
resNoiseData.four.public_noise = fourNoiseData.find(item => item.name === '噪声监测1')
resNoiseData.four.office_noise = fourNoiseData.filter(item => item.name !== '噪声监测1')
resNoiseData.five.public_noise = fiveNoiseData.find(item => item.name === '噪声监测10')
resNoiseData.five.office_noise = fiveNoiseData.filter(item => item.name !== '噪声监测10')
return resNoiseData
},
}
}
)
export default useR_D_EnvironmentStore

View File

@ -174,7 +174,7 @@ const initModel = () => {
}; };
const planeAnimate = (texture: any): Animate => { const planeAnimate = (texture: any): Animate => {
console.log(texture, 'texture'); // console.log(texture, 'texture');
texture.wrapS = THREE.RepeatWrapping; texture.wrapS = THREE.RepeatWrapping;
texture.wrapT = THREE.RepeatWrapping; texture.wrapT = THREE.RepeatWrapping;
const animateFn = { const animateFn = {

View File

@ -273,7 +273,7 @@ function getNoiseDataList() {
} }
// //
function getTopDataList() { function getTopDataList() {
getTopData().then(res => { getTopData(113).then(res => {
if (res.code === 200) { if (res.code === 200) {
res.data.forEach(item => { res.data.forEach(item => {
let index = sensor_list.findIndex(sensor => sensor.type === item.type) let index = sensor_list.findIndex(sensor => sensor.type === item.type)

View File

@ -14,13 +14,18 @@
<script setup> <script setup>
import { computed } from 'vue'; import { computed } from 'vue';
import u918 from './../image/u918.png'; import u918 from './../image/u918.png';
import useR_D_EnvironmentStore from '@/store/modules/r_d_environment'
let R_D_EnvironmentStore = useR_D_EnvironmentStore()
const prop = defineProps({ const prop = defineProps({
data: { deptId: {
type: Object, type: String,
default: () => { default: '113'
return { }
Humiture: [], });
const options = computed(() => {
let Humiture = R_D_EnvironmentStore.sensorData['temp_humi']?.filter(sensor => sensor.deptId === prop.deptId)||[]
let obj = {
bottom: { bottom: {
"temp": -15, "temp": -15,
"humidity": 15, "humidity": 15,
@ -32,21 +37,11 @@ const prop = defineProps({
"name": "温湿度上限值" "name": "温湿度上限值"
} }
} }
}
}
});
const options = computed(() => {
let obj = {
bottom: prop.data.bottom,
top: prop.data.top
}
//x //x
let x = []; let x = [];
//y //y
let y = { temp: [], humidity: [] }; let y = { temp: [], humidity: [] };
prop.data.Humiture.forEach((res) => { Humiture.forEach((res) => {
x.push(res.name); x.push(res.name);
y.temp.push(res.temp); y.temp.push(res.temp);
y.humidity.push(res.humidity); y.humidity.push(res.humidity);
@ -84,7 +79,7 @@ const options = computed(() => {
yAxis: { yAxis: {
type: "value", type: "value",
boundaryGap: [0, 0.01], boundaryGap: [0, 0.01],
name:'(°C/%RH)', name: '(°C/%RH)',
axisLabel: { axisLabel: {
formatter: "{value}", formatter: "{value}",
}, },
@ -232,6 +227,7 @@ const options = computed(() => {
margin-left: 10px; margin-left: 10px;
} }
} }
.content { .content {
width: 100%; width: 100%;
height: 237px; height: 237px;

View File

@ -13,7 +13,7 @@
fill="#2affff" p-id="1942"></path> fill="#2affff" p-id="1942"></path>
</svg> </svg>
<div class="text-label"> <div class="text-label">
<div class="label-left">{{ prop.public_list.devName }}</div> <div class="label-left">{{ prop.public_list.name }}</div>
<div class="label-right"><i class="value" :style="{ color: checkCb(prop.public_list) }">{{ <div class="label-right"><i class="value" :style="{ color: checkCb(prop.public_list) }">{{
prop.public_list.data }}</i> dB</div> prop.public_list.data }}</i> dB</div>
</div> </div>
@ -33,7 +33,7 @@ const prop = defineProps({
default: () => { default: () => {
return { return {
"devId": "48a2ec70-a60c-11ef-91f3-abd609c7e488", "devId": "48a2ec70-a60c-11ef-91f3-abd609c7e488",
"devName": "公共区域1", "name": "公共区域1",
"label": "noise-7", "label": "noise-7",
"place": null, "place": null,
"data": 0, "data": 0,
@ -47,7 +47,7 @@ const prop = defineProps({
return [ return [
{ {
"devId": "48a2ec70-a60c-11ef-91f3-abd609c7e488", "devId": "48a2ec70-a60c-11ef-91f3-abd609c7e488",
"devName": "办公区2", "name": "办公区2",
"label": "noise-7", "label": "noise-7",
"place": null, "place": null,
"data": 0, "data": 0,

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="progress-container"> <div class="progress-container">
<div class="text-label"> <div class="text-label">
<div class="label-left">{{ prop.mdoelValue1.devName }}</div> <div class="label-left">{{ prop.mdoelValue1.name }}</div>
<div class="label-right"><i class="value">{{ prop.mdoelValue1.data }}</i> dB</div> <div class="label-right"><i class="value">{{ prop.mdoelValue1.data }}</i> dB</div>
</div> </div>
<div class="progress"> <div class="progress">
@ -18,7 +18,7 @@ const prop = defineProps({
type: Object, type: Object,
default: () => { default: () => {
return { return {
devName: '办公区1噪音', name: '办公区1噪音',
data: 10, data: 10,
} }
} }

View File

@ -58,6 +58,8 @@ const init = () => {
boxHelperWrap = new BoxHelperWrap(viewer); boxHelperWrap = new BoxHelperWrap(viewer);
viewer.emitter.on(Event.dblclick.raycaster, (list: THREE.Intersection[]) => { viewer.emitter.on(Event.dblclick.raycaster, (list: THREE.Intersection[]) => {
console.log(list, 'list');
onMouseClick(list); onMouseClick(list);
}); });
@ -174,7 +176,6 @@ const initModel = () => {
}; };
const planeAnimate = (texture: any): Animate => { const planeAnimate = (texture: any): Animate => {
console.log(texture, 'texture');
texture.wrapS = THREE.RepeatWrapping; texture.wrapS = THREE.RepeatWrapping;
texture.wrapT = THREE.RepeatWrapping; texture.wrapT = THREE.RepeatWrapping;
const animateFn = { const animateFn = {
@ -272,9 +273,9 @@ const onMouseMove = (intersects: THREE.Intersection[]) => {
// }; // };
findClickModel(selectedObject); findClickModel(selectedObject);
console.log(selectedObjectName,selectedObject, '--selectedObjectName---'); // console.log(selectedObjectName,selectedObject, '--selectedObjectName---');
const rack = findParent(selectedObject, checkIsRack); const rack = findParent(selectedObject, checkIsRack);
console.log(rack, '-------rack---------'); // console.log(rack, '-------rack---------');
if (rack) { if (rack) {
boxHelperWrap.attach(rack); boxHelperWrap.attach(rack);

View File

@ -6,7 +6,7 @@
<!-- prop.sensorData.status == 'true'?'#469DE9':'gray' --> <!-- prop.sensorData.status == 'true'?'#469DE9':'gray' -->
<div style="margin: 10px 0">{{prop.sensorData.list[i].status=== 'false' ? '——' :prop.sensorData.list[i].value + prop.sensorData.unit }}</div> <div style="margin: 10px 0">{{prop.sensorData.list[i].status=== 'false' ? '——' :prop.sensorData.list[i].value + prop.sensorData.unit }}</div>
<div>{{ prop.sensorData.list[i].name }}</div> <div style="text-align: center;">{{ prop.sensorData.list[i].name }}</div>
</div> </div>
</template> </template>

View File

@ -10,27 +10,33 @@
</div> </div>
<div class="left-content left-right" ref="leftContentRef"> <div class="left-content left-right" ref="leftContentRef">
<Lr1 :data="avg_temp_humi.four" /> <Lr1 :data="avg_temp_humi.four" />
<Lr2 :data="humi" /> <Lr2 :deptId="'113'" />
<Lr3 :public_list="public_noise" :office_list="office_noise" /> <Lr3 :public_list="noiseDataList.four.public_noise" :office_list="noiseDataList.four.office_noise" />
<Lr4 /> <Lr4 />
</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 :data="humi" /> <Lr2 :deptId="'114'" />
<Lr3 :public_list="public_noise" :office_list="office_noise" /> <Lr3 :public_list="noiseDataList.five.public_noise" :office_list="noiseDataList.five.office_noise" />
<Lr4 /> <Lr4 />
</div> </div>
<div class="bottom-content" ref="bottomContentRef"> <div class="bottom-content" ref="bottomContentRef">
<ZdScrollBoard ref="devList" :config="zd_config" class="zd-scroll-board"/> <ZdScrollBoard ref="devList" :config="zd_config" class="zd-scroll-board" />
</div> </div>
<div class="checkboxlist">
<el-radio-group v-model="radioGroup1" :fill="'#105F88'" size="large">
<el-radio-button label="四层" value="四层"></el-radio-button>
<Sence /> <el-radio-button label="五层" value="五层"></el-radio-button>
</el-radio-group>
</div>
<!-- <Sence /> -->
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref, reactive, onMounted } from 'vue'; import { ref, reactive, onMounted, computed, watch } from 'vue';
import Sence from './component/Sence.vue'; import Sence from './component/Sence.vue';
import Lr1 from './component/Lr1.vue'; import Lr1 from './component/Lr1.vue';
import Lr2 from './component/Lr2.vue'; import Lr2 from './component/Lr2.vue';
@ -38,25 +44,18 @@ import Lr3 from './component/Lr3.vue';
import Lr4 from './component/Lr4.vue'; 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 { getNoiseData, getTopData, getSensorDateHourByType } from '@/api/screen/R_D_Environment'; import useR_D_EnvironmentStore from '@/store/modules/r_d_environment'
import { getSensorByDept } from '@/api/screen/R_D_Environment';
let R_D_EnvironmentStore = useR_D_EnvironmentStore()
let deltaY = ref(0) let deltaY = ref(0)
let avg_temp_humi = reactive({ let avg_temp_humi = computed(() => {
four: { return R_D_EnvironmentStore.getLayerData
title: '研发中心四楼', })
temp: 25.5, let noiseDataList = computed(()=>{
humi: 60 return R_D_EnvironmentStore.getNoiseData
},
five: {
title: '研发中心五楼',
temp: 25.5,
humi: 60
}
}) })
let noiseDataList = ref()
let public_noise = ref({})
let office_noise = ref([])
let humi = ref({ let humi = ref({
"Humiture": [ "Humiture": [
{ {
@ -134,180 +133,127 @@ let humi = ref({
"name": "温湿度下限值" "name": "温湿度下限值"
} }
}) })
let sensor_list = reactive([ let sensor_list = computed(()=>{
let sensorData = R_D_EnvironmentStore.sensorData
return [
{ {
component: 'SvgWendu', component: 'SvgWendu',
unit: '℃', unit: '℃',
type: 'AirTemp_Reg', type: 'AirTemp_Reg',
limit: 40, limit: 40,
list: [ list: sensorData['temp_humi']?.map(sensor => {
{ return {
id: sensor.deviceId,
id: '', name: sensor.name,
name: '温度1', value: sensor.temp,
value: 20, status: sensor.status
status: "true"
},
{
id: '',
name: '温度2',
value: 20,
status: "true"
} }
] })
}, },
{ {
component: 'SvgShidu', component: 'SvgShidu',
unit: '%RH', unit: '%RH',
type: 'AirHumi_Reg', type: 'AirHumi_Reg',
limit: 90, limit: 90,
list: [ list: sensorData['temp_humi']?.map(sensor => {
{ return {
id: sensor.deviceId,
id: '', name: sensor.name,
name: '湿度1', value: sensor.humidity,
value: 20, status: sensor.status
status: "true"
},
{
id: '',
name: '湿度2',
value: 100,
status: "true"
} }
] })
}, },
{ {
component: 'SvgJiaquan', component: 'SvgJiaquan',
unit: 'mg/m³', unit: 'mg/m³',
type: 'CH2O', type: 'CH2O',
limit: 0.08, limit: 0.08,
list: [ list: sensorData['TVOC_CH2O']?.filter(sensor => sensor.type === 'CH2O').map(sensor => {
{ return {
id: sensor.deviceId,
id: '', name: sensor.name,
name: '甲醛1', value: sensor.data,
value: 20, status: sensor.status
status: "true"
},
{
id: '',
name: '甲醛2',
value: 20,
status: "true"
} }
] })
}, },
{ {
component: 'SvgTVOC', component: 'SvgTVOC',
unit: 'mg/m³', unit: 'mg/m³',
type: 'TVOC', type: 'TVOC',
limit: 0.5, limit: 0.5,
list: [ list: sensorData['TVOC_CH2O']?.filter(sensor => sensor.type === 'TVOC').map(sensor => {
{ return {
id: sensor.deviceId,
id: '', name: sensor.name,
name: 'TVOC1', value: sensor.data,
value: 20, status: sensor.status
status: "true"
},
{
id: '',
name: 'TVOC2',
value: 20,
status: "true"
} }
] })
}, },
{ {
component: 'SvgPm25', component: 'SvgPm25',
unit: 'mg/m³', unit: 'mg/m³',
type: 'HIGH_PM25_Reg', type: 'HIGH_PM25_Reg',
limit: 30, limit: 30,
list: [ list: sensorData['dust']?.filter(sensor => sensor.type === 'HIGH_PM25_Reg').map(sensor => {
{ return {
id: sensor.deviceId,
id: '', name: sensor.name,
name: 'PM2.51', value: sensor.data,
value: 20, status: sensor.status
status: "false"
},
{
id: '',
name: 'PM2.52',
value: 20,
status: "true"
} }
] })
}, },
{ {
component: 'SvgPm10', component: 'SvgPm10',
unit: 'mg/m³', unit: 'mg/m³',
type: 'HIGH_PM10_Reg', type: 'HIGH_PM10_Reg',
limit: 30, limit: 30,
list: [ list: sensorData['dust']?.filter(sensor => sensor.type === 'HIGH_PM10_Reg').map(sensor => {
{ return {
id: sensor.deviceId,
id: '', name: sensor.name,
name: 'PM101', value: sensor.data,
value: 20, status: sensor.status
status: "true"
},
{
id: '',
name: 'PM102',
value: 20,
status: "true"
} }
] })
}, },
{ {
component: 'SvgZaosheng', component: 'SvgZaosheng',
unit: 'dB', unit: 'dB',
type: 'Noise_Reg', type: 'Noise_Reg',
limit: 85, limit: 85,
list: [ list: sensorData['noise']?.map(sensor => {
{ return {
id: sensor.deviceId,
id: '', name: sensor.name,
name: '噪音1', value: sensor.data,
value: 20, status: sensor.status
status: "true"
},
{
id: '',
name: '噪音2',
value: 20,
status: "true"
} }
] })
}, },
{ {
component: 'SvgYanwu', component: 'SvgYanwu',
unit: 'mg/m³', unit: 'mg/m³',
type: 'Smoke_Reg', type: 'Smoke_Reg',
limit: 100, limit: 100,
list: [ list: sensorData['Smoke']?.map(sensor => {
{ return {
id: sensor.deviceId,
id: '', name: sensor.name,
name: '烟雾1', value: sensor.data,
value: 20, status: sensor.status
status: "true"
},
{
id: '',
name: '烟雾2',
value: 20,
status: "true"
} }
] })
} }
]) ]
})
const radioGroup1 = ref('四层')
let zd_config = ref({ let zd_config = ref({
header: ['报警时间', '报警内容', '持续时长','报警次数'], header: ['报警时间', '报警内容', '持续时长', '报警设备'],
rowNum: 2, rowNum: 2,
headerHeight: 50, headerHeight: 50,
headerBGC: 'transparent', headerBGC: 'transparent',
@ -315,102 +261,151 @@ let zd_config = ref({
evenRowBGC: 'transparent', evenRowBGC: 'transparent',
columnWidth: [179, 179, 179, 179], columnWidth: [179, 179, 179, 179],
data: [ data: [
['行1列1', '行1列2', '行1列3','行1列4'], ['行1列1', '行1列2', '行1列3', '行1列4'],
['行2列1', '行2列2', '行2列3','行2列4'], ['行2列1', '行2列2', '行2列3', '行2列4'],
['行3列1', '行3列2', '行3列3','行3列4'], ['行3列1', '行3列2', '行3列3', '行3列4'],
['行4列1', '行4列2', '行4列3','行4列4'], ['行4列1', '行4列2', '行4列3', '行4列4'],
] ]
}) })
function getNoiseDataList() { function reqSensorByDept() {
noiseDataList.value = [ getSensorByDept('113,114').then(res => {
{ if (res.code === 200) {
"devId": "48a2ec70-a60c-11ef-91f3-abd609c7e488", let sensorData = res.data
"devName": "公共区域", let temp_humi = sensorData.temp_humi
"label": "noise-7", let temp = []
"place": null, temp_humi.map(item => {
"data": 19, let index = temp.find(item2 => { return item2.deviceId == item.deviceId })
"status": 0 if (!index) {
}, if (item.type === 'AirHumi_Reg') {
{ temp.push({
"devId": "48a2ec70-a60c-11ef-91f3-abd609c7e489", deviceId: item.deviceId,
"devName": "办公区6", humidity: item.data,
"label": "noise-6", name: item.name,
"place": null, label: item.label,
"data": 90, temp: '',
"status": 0 deptId: item.deptId,
}, deptName: item.deptName,
{ status: item.status
"devId": "48a2ec70-a60c-11ef-91f3-abd609c7e490", })
"devName": "办公区5",
"label": "noise-5", } else if (item.type === 'AirTemp_Reg') {
"place": null, temp.push({
"data": 22, deviceId: item.deviceId,
"status": 0 humidity: '',
}, name: item.name,
{ label: item.label,
"devId": "48a2ec70-a60c-11ef-91f3-abd609c7e491", temp: item.data,
"devName": "办公区4", deptId: item.deptId,
"label": "noise-4", deptName: item.deptName,
"place": null, status: item.status
"data": 22, })
"status": 0 }
}, } else {
{ if (item.type === 'AirHumi_Reg') {
"devId": "48a2ec70-a60c-11ef-91f3-abd609c7e491", index.humidity = item.data
"devName": "办公区3", } else if (item.type === 'AirTemp_Reg') {
"label": "noise-3", index.temp = item.data
"place": null, }
"data": 21, }
"status": 0 })
}, sensorData.temp_humi = temp
{ R_D_EnvironmentStore.sensorData = sensorData
"devId": "48a2ec70-a60c-11ef-91f3-abd609c7e492", // noiseDataList.value = res.data
"devName": "办公区2", // public_noise.value = noiseDataList.value.find(item => item.devName === '')
"label": "noise-2", // office_noise.value = noiseDataList.value.filter(item => item.devName !== '')
"place": null, }
"data": 24, })
"status": 0
},
{
"devId": "48a2ec70-a60c-11ef-91f3-abd609c7e493",
"devName": "办公区1",
"label": "noise-1",
"place": null,
"data": 25,
"status": 0
},
]
public_noise.value = noiseDataList.value.find(item => item.devName === '公共区域')
office_noise.value = noiseDataList.value.filter(item => item.devName !== '公共区域')
} }
//
// function getTopDataList() {
// getTopData().then(res => {
// if (res.code === 200) {
// res.data.forEach(item => {
// let index = sensor_list.findIndex(sensor => sensor.type === item.type)
// sensor_list[index].value = item.data
// sensor_list[index].id = item.id
// sensor_list[index].status = item.status
// sensor_list[index].limit = item.limit
// if (item.type === 'HIGH_PM25_Reg') {
// dustData.pm25 = item.data
// } else if (item.type === 'HIGH_PM10_Reg') {
// dustData.pm10 = item.data
// } //socket
function getWebsocket(val) {
try {
let data = JSON.parse(val);
// }) if (data.type == "HUMI_TEMP") {
// } let obj = data.msg;
// }) if (obj.hasOwnProperty('temp')) {
// } let index = sensor_list.findIndex(sensor => sensor.type === 'AirTemp_Reg' && sensor.id === obj.temp.devId)
if (index !== -1) {
sensor_list[index].value = obj.temp.value
sensor_list[index].status = "true"
}
}
if (obj.hasOwnProperty('humi')) {
let index = sensor_list.findIndex(sensor => sensor.type === 'AirHumi_Reg' && sensor.id === obj.humi.devId)
if (index !== -1) {
sensor_list[index].value = obj.humi.value
sensor_list[index].status = "true"
}
}
}
if (data.type == "TVOC_CH2O") {
let obj = data.msg;
if (obj.hasOwnProperty('CH2O')) {
let index = sensor_list.findIndex(sensor => sensor.type === 'CH2O' && sensor.id === obj.CH2O.devId)
if (index !== -1) {
sensor_list[index].value = obj.CH2O.value
sensor_list[index].status = "true"
}
}
if (obj.hasOwnProperty('TVOC')) {
let index = sensor_list.findIndex(sensor => sensor.type === 'TVOC' && sensor.id === obj.TVOC.devId)
if (index !== -1) {
sensor_list[index].value = obj.TVOC.value
sensor_list[index].status = "true"
}
}
}
//
if (data.type == "dust") {
let obj = data.msg;
let index_pm25 = sensor_list.findIndex(sensor => sensor.type === 'HIGH_PM25_Reg' && sensor.id === obj.devId)
let index_pm10 = sensor_list.findIndex(sensor => sensor.type === 'HIGH_PM10_Reg' && sensor.id === obj.devId)
if (index_pm25 !== -1) {
sensor_list[index_pm25].value = obj.pm25
sensor_list[index_pm25].status = "true"
dustData.pm25 = obj.pm25
}
if (index_pm10 !== -1) {
sensor_list[index_pm10].value = obj.pm10
sensor_list[index_pm10].status = "true"
dustData.pm10 = obj.pm10
}
}
//
if (data.type === "NOISE") {
let obj = data.msg;
let list_index = noiseDataList.value.findIndex(item => item.devId === obj.noise.devId)
if (list_index !== -1) {
noiseDataList.value[list_index].data = obj.noise.value
} else {
let index = sensor_list.findIndex(sensor => sensor.type === 'Noise_Reg' && sensor.id === obj.noise.devId)
if (index !== -1) {
sensor_list[index].value = obj.noise.value
sensor_list[index].status = "true"
}
}
}
} catch (err) {
console.log(err);
}
}
function errWebsocket(val) {
// console.log(val);
}
onMounted(() => { onMounted(() => {
getNoiseDataList() reqSensorByDept()
window.addEventListener('wheel', function (event) { window.addEventListener('wheel', function (event) {
deltaY.value += event.deltaY deltaY.value += event.deltaY
if (deltaY.value <= -500 && deltaY.value >= -1000) { if (deltaY.value <= -500 && deltaY.value >= -1000) {
@ -540,9 +535,10 @@ onMounted(() => {
background-position: bottom, 50% 100%; background-position: bottom, 50% 100%;
background-repeat: no-repeat, no-repeat; background-repeat: no-repeat, no-repeat;
transition: transform 1s; transition: transform 1s;
.zd-scroll-board { .zd-scroll-board {
width: 716px; width: 716px;
height: 120px,; height: 120px, ;
position: absolute; position: absolute;
top: 28px; top: 28px;
left: 50%; left: 50%;
@ -551,4 +547,15 @@ onMounted(() => {
} }
} }
} }
.checkboxlist {
position: absolute;
top: 2px;
right: 60px;
z-index: 999;
:deep(.el-checkbox-button__inner) {
font-size: 18px;
}
}
</style> </style>