fix : 修复数据loading加载
This commit is contained in:
@@ -4,11 +4,11 @@
|
||||
<div class="fan-speed">
|
||||
<div>
|
||||
<img src="@/assets/images/airInfo/fan-v-icon.png" alt=""/>
|
||||
<div class="fan-info" @click="handleOpenChart(windSpeedId)">
|
||||
<div class="fan-info" @click="handleOpenChart(windSpeedType,windSpeedId)">
|
||||
<div class="input-fan"><span>风速</span>{{ windSpeed }}m/s</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wind-direction-info" @click="handleOpenChart(windDirectionSpeedId)">
|
||||
<div class="wind-direction-info" @click="handleOpenChart(windDirectionSpeedType,windDirectionSpeedId)">
|
||||
<div class="input-fan"><span>风向</span>{{ windDirection }} °</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -64,10 +64,12 @@ const props = defineProps({
|
||||
const chooseDayRef = ref();
|
||||
const chooseMonthRef = ref();
|
||||
const windSpeed = ref(0)
|
||||
const windDirection = ref(0)
|
||||
const windDirection = ref(null)
|
||||
const loadingText = ref('加载中...')
|
||||
const windSpeedId = ref(0)
|
||||
const windSpeedType = ref(null)
|
||||
const windDirectionSpeedId = ref(0)
|
||||
const windDirectionSpeedType = ref(null)
|
||||
const dialogTitle = ref('风速')
|
||||
const openDialogId = ref(0)
|
||||
const airList = ref([])
|
||||
@@ -85,27 +87,34 @@ watch(() => props.list, (now) => {
|
||||
})
|
||||
}, {deep: true});
|
||||
watch(() => props.airData, (now) => {
|
||||
if (now.sensorList.length !== 0) {
|
||||
if (now.sensorList.length === 0) {
|
||||
airList.value = []
|
||||
} else {
|
||||
getAirInfo(now.sensorList)
|
||||
}
|
||||
} else {
|
||||
if (now.sensorList.length === 0) {
|
||||
airList.value = []
|
||||
windSpeed.value = 0
|
||||
windSpeed.value = null
|
||||
windDirection.value = null
|
||||
} else {
|
||||
getAirInfo(now.sensorList)
|
||||
}
|
||||
// if (now.sensorList.length !== 0) {
|
||||
// if (now.sensorList.length === 0) {
|
||||
// airList.value = []
|
||||
// } else {
|
||||
// getAirInfo(now.sensorList)
|
||||
// }
|
||||
// } else {
|
||||
// airList.value = []
|
||||
// windSpeed.value = 0
|
||||
// }
|
||||
}, {deep: true});
|
||||
const daySelect = (val) => {
|
||||
getChartInfo(openDialogId.value, 'day',val)
|
||||
getChartInfo(openDialogId.value, 'day', val)
|
||||
}
|
||||
const monthSelect = (val) => {
|
||||
getChartInfo(openDialogId.value, 'month',val)
|
||||
getChartInfo(openDialogId.value, 'month', val)
|
||||
}
|
||||
const getChartInfo = (equipmentId, type = 'day',time='') => {
|
||||
const getChartInfo = (equipmentId, type = 'day', time = '') => {
|
||||
isWindSpeedVisited.value = true
|
||||
showSpeedLoading.value = true
|
||||
getEchartsInfo(equipmentId,time, type).then(res => {
|
||||
getEchartsInfo(equipmentId, time, type).then(res => {
|
||||
if (res?.code === 1000) {
|
||||
showSpeedLoading.value = false
|
||||
nextTick(() => {
|
||||
@@ -121,11 +130,11 @@ const getChartInfo = (equipmentId, type = 'day',time='') => {
|
||||
}
|
||||
const handleOpenChart = (id, type) => {
|
||||
selectTimeButton.value = 2
|
||||
nextTick(()=>{
|
||||
if(chooseMonthRef.value){
|
||||
nextTick(() => {
|
||||
if (chooseMonthRef.value) {
|
||||
chooseMonthRef.value.clearData()
|
||||
}
|
||||
if(chooseDayRef.value){
|
||||
if (chooseDayRef.value) {
|
||||
chooseDayRef.value.clearData()
|
||||
}
|
||||
})
|
||||
@@ -134,13 +143,13 @@ const handleOpenChart = (id, type) => {
|
||||
openDialogId.value = id.equipmentId
|
||||
getChartInfo(id.equipmentId, 'day')
|
||||
} else {
|
||||
if (id === 11) {
|
||||
if (id === "windDirection") {
|
||||
dialogTitle.value = '风向'
|
||||
} else {
|
||||
dialogTitle.value = '风速'
|
||||
}
|
||||
openDialogId.value = id
|
||||
getChartInfo(id, 'day')
|
||||
openDialogId.value = type
|
||||
getChartInfo(type, 'day')
|
||||
}
|
||||
|
||||
}
|
||||
@@ -188,9 +197,11 @@ const getAirInfo = (now) => {
|
||||
airObj = changeData(item)
|
||||
airArr.push(airObj)
|
||||
} else if (item.equipmentType === "windSpeed") {
|
||||
windSpeedType.value = item.equipmentType
|
||||
windSpeedId.value = item.equipmentId
|
||||
windSpeed.value = item.value
|
||||
} else if (item.equipmentType === "windDirection") {
|
||||
windDirectionSpeedType.value = item.equipmentType
|
||||
windDirectionSpeedId.value = item.equipmentId
|
||||
windDirection.value = item.value
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<template>
|
||||
<div id="used-ele" :style="{ backgroundColor: bgImage }" @click="handleOpenChart">
|
||||
<div class="content">
|
||||
<div v-if="electricityConsumptionMonthly===0||monthlySavings===0" class="showNull ">
|
||||
<div class="loading" v-if="loading===0"></div>
|
||||
{{ loading === 0 ? '加载中...' : '暂无数据~' }}
|
||||
</div>
|
||||
<div v-else class="content">
|
||||
<div class="item">
|
||||
<div class="container" ref="length">
|
||||
<div class="value" ref="valueA"></div>
|
||||
@@ -23,6 +27,7 @@
|
||||
<div class="ele-right-bottom-icon"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="digital-tunnel">
|
||||
<el-dialog :close-on-click-modal="false" v-model="isVisited" width="2175px" :modal="false">
|
||||
<div class="left-top-icon"></div>
|
||||
@@ -88,7 +93,8 @@ import {getEleEchartsInfo} from "@/api/largeScreen";
|
||||
|
||||
const props = defineProps({
|
||||
list: Array,
|
||||
eleData: Array
|
||||
eleData: Array,
|
||||
loading: Number
|
||||
});
|
||||
|
||||
const loadingText = ref('加载中...')
|
||||
@@ -114,6 +120,9 @@ const bgImage = computed(() =>
|
||||
? "#2E5589"
|
||||
: "rgba(6,34,71,0.78)"
|
||||
);
|
||||
watch(() => props.loading, (now) => {
|
||||
props.loading = now
|
||||
}, {deep: true});
|
||||
watch(() => props.eleData, (now) => {
|
||||
if (now) {
|
||||
let fanObj = {}
|
||||
@@ -128,8 +137,10 @@ watch(() => props.eleData, (now) => {
|
||||
})
|
||||
getBasicData(now.largeScreenElectricity)
|
||||
}
|
||||
setValueA()
|
||||
setValueB()
|
||||
nextTick(() => {
|
||||
setValueA()
|
||||
setValueB()
|
||||
})
|
||||
}, {deep: true});
|
||||
// watch(() => props.list, (now) => {
|
||||
// console.log(now,props.eleData,'大V大V')
|
||||
|
||||
Reference in New Issue
Block a user