|
|
@ -287,6 +287,7 @@ |
|
|
|
import selectImg from '../image/airConditioningSystem/selectImg.png'; |
|
|
|
import sunRed from '../image/airConditioningSystem/sunRed.png'; |
|
|
|
import sunYellow from '../image/airConditioningSystem/sunYellow.png'; |
|
|
|
import sunGreen from '../image/airConditioningSystem/sunGreen.png'; |
|
|
|
|
|
|
|
import boxModel from './components/boxModel.vue'; |
|
|
|
import singleModel from '../components/singleModel.vue'; |
|
|
@ -301,7 +302,12 @@ |
|
|
|
// 全局变量 |
|
|
|
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([ |
|
|
|
{ |
|
|
|
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 sensorData = 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, |
|
|
|
}, |
|
|
|
]); |
|
|
|
const humidityData = ref([]); |
|
|
|
// PM2.5数组 |
|
|
|
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 pmData = 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 CO2Data = ref([]); |
|
|
|
// 排风扇 |
|
|
|
const fanData = ref([]); |
|
|
|
// 风幕机 |
|
|
@ -536,11 +474,85 @@ |
|
|
|
const tabs2Ref = ref(); |
|
|
|
// 抽屉tab3组件的引用 |
|
|
|
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(() => { |
|
|
|
//获取传感器数据 |
|
|
|
getSensorData(); |
|
|
|
// 获得枚举 |
|
|
|
getStateEnum(); |
|
|
|
}); |
|
|
|
onUnmounted(() => {}); |
|
|
|
onUnmounted(() => { |
|
|
|
clearInterval(intervalId); |
|
|
|
}); |
|
|
|
</script> |
|
|
|
<style lang="less"> |
|
|
|
@import url('../style/color.less'); |
|
|
|