fix : 修复数据loading加载

This commit is contained in:
2024-03-05 21:47:53 +08:00
parent c242691a65
commit 204d687336
8 changed files with 109 additions and 47 deletions

View File

@@ -145,6 +145,7 @@ import {editSite, getSiteDetail, getSiteList, addSite, deleteSite} from "@/api/s
import {ElMessage, ElMessageBox} from "element-plus";
import TunnelTitle from "@/components/tunnelTitle/index.vue";
import {getToken} from '@/utils/auth'
import {ElLoading} from 'element-plus'
const router = useRouter()
const userId = reactive(router.currentRoute.value.params.userId)
@@ -201,28 +202,36 @@ const handleGoHome = () => {
router.push('/' + 'siteToHome/' + siteId)
}
const getList = () => {
const loading = ElLoading.service({
lock: true,
text: '正在加载系统资源',
background: 'rgba(0, 0, 0, 0.7)',
})
getSiteList({
userId: userId,
...pageInfo
}).then((res) => {
total.value = res.data.total;
if (total.value == 0) {
if (res.code === 1000) {
loading.close()
total.value = res.data.total;
if (total.value == 0) {
} else {
showAddIcon.value = total.value % 6 !== 0;
}
showFirst.value = total.value / pageInfo.pageSize > 1;
res.data.rows.map(item => {
if (item.tunnelList === null || item.tunnelList.length === 0) {
item.info = info.value
} else {
item.info = item.tunnelList[0]
showAddIcon.value = total.value % 6 !== 0;
}
item.checked = false
})
siteList.value = res.data.rows;
showFirst.value = total.value / pageInfo.pageSize > 1;
res.data.rows.map(item => {
if (item.tunnelList === null || item.tunnelList.length === 0) {
item.info = info.value
} else {
item.info = item.tunnelList[0]
}
item.checked = false
})
siteList.value = res.data.rows;
}
});
}
getList()
const handleClickSite = (type) => {
@@ -786,8 +795,9 @@ const handleCurrentChange = (val) => {
color: #60DDDE;
font-size: 38px;
font-weight: bold;
:deep(.el-pagination.is-background ) {
.btn-next,.btn-prev {
.btn-next, .btn-prev {
background-color: transparent;
}