fix:通风系统对接接口
This commit is contained in:
@@ -2,6 +2,8 @@
|
|||||||
const prefix = '/carbon-smart/api';
|
const prefix = '/carbon-smart/api';
|
||||||
// 通风系统相关接口
|
// 通风系统相关接口
|
||||||
export enum ventilating {
|
export enum ventilating {
|
||||||
|
//传感器获取数据
|
||||||
|
getSensorData = prefix + '/multiFuncSensorCtrl/getDeviceState',
|
||||||
// 排风扇相关 =============================================
|
// 排风扇相关 =============================================
|
||||||
// 获得排风扇系统的树形结构
|
// 获得排风扇系统的树形结构
|
||||||
getTree1 = prefix + '/ventilatingFanCtrl/getCtrlPanelTree',
|
getTree1 = prefix + '/ventilatingFanCtrl/getCtrlPanelTree',
|
||||||
|
@@ -177,7 +177,7 @@
|
|||||||
// 温泉颜色
|
// 温泉颜色
|
||||||
import sunRed from '../image/airConditioningSystem/sunRed.png';
|
import sunRed from '../image/airConditioningSystem/sunRed.png';
|
||||||
import sunYellow from '../image/airConditioningSystem/sunYellow.png';
|
import sunYellow from '../image/airConditioningSystem/sunYellow.png';
|
||||||
import sunBlue from '../image/airConditioningSystem/sunBlue.png';
|
import sunGreen from '../image/airConditioningSystem/sunGreen.png';
|
||||||
|
|
||||||
import singleModel from '../components/singleModel.vue';
|
import singleModel from '../components/singleModel.vue';
|
||||||
import doubleSingleModel from '../components/doubleSingleModel.vue';
|
import doubleSingleModel from '../components/doubleSingleModel.vue';
|
||||||
@@ -230,7 +230,7 @@
|
|||||||
type: '温度',
|
type: '温度',
|
||||||
unit: '℃',
|
unit: '℃',
|
||||||
number: 20,
|
number: 20,
|
||||||
url: sunBlue,
|
url: sunGreen,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'D区多功能传感器',
|
title: 'D区多功能传感器',
|
||||||
|
@@ -57,7 +57,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import sunRed from '../image/airConditioningSystem/sunRed.png';
|
import sunRed from '../image/airConditioningSystem/sunRed.png';
|
||||||
import sunYellow from '../image/airConditioningSystem/sunYellow.png';
|
import sunYellow from '../image/airConditioningSystem/sunYellow.png';
|
||||||
import sunBlue from '../image/airConditioningSystem/sunBlue.png';
|
import sunGreen from '../image/airConditioningSystem/sunGreen.png';
|
||||||
|
|
||||||
import electricFan from '../image/airConditioningSystem/electricFan.png';
|
import electricFan from '../image/airConditioningSystem/electricFan.png';
|
||||||
import setUp from '../image/airConditioningSystem/setUp.png';
|
import setUp from '../image/airConditioningSystem/setUp.png';
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
});
|
});
|
||||||
const getSunUrl = () => {
|
const getSunUrl = () => {
|
||||||
if (props.dataSource.number > 0 && props.dataSource.number < 20) {
|
if (props.dataSource.number > 0 && props.dataSource.number < 20) {
|
||||||
return sunBlue;
|
return sunGreen;
|
||||||
} else if (props.dataSource.number >= 20 && props.dataSource.number < 30) {
|
} else if (props.dataSource.number >= 20 && props.dataSource.number < 30) {
|
||||||
return sunYellow;
|
return sunYellow;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
class="box-number"
|
class="box-number"
|
||||||
:style="{
|
:style="{
|
||||||
left: dataSource.type === '二氧化碳' ? '95px' : '90px',
|
left: dataSource.type === '二氧化碳' ? '95px' : '90px',
|
||||||
|
color: dataSource.fontColor ? dataSource.fontColor : '#0dffa4',
|
||||||
}"
|
}"
|
||||||
>{{ dataSource.number }}</div
|
>{{ dataSource.number }}</div
|
||||||
>
|
>
|
||||||
@@ -90,7 +91,6 @@
|
|||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
}
|
}
|
||||||
.box-number {
|
.box-number {
|
||||||
color: #0dffa4;
|
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
left: 72%;
|
left: 72%;
|
||||||
top: 45%;
|
top: 45%;
|
||||||
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
@@ -1,3 +1,11 @@
|
|||||||
|
//传感器位置
|
||||||
|
export const devicePosition = [
|
||||||
|
{ styleText: { left: '46.8%', bottom: '74%' } },
|
||||||
|
{ styleText: { left: '47%', bottom: '62%' } },
|
||||||
|
{ styleText: { left: '47.2%', bottom: '47%' } },
|
||||||
|
{ styleText: { left: '47.3%', bottom: '34%' } },
|
||||||
|
];
|
||||||
|
|
||||||
// 排风扇
|
// 排风扇
|
||||||
export const devicePosition1 = [
|
export const devicePosition1 = [
|
||||||
{
|
{
|
||||||
|
@@ -287,6 +287,7 @@
|
|||||||
import selectImg from '../image/airConditioningSystem/selectImg.png';
|
import selectImg from '../image/airConditioningSystem/selectImg.png';
|
||||||
import sunRed from '../image/airConditioningSystem/sunRed.png';
|
import sunRed from '../image/airConditioningSystem/sunRed.png';
|
||||||
import sunYellow from '../image/airConditioningSystem/sunYellow.png';
|
import sunYellow from '../image/airConditioningSystem/sunYellow.png';
|
||||||
|
import sunGreen from '../image/airConditioningSystem/sunGreen.png';
|
||||||
|
|
||||||
import boxModel from './components/boxModel.vue';
|
import boxModel from './components/boxModel.vue';
|
||||||
import singleModel from '../components/singleModel.vue';
|
import singleModel from '../components/singleModel.vue';
|
||||||
@@ -301,7 +302,12 @@
|
|||||||
// 全局变量
|
// 全局变量
|
||||||
import { items } from '/@/store/item';
|
import { items } from '/@/store/item';
|
||||||
// 定位数据
|
// 定位数据
|
||||||
import { devicePosition1, devicePosition2, devicePosition3 } from './devicePosition';
|
import {
|
||||||
|
devicePosition1,
|
||||||
|
devicePosition2,
|
||||||
|
devicePosition3,
|
||||||
|
devicePosition,
|
||||||
|
} from './devicePosition';
|
||||||
|
|
||||||
// 父子组件交互 =======================================================================
|
// 父子组件交互 =======================================================================
|
||||||
|
|
||||||
@@ -433,81 +439,13 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
// 温度数组
|
// 温度数组
|
||||||
const sensorData = ref([
|
const sensorData = ref([]);
|
||||||
{
|
|
||||||
title: '多功能传感器A',
|
|
||||||
styleText: { left: '48%', bottom: '64%' },
|
|
||||||
type: '温度',
|
|
||||||
unit: '℃',
|
|
||||||
number: 20,
|
|
||||||
url: sunRed,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '多功能传感器B',
|
|
||||||
styleText: { left: '48.2%', bottom: '43%' },
|
|
||||||
type: '温度',
|
|
||||||
unit: '℃',
|
|
||||||
number: 20,
|
|
||||||
url: sunYellow,
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
// 湿度数组
|
// 湿度数组
|
||||||
const humidityData = ref([
|
const humidityData = ref([]);
|
||||||
{
|
|
||||||
title: '多功能传感器A',
|
|
||||||
styleText: { left: '48%', bottom: '64%' },
|
|
||||||
type: '湿度',
|
|
||||||
unit: '%',
|
|
||||||
number: 20,
|
|
||||||
url: humidity,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '多功能传感器B',
|
|
||||||
styleText: { left: '48.2%', bottom: '43%' },
|
|
||||||
type: '湿度',
|
|
||||||
unit: '%',
|
|
||||||
number: 20,
|
|
||||||
url: humidity,
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
// PM2.5数组
|
// PM2.5数组
|
||||||
const pmData = ref([
|
const pmData = ref([]);
|
||||||
{
|
|
||||||
title: '多功能传感器A',
|
|
||||||
styleText: { left: '48%', bottom: '64%' },
|
|
||||||
type: 'pm2.5',
|
|
||||||
unit: '',
|
|
||||||
number: 20,
|
|
||||||
url: PM25,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '多功能传感器B',
|
|
||||||
styleText: { left: '48.2%', bottom: '43%' },
|
|
||||||
type: 'pm2.5',
|
|
||||||
unit: '',
|
|
||||||
number: 20,
|
|
||||||
url: PM25,
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
// 二氧化碳 浓度
|
// 二氧化碳 浓度
|
||||||
const CO2Data = ref([
|
const CO2Data = ref([]);
|
||||||
{
|
|
||||||
title: '多功能传感器A',
|
|
||||||
styleText: { left: '48%', bottom: '64%' },
|
|
||||||
type: '二氧化碳',
|
|
||||||
unit: 'CO2e',
|
|
||||||
number: 20,
|
|
||||||
url: CO2,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '多功能传感器B',
|
|
||||||
styleText: { left: '48.2%', bottom: '43%' },
|
|
||||||
type: '二氧化碳',
|
|
||||||
unit: 'CO2e',
|
|
||||||
number: 99,
|
|
||||||
url: CO2,
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
// 排风扇
|
// 排风扇
|
||||||
const fanData = ref([]);
|
const fanData = ref([]);
|
||||||
// 风幕机
|
// 风幕机
|
||||||
@@ -536,11 +474,85 @@
|
|||||||
const tabs2Ref = ref();
|
const tabs2Ref = ref();
|
||||||
// 抽屉tab3组件的引用
|
// 抽屉tab3组件的引用
|
||||||
const tabs3Ref = ref();
|
const tabs3Ref = ref();
|
||||||
|
//根据温度获取图片
|
||||||
|
const getSunUrl = (number: any) => {
|
||||||
|
if (number > 0 && number < 20) {
|
||||||
|
return sunGreen;
|
||||||
|
} else if (number >= 20 && number < 30) {
|
||||||
|
return sunYellow;
|
||||||
|
} else {
|
||||||
|
return sunRed;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
//获取温度颜色
|
||||||
|
const getColor = (number: any) => {
|
||||||
|
if (number > 0 && number < 20) {
|
||||||
|
return '#0dffa4';
|
||||||
|
} else if (number >= 20 && number < 30) {
|
||||||
|
return '#f59a23';
|
||||||
|
} else {
|
||||||
|
return '#f36163';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// 获取传感器数据
|
||||||
|
const getSensorData = () => {
|
||||||
|
sensorData.value = [];
|
||||||
|
humidityData.value = [];
|
||||||
|
pmData.value = [];
|
||||||
|
CO2Data.value = [];
|
||||||
|
http
|
||||||
|
.get(ventilating.getSensorData, { projectId: state.projectId, siteId: state.siteId })
|
||||||
|
.then((res) => {
|
||||||
|
if (res.msg === 'success') {
|
||||||
|
res.data.forEach((item: any, index: number) => {
|
||||||
|
sensorData.value.push({
|
||||||
|
title: item.deviceInfoName,
|
||||||
|
styleText: devicePosition[index].styleText,
|
||||||
|
type: '温度',
|
||||||
|
unit: item.record.tempUnit,
|
||||||
|
number: item.record.temp,
|
||||||
|
url: getSunUrl(item.record.temp),
|
||||||
|
fontColor: getColor(item.record.temp),
|
||||||
|
});
|
||||||
|
humidityData.value.push({
|
||||||
|
title: item.deviceInfoName,
|
||||||
|
styleText: devicePosition[index].styleText,
|
||||||
|
type: '湿度',
|
||||||
|
unit: item.record.humidityUnit,
|
||||||
|
number: item.record.humidity,
|
||||||
|
url: humidity,
|
||||||
|
});
|
||||||
|
pmData.value.push({
|
||||||
|
title: item.deviceInfoName,
|
||||||
|
styleText: devicePosition[index].styleText,
|
||||||
|
type: 'pm2.5',
|
||||||
|
unit: item.record.pm2_5Unit,
|
||||||
|
number: item.record.pm2_5,
|
||||||
|
url: PM25,
|
||||||
|
});
|
||||||
|
CO2Data.value.push({
|
||||||
|
title: item.deviceInfoName,
|
||||||
|
styleText: devicePosition[index].styleText,
|
||||||
|
type: '二氧化碳',
|
||||||
|
unit: item.record.co_CO2Unit,
|
||||||
|
number: item.record.co_CO2,
|
||||||
|
url: CO2,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
//实时获取数据 暂定一分钟
|
||||||
|
const intervalId = setInterval(getSensorData, 60000);
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
//获取传感器数据
|
||||||
|
getSensorData();
|
||||||
// 获得枚举
|
// 获得枚举
|
||||||
getStateEnum();
|
getStateEnum();
|
||||||
});
|
});
|
||||||
onUnmounted(() => {});
|
onUnmounted(() => {
|
||||||
|
clearInterval(intervalId);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
@import url('../style/color.less');
|
@import url('../style/color.less');
|
||||||
|
Reference in New Issue
Block a user