邓洁: 切换隧道,数据渲染

This commit is contained in:
邓洁
2023-12-18 13:32:11 +08:00
parent 8304eaa726
commit d883e56771
3 changed files with 43 additions and 38 deletions

View File

@@ -7,7 +7,6 @@
<div class="output-fan"><span>出风{{ windSpeed }}m/s</span></div> <div class="output-fan"><span>出风{{ windSpeed }}m/s</span></div>
</div> </div>
</div> </div>
<div v-if="airList.length!==0">
<item-info <item-info
v-for="item in airList" v-for="item in airList"
:key="item.equipmentId" :key="item.equipmentId"
@@ -17,7 +16,6 @@
:unit="item.unit" :unit="item.unit"
@click="handleOpenAirChart(item)" @click="handleOpenAirChart(item)"
/> />
</div>
<div class="digital-tunnel"> <div class="digital-tunnel">
<el-dialog v-model="isWindSpeedVisited" :title="'风速监控数据'" width="2175px" :modal="false"> <el-dialog v-model="isWindSpeedVisited" :title="'风速监控数据'" width="2175px" :modal="false">
<div class="left-top-icon"></div> <div class="left-top-icon"></div>
@@ -64,6 +62,7 @@
import ItemInfo from "./childComps/ItemInfo.vue"; import ItemInfo from "./childComps/ItemInfo.vue";
import TimeRangeBtn from "@/components/timeRangeBtn/index.vue" import TimeRangeBtn from "@/components/timeRangeBtn/index.vue"
import * as echarts from 'echarts'; import * as echarts from 'echarts';
let myEcharts = reactive({}); let myEcharts = reactive({});
let myAirEcharts = reactive({}); let myAirEcharts = reactive({});
const props = defineProps({ const props = defineProps({
@@ -78,7 +77,7 @@ const selectTimeButton = ref(2);
const isWindSpeedVisited = ref(false); const isWindSpeedVisited = ref(false);
const isAirVisited = ref(false); const isAirVisited = ref(false);
watch(() => props.list, (now) => { watch(() => props.list, (now) => {
airList.value.forEach(item=>{ airList.value?.forEach(item => {
now.forEach(newItem => { now.forEach(newItem => {
if (item.equipmentId === newItem.equipmentId) { if (item.equipmentId === newItem.equipmentId) {
item.value = newItem.value item.value = newItem.value
@@ -87,7 +86,11 @@ watch(() => props.list, (now) => {
}) })
}, {deep: true}); }, {deep: true});
watch(() => props.airData, (now) => { watch(() => props.airData, (now) => {
if(now.sensorList===null){
airList.value=[]
}else {
getAirInfo(now.sensorList) getAirInfo(now.sensorList)
}
}, {deep: true}); }, {deep: true});
const handleOpenChart = () => { const handleOpenChart = () => {
isWindSpeedVisited.value = true isWindSpeedVisited.value = true
@@ -136,6 +139,7 @@ const changeIcon = (type) => {
} }
} }
const getAirInfo = (now) => { const getAirInfo = (now) => {
if (now === null) return;
let airObj = {} let airObj = {}
let airArr = [] let airArr = []
now?.map(item => { now?.map(item => {

View File

@@ -58,7 +58,7 @@ const bgImage = computed(() => (isVisited.value ? "sp_active.png" : "bg.png"));
watch( watch(
() => props.list, () => props.list,
(now) => { (now) => {
badGasList.value.forEach((item) => { badGasList.value?.forEach((item) => {
now.forEach((newItem) => { now.forEach((newItem) => {
if (item.equipmentId === newItem.equipmentId) { if (item.equipmentId === newItem.equipmentId) {
item.value = newItem.value; item.value = newItem.value;
@@ -72,7 +72,11 @@ watch(
watch( watch(
() => props.badGasData, () => props.badGasData,
(now) => { (now) => {
if(now.sensorList===null){
badGasList.value=[]
}else {
getBadGasInfo(now.sensorList); getBadGasInfo(now.sensorList);
}
}, },
{ deep: true } { deep: true }
); );
@@ -87,6 +91,7 @@ const timeSelect = (index) => {
} }
}; };
const getBadGasInfo = (now) => { const getBadGasInfo = (now) => {
if(now===null)return;
let windPressureObj = {}; let windPressureObj = {};
let windPressureArr = []; let windPressureArr = [];
now?.map((item) => { now?.map((item) => {

View File

@@ -82,13 +82,6 @@ watch(() => props.list, (now) => {
handleOnMounted() handleOnMounted()
}, {deep: true}); }, {deep: true});
onMounted(() => {
setTimeout(() => {
nextTick(() => {
handleOnMounted()
})
}, 100);
});
const getImage = (type) => { const getImage = (type) => {
switch (type) { switch (type) {
case false: case false:
@@ -121,6 +114,9 @@ const getBasicData = (data) => {
tranArr.push(tranObj) tranArr.push(tranObj)
}) })
socketData.value = tranArr socketData.value = tranArr
nextTick(() => {
handleOnMounted()
})
} }
const handleOnMounted = () => { const handleOnMounted = () => {