fix : 修复数据loading加载

This commit is contained in:
2024-03-05 22:59:09 +08:00
parent 4ec7558a31
commit 3b42035892
9 changed files with 57 additions and 22 deletions

View File

@@ -18,6 +18,19 @@
body { body {
background-color: #f5f5f5; background-color: #f5f5f5;
} }
.allLoading.el-loading-mask.is-fullscreen{
.el-loading-spinner{
.circular{
width: 75px;
height: 75px;
}
.el-loading-text{
font-size: 26px;
letter-spacing: 2px;
}
}
}
.el-container { .el-container {
height: 100%; height: 100%;

View File

@@ -1,6 +1,6 @@
<template> <template>
<div id="used-ele" :style="{ backgroundColor: bgImage }" @click="handleOpenChart"> <div id="used-ele" :style="{ backgroundColor: bgImage }" @click="handleOpenChart">
<div v-if="electricityConsumptionMonthly===0||monthlySavings===0" class="showNull "> <div v-if="electricityConsumptionMonthly===0&&monthlySavings===0" class="showNull ">
<div class="loading" v-if="loading===0"></div> <div class="loading" v-if="loading===0"></div>
{{ loading === 0 ? '加载中...' : '暂无数据~' }} {{ loading === 0 ? '加载中...' : '暂无数据~' }}
</div> </div>

View File

@@ -364,12 +364,12 @@ const handleChangeMenu = (e) => {
const getList = () => { const getList = () => {
const loading = ElLoading.service({ const loading = ElLoading.service({
lock: true, lock: true,
text: '正在加载系统资源', text: '正在加载系统资源...',
background: 'rgba(0, 0, 0, 0.7)', background: 'rgba(0, 0, 0, 0.7)',
customClass:'allLoading'
}) })
getEquipmentList(tunnelId).then(res => { getEquipmentList(tunnelId).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
loading.close()
fanData.value = res.data.frequencyChangerList fanData.value = res.data.frequencyChangerList
res.data.windPressureSensorList.forEach(item => { res.data.windPressureSensorList.forEach(item => {
item.offset = item.offset + 4000 item.offset = item.offset + 4000
@@ -390,6 +390,7 @@ const getList = () => {
} }
}) })
} }
loading.close()
}) })
} }
const getTunnel = () => { const getTunnel = () => {

View File

@@ -99,14 +99,15 @@ const form = ref({
const getTunnel = () => { const getTunnel = () => {
const loading = ElLoading.service({ const loading = ElLoading.service({
lock: true, lock: true,
text: '正在加载系统资源', text: '正在加载系统资源...',
background: 'rgba(0, 0, 0, 0.7)', background: 'rgba(0, 0, 0, 0.7)',
customClass:'allLoading'
}) })
getTunnelDetail(tunnelId).then((res) => { getTunnelDetail(tunnelId).then((res) => {
if (res?.code === 1000) { if (res?.code === 1000) {
loading.close()
form.value = res.data; form.value = res.data;
} }
loading.close()
}); });
}; };
getTunnel(); getTunnel();

View File

@@ -76,10 +76,11 @@ const handleLogin = (instance) => {
await authStore.userLogin(loginForm).then((res) => { await authStore.userLogin(loginForm).then((res) => {
if (res) { if (res) {
ElLoading.service({ ElLoading.service({
text: "正在加载系统资源",
background: "#409eff",
lock: true, lock: true,
}); text: '登录中...',
background: 'rgba(0, 0, 0, 0.7)',
customClass:'allLoading'
})
router.push("/"); router.push("/");
} else { } else {
getCode(); getCode();
@@ -89,14 +90,14 @@ const handleLogin = (instance) => {
}; };
getCode(); getCode();
onBeforeUnmount(() => { onBeforeUnmount(() => {
ElLoading.service({ ElLoading.service({
text: "正在加载系统资源",
background: "#409eff",
lock: true, lock: true,
}).close(); text: '登录中...',
}); background: 'rgba(0, 0, 0, 0.7)',
customClass:'allLoading'
}).close()
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@@ -204,15 +204,15 @@ const handleGoHome = () => {
const getList = () => { const getList = () => {
const loading = ElLoading.service({ const loading = ElLoading.service({
lock: true, lock: true,
text: '正在加载系统资源', text: '正在加载系统资源...',
background: 'rgba(0, 0, 0, 0.7)', background: 'rgba(0, 0, 0, 0.7)',
customClass:'allLoading'
}) })
getSiteList({ getSiteList({
userId: userId, userId: userId,
...pageInfo ...pageInfo
}).then((res) => { }).then((res) => {
if (res.code === 1000) { if (res.code === 1000) {
loading.close()
total.value = res.data.total; total.value = res.data.total;
if (total.value == 0) { if (total.value == 0) {
@@ -230,8 +230,8 @@ const getList = () => {
}) })
siteList.value = res.data.rows; siteList.value = res.data.rows;
} }
loading.close()
}); });
} }
getList() getList()
const handleClickSite = (type) => { const handleClickSite = (type) => {
@@ -268,10 +268,17 @@ const restFrom = () => {
const handleEdit = (item) => { const handleEdit = (item) => {
title.value = '编辑站点' title.value = '编辑站点'
restFrom() restFrom()
const loading = ElLoading.service({
lock: true,
text: '正在加载系统资源...',
background: 'rgba(0, 0, 0, 0.7)',
customClass:'allLoading'
})
getSiteDetail(item.siteId).then((res) => { getSiteDetail(item.siteId).then((res) => {
form.value = res.data; form.value = res.data;
form.value = item; form.value = item;
isVisited.value = true isVisited.value = true
loading.close()
}); });
} }
const handleUpload = (siteId) => { const handleUpload = (siteId) => {

View File

@@ -325,15 +325,15 @@ getTunnel(siteId)
const getList = () => { const getList = () => {
const loading = ElLoading.service({ const loading = ElLoading.service({
lock: true, lock: true,
text: '正在加载系统资源', text: '正在加载系统资源...',
background: 'rgba(0, 0, 0, 0.7)', background: 'rgba(0, 0, 0, 0.7)',
customClass:'allLoading'
}) })
getTunnelList({ getTunnelList({
siteId: siteId, siteId: siteId,
...pageInfo ...pageInfo
}).then(res => { }).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
loading.close()
total.value = res.data.total total.value = res.data.total
tunnelList.value = res.data.rows tunnelList.value = res.data.rows
showFirst.value = total.value / pageInfo.pageSize >= 1; showFirst.value = total.value / pageInfo.pageSize >= 1;
@@ -341,6 +341,7 @@ const getList = () => {
} else { } else {
ElMessage.warning(res.msg) ElMessage.warning(res.msg)
} }
loading.close()
}) })
} }
getList() getList()

View File

@@ -521,8 +521,10 @@ const changeTunnel = (e) => {
showBadLoading.value = 0 showBadLoading.value = 0
showWindLoading.value = 0 showWindLoading.value = 0
showFanLoading.value = 0 showFanLoading.value = 0
showUsedLoading.value = 0
pageInfo.pageNum = 1 pageInfo.pageNum = 1
getScreenInfo(newObj.value) getScreenInfo(newObj.value)
showFan.value = false
nextTick(() => { nextTick(() => {
showFan.value = true; showFan.value = true;
}); });

View File

@@ -214,16 +214,24 @@ const handleAddUser = () => {
} }
const handleEditUser = (row) => { const handleEditUser = (row) => {
reset() reset()
const loading = ElLoading.service({
lock: true,
text: '正在加载系统资源...',
background: 'rgba(0, 0, 0, 0.7)',
customClass:'allLoading'
})
getUserDetail(row.userId).then(res => { getUserDetail(row.userId).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
getTunnel() getTunnel()
form.value = res.data.user form.value = res.data.user
form.value.roleId = res.data.roleIds[0] form.value.roleId = res.data.roleIds[0]
form.value.tunnelList = res.data.user.tunnelList form.value.tunnelList = res.data.user.tunnelList
title.value = '修改用户'
isVisited.value = true
} }
loading.close()
}) })
title.value = '修改用户'
isVisited.value = true
} }
const handleDelete = () => { const handleDelete = () => {
@@ -266,8 +274,9 @@ getRoleOptionInfo()
const getInfo = () => { const getInfo = () => {
const loading = ElLoading.service({ const loading = ElLoading.service({
lock: true, lock: true,
text: '正在加载系统资源', text: '正在加载系统资源...',
background: 'rgba(0, 0, 0, 0.7)', background: 'rgba(0, 0, 0, 0.7)',
customClass:'allLoading'
}) })
getUser({ getUser({
siteId: siteId, siteId: siteId,
@@ -275,11 +284,11 @@ const getInfo = () => {
...pageInfo ...pageInfo
}).then(res => { }).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
loading.close()
userData.value = res.data.rows userData.value = res.data.rows
total.value = res.data.total total.value = res.data.total
showFirst.value = total.value / pageInfo.pageSize >= 1; showFirst.value = total.value / pageInfo.pageSize >= 1;
} }
loading.close()
}) })
} }
getInfo() getInfo()