Merge pull request 'fix : 修复数据loading加载' (#310) from dengjie into dev
Reviewed-on: http://git.feashow.cn/clay/tunnel-cloud-web/pulls/310
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<div id="used-ele" :style="{ backgroundColor: bgImage }" @click="handleOpenChart">
|
||||
<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 v-if="electricityConsumptionMonthly===0&&monthlySavings===0" class="showNull ">-->
|
||||
<!-- <div class="loading" v-if="loading===0"></div>-->
|
||||
<!-- {{ loading === 0 ? '加载中...' : '暂无数据~' }}-->
|
||||
<!-- </div>-->
|
||||
<div class="content">
|
||||
<div class="item">
|
||||
<div class="container" ref="length">
|
||||
<div class="value" ref="valueA"></div>
|
||||
@@ -120,9 +120,9 @@ const bgImage = computed(() =>
|
||||
? "#2E5589"
|
||||
: "rgba(6,34,71,0.78)"
|
||||
);
|
||||
watch(() => props.loading, (now) => {
|
||||
props.loading = now
|
||||
}, {deep: true});
|
||||
// watch(() => props.loading, (now) => {
|
||||
// props.loading = now
|
||||
// }, {deep: true});
|
||||
watch(() => props.eleData, (now) => {
|
||||
if (now) {
|
||||
let fanObj = {}
|
||||
|
||||
@@ -210,7 +210,7 @@ const routeList = ref([]);
|
||||
let socket = reactive("");
|
||||
let pattern = reactive(new RegExp("[A-Za-z]+"));
|
||||
let isTunnel = reactive(false)
|
||||
const equipmentOption = ref([])
|
||||
// const equipmentOption = ref([])
|
||||
const btnList = ref([
|
||||
{
|
||||
route: '/site',
|
||||
@@ -370,9 +370,7 @@ const getOtherInfo = () => {
|
||||
routeList.value = routeArr
|
||||
showMenu.value = true
|
||||
siteList.value = res.data.siteOption
|
||||
if (!siteId) {
|
||||
tunnelList.value = res.data.tunnelOption
|
||||
}
|
||||
|
||||
if (siteId) {
|
||||
currentSiteId.value = siteId
|
||||
@@ -395,50 +393,30 @@ const getOtherInfo = () => {
|
||||
const getScreenInfo = (id) => {
|
||||
if (id) {
|
||||
tunnelId.value = id
|
||||
equipmentOption.value = []
|
||||
// equipmentOption.value = []
|
||||
getLargeScreen(id).then((res) => {
|
||||
if (res?.code === 1000) {
|
||||
let option = {}
|
||||
if (res.data.frequencyChangerList.length !== 0) {
|
||||
res.data.frequencyChangerList.forEach((item) => {
|
||||
option = {
|
||||
value: item.equipmentId,
|
||||
label: item.equipmentName,
|
||||
}
|
||||
equipmentOption.value.push(option)
|
||||
})
|
||||
showFanLoading.value = 0
|
||||
} else {
|
||||
showFanLoading.value = 1
|
||||
}
|
||||
const useEleData=res.data.largeScreenElectricity
|
||||
if(useEleData.electricityConsumptionCount==null||useEleData.monthlySavings==null){
|
||||
showUsedLoading.value = 0
|
||||
}else {
|
||||
showUsedLoading.value = 1
|
||||
}
|
||||
if (res.data.windPressureSensorList.length !== 0) {
|
||||
res.data.windPressureSensorList.forEach((item) => {
|
||||
option = {
|
||||
value: item.equipmentId,
|
||||
label: item.equipmentName,
|
||||
}
|
||||
equipmentOption.value.push(option)
|
||||
})
|
||||
showWindLoading.value = 0
|
||||
} else {
|
||||
showWindLoading.value = 1
|
||||
}
|
||||
if (res.data.sensorList.length !== 0) {
|
||||
res.data.sensorList.forEach((item) => {
|
||||
option = {
|
||||
value: item.equipmentId,
|
||||
label: item.equipmentName,
|
||||
}
|
||||
equipmentOption.value.push(option)
|
||||
})
|
||||
// res.data.sensorList.forEach((item) => {
|
||||
// option = {
|
||||
// value: item.equipmentId,
|
||||
// label: item.equipmentName,
|
||||
// }
|
||||
// equipmentOption.value.push(option)
|
||||
// })
|
||||
res.data.sensorList.forEach((item) => {
|
||||
if (
|
||||
item.equipmentType === "dust" ||
|
||||
item.equipmentType === "carbonDioxide" ||
|
||||
item.equipmentType === "carbonMonoxide" ||
|
||||
item.equipmentType === "hydrogenSulfide" ||
|
||||
@@ -455,7 +433,6 @@ const getScreenInfo = (id) => {
|
||||
showBadLoading.value = 1
|
||||
}
|
||||
largeScreenData.value = res.data;
|
||||
// console.log(largeScreenData.value);
|
||||
} else {
|
||||
ElMessage.warning(res.msg)
|
||||
}
|
||||
@@ -494,19 +471,18 @@ const getTunnel = (id) => {
|
||||
} else {
|
||||
ElMessage.warning('该站点下没有隧道, 请新增隧道后再试!')
|
||||
}
|
||||
tunnelList.value = []
|
||||
} else {
|
||||
if (!pattern.test(previewId)) {
|
||||
getScreenInfo(previewId)
|
||||
tunnelList.value.forEach((item, index) => {
|
||||
if (item.value == previewId) {
|
||||
initialIndex.value = index
|
||||
tunnelBtn.value.setActiveItem(index)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
getScreenInfo(res.data[0]?.value)
|
||||
}
|
||||
tunnelList.value = res.data
|
||||
tunnelList.value.forEach((item, index) => {
|
||||
if (item.value == previewId) {
|
||||
initialIndex.value = index
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -518,19 +494,18 @@ const changeTunnel = (e) => {
|
||||
newObj = item
|
||||
}
|
||||
})
|
||||
showFan.value = false
|
||||
showBadLoading.value = 0
|
||||
showWindLoading.value = 0
|
||||
showFanLoading.value = 0
|
||||
showUsedLoading.value = 0
|
||||
// showUsedLoading.value = 0
|
||||
pageInfo.pageNum = 1
|
||||
getScreenInfo(newObj.value)
|
||||
showFan.value = false
|
||||
nextTick(() => {
|
||||
showFan.value = true;
|
||||
});
|
||||
}
|
||||
const manageSelect = (index) => {
|
||||
console.log("首页点击-", index);
|
||||
if (index === '站点管理') {
|
||||
if (currentUserId.value) {
|
||||
router.push("/site/" + currentUserId.value + '/' + currentSiteId.value);
|
||||
|
||||
Reference in New Issue
Block a user