diff --git a/src/api/screen/R_D_Environment.js b/src/api/screen/R_D_Environment.js index e38e3b5..27ba105 100644 --- a/src/api/screen/R_D_Environment.js +++ b/src/api/screen/R_D_Environment.js @@ -16,4 +16,17 @@ export function getTopData(query) { method: 'get', params: query }) +} + +/** 获取特定传感器数据 + * @param {Object} query + * @param {'water_pressure'|'TVOC_CH2O'|'temp_humi'|'Smoke'|'noise'|'Methane'|'hydraulic_pressure'|'FIRE'|'dust'|'Current'} query.type 传感器类型 + * @param {number} query.deptId 部门id + */ +export function getSensorDateHourByType(query) { + return request({ + url: '/screen/goaSenso/getSensorDateHourByType', + method: 'get', + params: query + }) } \ No newline at end of file diff --git a/src/views/screen/R_D_Environment/component/barChart.vue b/src/views/screen/R_D_Environment/component/barChart.vue new file mode 100644 index 0000000..95f74a6 --- /dev/null +++ b/src/views/screen/R_D_Environment/component/barChart.vue @@ -0,0 +1,168 @@ + + + + + \ No newline at end of file diff --git a/src/views/screen/R_D_Environment/component/pm.vue b/src/views/screen/R_D_Environment/component/pm.vue index d211496..cb82f5e 100644 --- a/src/views/screen/R_D_Environment/component/pm.vue +++ b/src/views/screen/R_D_Environment/component/pm.vue @@ -9,14 +9,8 @@ const prop = defineProps({ type: Object, default: () => { return { - date: ['2021-10-01', '2021-10-02', '2021-10-03', '2021-10-04', '2021-10-05', '2021-10-06', '2021-10-07'], - series: [{ - type: '温度', - value: [20, 22, 23, 24, 25, 26, 27] - }, { - type: '湿度', - value: [30, 32, 33, 34, 35, 36, 37] - }] + pm25: 0, + pm10: 0, }; } } @@ -102,7 +96,7 @@ const options = computed(() => { }, data: [ { - value: 80, + value: prop.data.pm25, name: "PM2.5", }, ], @@ -162,7 +156,7 @@ const options = computed(() => { }, data: [ { - value: 60, + value: prop.data.pm10, name: "PM10", }, ], diff --git a/src/views/screen/R_D_Environment/component/proge.vue b/src/views/screen/R_D_Environment/component/proge.vue index a7e9dd0..3cf3110 100644 --- a/src/views/screen/R_D_Environment/component/proge.vue +++ b/src/views/screen/R_D_Environment/component/proge.vue @@ -100,22 +100,11 @@ const options = computed(() => { itemStyle: { color: '#ccc' }, - data: [ - { - value: 100, - }, { - value: 100, - }, { - value: 100, - }, { - value: 100, - }, { - value: 100, - }, { + data: prop.data.map(item => { + return { value: 100, } - - ] + }) } ] } diff --git a/src/views/screen/R_D_Environment/index.vue b/src/views/screen/R_D_Environment/index.vue index 18e5695..ab1f4a4 100644 --- a/src/views/screen/R_D_Environment/index.vue +++ b/src/views/screen/R_D_Environment/index.vue @@ -3,18 +3,18 @@
研发中心环境实时监测系统
- +
- - + +
- - + +
@@ -22,7 +22,7 @@
+ :value="item.value" :color="checkCb(item)" :unit="item.unit" />
{{ item.value + item.unit }}
{{ item.name }}
@@ -32,12 +32,12 @@
- +
- +
@@ -72,6 +72,7 @@ import ItemVue from './component/item.vue'; import Humiture from './component/humiture_line.vue'; import PmVue from './component/pm.vue'; import LineChart from './component/lineChart.vue'; +import BarChart from './component/barChart.vue'; import ProgeChart from './component/proge.vue'; import SvgFenchen from './component/svgFenchen.vue'; import SvgPm25 from './component/svgPm25.vue'; @@ -82,7 +83,7 @@ import SvgTVOC from './component/svgTVOC.vue'; import SvgShidu from './component/svgShidu.vue'; import SvgWendu from './component/svgWendu.vue'; import SvgYanwu from './component/svgYanwu.vue'; -import { getNoiseData,getTopData } from '@/api/screen/R_D_Environment'; +import { getNoiseData,getTopData,getSensorDateHourByType } from '@/api/screen/R_D_Environment'; let noiseDataList = ref([ { @@ -102,6 +103,7 @@ let sensor_list = reactive([ value: 20, unit: '℃', type: 'AirTemp_Reg', + limit: 30, status: "true" }, { @@ -111,6 +113,7 @@ let sensor_list = reactive([ value: 20, unit: '%', type: 'AirHumi_Reg', + limit: 30, status: "true" }, { @@ -120,6 +123,7 @@ let sensor_list = reactive([ value: 20, unit: 'mg/m³', type: 'CH2O', + limit: 30, status: "true" }, { @@ -129,6 +133,7 @@ let sensor_list = reactive([ value: 20, unit: 'mg/m³', type: 'TVOC', + limit: 30, status: "true" }, { @@ -138,6 +143,7 @@ let sensor_list = reactive([ value: 20, unit: 'mg/m³', type:'HIGH_PM25_Reg', + limit: 30, status: "true" }, { @@ -147,6 +153,7 @@ let sensor_list = reactive([ value: 20, unit: 'mg/m³', type:'HIGH_PM10_Reg', + limit: 30, status: "true" }, { @@ -156,6 +163,7 @@ let sensor_list = reactive([ value: 20, unit: 'dB', type:'Noise_Reg', + limit: 30, status: "true" }, { @@ -165,9 +173,24 @@ let sensor_list = reactive([ value: 20, unit: 'mg/m³', type:'Smoke_Reg', + limit: 30, status: "true" } ]) +let dustData = reactive({ + pm25: 0, + pm10: 0, +}) +//检测是否超标 +function checkCb(item) { + if (item.status === 'false') { + return 'gray' + }else if (item.value > item.limit) { + return '#FF0000' + } else { + return '#469DE9' + } +} // 获取各办公室噪音数据 @@ -187,12 +210,27 @@ function getTopDataList() { 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 + + } }) } }) } +// 获取传感器数据 +function getSensorData(type) { + let query = { + type, + deptId: '100' + } + getSensorDateHourByType(query) +} onMounted(() => {