diff --git a/src/components/content/airInfo/AirInfo.vue b/src/components/content/airInfo/AirInfo.vue index 15abe69..63769b9 100644 --- a/src/components/content/airInfo/AirInfo.vue +++ b/src/components/content/airInfo/AirInfo.vue @@ -100,7 +100,7 @@ watch(() => props.list, (now) => { }) }, {deep: true}); watch(() => props.airData, (now) => { - if (now.sensorList !== null) { + if (now.sensorList.length !== 0) { if (now.sensorList.length === 0) { airList.value = [] } else { diff --git a/src/components/content/usedEle/UsedEle.vue b/src/components/content/usedEle/UsedEle.vue index 00de321..6108fdd 100644 --- a/src/components/content/usedEle/UsedEle.vue +++ b/src/components/content/usedEle/UsedEle.vue @@ -74,7 +74,12 @@ const bgImage = computed(() => : "bg.png" ); 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() }, {deep: true}); watch(() => props.list, (now) => { @@ -94,19 +99,21 @@ onMounted(() => { setValueB() }) 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; valueA.value.style.height = `${width}px`; } 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; valueB.value.style.height = `${width}px`; } const getBasicData = (data) => { - if(data!==null){ electricityConsumptionMonthly.value = data[0].electricityConsumptionMonthly - } } const handleOpenChart = () => { console.log('用电量弹窗') diff --git a/src/views/tunnel/index.vue b/src/views/tunnel/index.vue index b2e6465..178a4f6 100644 --- a/src/views/tunnel/index.vue +++ b/src/views/tunnel/index.vue @@ -194,17 +194,17 @@ const getScreenInfo = (id) => { tunnelId.value = id getLargeScreen(id).then((res) => { if (res?.code === 1000) { - if(res.data.frequencyChangerList!==null&&res.data.frequencyChangerList.length!==0){ + if(res.data.frequencyChangerList.length!==0){ showFanLoading.value=0 }else { showFanLoading.value=1 } - if(res.data.windPressureSensorList!==null&&res.data.windPressureSensorList.length!==0){ + if(res.data.windPressureSensorList.length!==0){ showWindLoading.value=0 }else { 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)=>{ if ( item.equipmentType === "carbonDioxide" ||