fix : 修复数据loading加载

This commit is contained in:
2024-03-05 23:49:02 +08:00
parent 3b42035892
commit d16779bd3f
2 changed files with 26 additions and 51 deletions

View File

@@ -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);