!492 解决XTable接口报错时loading不消失等一些问题

Merge pull request !492 from clockdotnet/master-vxe
pull/497/MERGE
芋道源码 2024-08-08 05:05:30 +00:00 committed by Gitee
commit c5fba310a2
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 43 additions and 19 deletions

View File

@ -160,26 +160,42 @@ const getProxyConfig = (options: XTableProps) => {
queryParams.pageSize = page.pageSize queryParams.pageSize = page.pageSize
queryParams.pageNo = page.currentPage queryParams.pageNo = page.currentPage
} }
return new Promise(async (resolve) => { return new Promise(async (resolve, reject) => {
resolve(await getListApi(queryParams)) try {
resolve(await getListApi(queryParams))
} catch (e) {
reject(e)
}
}) })
}, },
delete: ({ body }) => { delete: ({ body }) => {
return new Promise(async (resolve) => { return new Promise(async (resolve, reject) => {
if (options.deleteApi) { if (options.deleteApi) {
resolve(await options.deleteApi(JSON.stringify(body))) try {
resolve(await options.deleteApi(JSON.stringify(body)))
} catch (e) {
reject(e)
}
} else { } else {
Promise.reject('未设置deleteApi') reject('未设置deleteApi')
} }
}) })
}, },
queryAll: ({ form }) => { queryAll: ({ form }) => {
const queryParams = Object.assign({}, JSON.parse(JSON.stringify(form))) const queryParams = Object.assign({}, JSON.parse(JSON.stringify(form)))
return new Promise(async (resolve) => { return new Promise(async (resolve, reject) => {
if (options.getAllListApi) { if (options.getAllListApi) {
resolve(await options.getAllListApi(queryParams)) try {
resolve(await options.getAllListApi(queryParams))
} catch (e) {
reject(e)
}
} else { } else {
resolve(await getListApi(queryParams)) try {
resolve(await getListApi(queryParams))
} catch (e) {
reject(e)
}
} }
}) })
} }
@ -196,8 +212,12 @@ const getProxyConfig = (options: XTableProps) => {
if (options?.params) { if (options?.params) {
queryParams = Object.assign(queryParams, options.params) queryParams = Object.assign(queryParams, options.params)
} }
return new Promise(async (resolve) => { return new Promise(async (resolve, reject) => {
resolve(await getListApi(queryParams)) try {
resolve(await getListApi(queryParams))
} catch (e) {
reject(e)
}
}) })
} }
} }

View File

@ -65,17 +65,17 @@ const toDocument = () => {
</div> </div>
<template #dropdown> <template #dropdown>
<ElDropdownMenu> <ElDropdownMenu>
<ElDropdownItem> <ElDropdownItem @click="toProfile">
<Icon icon="ep:tools" /> <Icon icon="ep:tools" />
<div @click="toProfile">{{ t('common.profile') }}</div> <div>{{ t('common.profile') }}</div>
</ElDropdownItem> </ElDropdownItem>
<ElDropdownItem> <ElDropdownItem @click="toDocument">
<Icon icon="ep:menu" /> <Icon icon="ep:menu" />
<div @click="toDocument">{{ t('common.document') }}</div> <div>{{ t('common.document') }}</div>
</ElDropdownItem> </ElDropdownItem>
<ElDropdownItem divided> <ElDropdownItem divided @click="lockScreen">
<Icon icon="ep:lock" /> <Icon icon="ep:lock" />
<div @click="lockScreen">{{ t('lock.lockScreen') }}</div> <div>{{ t('lock.lockScreen') }}</div>
</ElDropdownItem> </ElDropdownItem>
<ElDropdownItem divided @click="loginOut"> <ElDropdownItem divided @click="loginOut">
<Icon icon="ep:switch-button" /> <Icon icon="ep:switch-button" />

View File

@ -53,9 +53,9 @@ async function goLogin() {
// //
deleteUserCache() // deleteUserCache() //
tagsViewStore.delAllViews() tagsViewStore.delAllViews()
resetRouter() // // resetRouter() //
lockStore.resetLockInfo() lockStore.resetLockInfo()
replace('/login') replace('/login?redirect=/index')
} }
function handleShowForm(show = false) { function handleShowForm(show = false) {

View File

@ -69,7 +69,11 @@ router.beforeEach(async (to, from, next) => {
const userStore = useUserStoreWithOut() const userStore = useUserStoreWithOut()
const permissionStore = usePermissionStoreWithOut() const permissionStore = usePermissionStoreWithOut()
if (!dictStore.getIsSetDict) { if (!dictStore.getIsSetDict) {
await dictStore.setDictMap() try {
await dictStore.setDictMap()
} catch (e) {
console.log(e)
}
} }
if (!userStore.getIsSetUser) { if (!userStore.getIsSetUser) {
isRelogin.show = true isRelogin.show = true