邓洁: 切换隧道面板数据加载

This commit is contained in:
邓洁
2024-01-03 17:47:35 +08:00
parent 2298b674f4
commit 5557b7109e
3 changed files with 16 additions and 9 deletions

View File

@@ -100,7 +100,7 @@ watch(() => props.list, (now) => {
}) })
}, {deep: true}); }, {deep: true});
watch(() => props.airData, (now) => { watch(() => props.airData, (now) => {
if (now.sensorList !== null) { if (now.sensorList.length !== 0) {
if (now.sensorList.length === 0) { if (now.sensorList.length === 0) {
airList.value = [] airList.value = []
} else { } else {

View File

@@ -74,7 +74,12 @@ const bgImage = computed(() =>
: "bg.png" : "bg.png"
); );
watch(() => props.eleData, (now) => { watch(() => props.eleData, (now) => {
getBasicData(now.frequencyChangerList) console.log('now.frequencyChangerList',now)
if(now.frequencyChangerList.length===0){
electricityConsumptionMonthly.value=0
}else {
getBasicData(now.frequencyChangerList)
}
setValueA() setValueA()
}, {deep: true}); }, {deep: true});
watch(() => props.list, (now) => { watch(() => props.list, (now) => {
@@ -94,19 +99,21 @@ onMounted(() => {
setValueB() setValueB()
}) })
const setValueA = () => { const setValueA = () => {
if (electricityConsumptionMonthly.value === 0 || length.value === null) return if (electricityConsumptionMonthly.value === 0 || length.value === null) {
valueA.value.style.height = `0px`;
}
let width = (electricityConsumptionMonthly.value * length.value.offsetHeight) / 10000; let width = (electricityConsumptionMonthly.value * length.value.offsetHeight) / 10000;
valueA.value.style.height = `${width}px`; valueA.value.style.height = `${width}px`;
} }
const setValueB = () => { const setValueB = () => {
if (monthlySavings.value === 0 || length.value === null) return if (monthlySavings.value === 0 || length.value === null) {
valueB.value.style.height = `0px`;
}
let width = (monthlySavings.value * length.value.offsetHeight) / 10000; let width = (monthlySavings.value * length.value.offsetHeight) / 10000;
valueB.value.style.height = `${width}px`; valueB.value.style.height = `${width}px`;
} }
const getBasicData = (data) => { const getBasicData = (data) => {
if(data!==null){
electricityConsumptionMonthly.value = data[0].electricityConsumptionMonthly electricityConsumptionMonthly.value = data[0].electricityConsumptionMonthly
}
} }
const handleOpenChart = () => { const handleOpenChart = () => {
console.log('用电量弹窗') console.log('用电量弹窗')

View File

@@ -194,17 +194,17 @@ const getScreenInfo = (id) => {
tunnelId.value = id tunnelId.value = id
getLargeScreen(id).then((res) => { getLargeScreen(id).then((res) => {
if (res?.code === 1000) { if (res?.code === 1000) {
if(res.data.frequencyChangerList!==null&&res.data.frequencyChangerList.length!==0){ if(res.data.frequencyChangerList.length!==0){
showFanLoading.value=0 showFanLoading.value=0
}else { }else {
showFanLoading.value=1 showFanLoading.value=1
} }
if(res.data.windPressureSensorList!==null&&res.data.windPressureSensorList.length!==0){ if(res.data.windPressureSensorList.length!==0){
showWindLoading.value=0 showWindLoading.value=0
}else { }else {
showWindLoading.value=1 showWindLoading.value=1
} }
if(res.data.sensorList!==null&&res.data.sensorList.length!==0){ if(res.data.sensorList.length!==0){
res.data.sensorList.forEach((item,index)=>{ res.data.sensorList.forEach((item,index)=>{
if ( if (
item.equipmentType === "carbonDioxide" || item.equipmentType === "carbonDioxide" ||