diff --git a/src/api/screen/R_D_Environment.js b/src/api/screen/R_D_Environment.js index 27ba105..67bd57e 100644 --- a/src/api/screen/R_D_Environment.js +++ b/src/api/screen/R_D_Environment.js @@ -10,11 +10,17 @@ export function getNoiseData(query) { }) } // 查询公区传感器数据 -export function getTopData(query) { +export function getTopData(deptId) { 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', - params: query }) } diff --git a/src/router/index.js b/src/router/index.js index a659dd6..6da0ad3 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -77,12 +77,12 @@ export const constantRoutes = [ hidden: true, redirect: 'noredirect', children: [ - // { - // path: "/screen/R_D_Environment", - // name: "R_D_Environment", - // component: () => import("../views/screen/R_D_Environment/index.vue"), - // hidden: true - // }, + { + path: "/screen/R_D_Environment", + name: "R_D_Environment", + component: () => import("../views/screen/R_D_Environment/index.vue"), + hidden: true + }, { path: "/screen/R_D_Environment1", name: "R_D_Environment1", diff --git a/src/store/modules/r_d_environment.js b/src/store/modules/r_d_environment.js new file mode 100644 index 0000000..71be220 --- /dev/null +++ b/src/store/modules/r_d_environment.js @@ -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 \ No newline at end of file diff --git a/src/views/screen/R_D_Environment/component/Sence.vue b/src/views/screen/R_D_Environment/component/Sence.vue index d3d55b3..a8c4f9e 100644 --- a/src/views/screen/R_D_Environment/component/Sence.vue +++ b/src/views/screen/R_D_Environment/component/Sence.vue @@ -174,7 +174,7 @@ const initModel = () => { }; const planeAnimate = (texture: any): Animate => { - console.log(texture, 'texture'); + // console.log(texture, 'texture'); texture.wrapS = THREE.RepeatWrapping; texture.wrapT = THREE.RepeatWrapping; const animateFn = { diff --git a/src/views/screen/R_D_Environment/index.vue b/src/views/screen/R_D_Environment/index.vue index a129739..bf5bf38 100644 --- a/src/views/screen/R_D_Environment/index.vue +++ b/src/views/screen/R_D_Environment/index.vue @@ -273,7 +273,7 @@ function getNoiseDataList() { } // 获取顶部数据 function getTopDataList() { - getTopData().then(res => { + getTopData(113).then(res => { if (res.code === 200) { res.data.forEach(item => { let index = sensor_list.findIndex(sensor => sensor.type === item.type) diff --git a/src/views/screen/R_D_Environment1/component/Lr2.vue b/src/views/screen/R_D_Environment1/component/Lr2.vue index 24e6023..b8b3164 100644 --- a/src/views/screen/R_D_Environment1/component/Lr2.vue +++ b/src/views/screen/R_D_Environment1/component/Lr2.vue @@ -14,39 +14,34 @@