| | |
| | | } from '../rolePage.helpers' |
| | | import { fetchGetRoleScopeList, fetchGetRoleScopeTree, fetchUpdateRoleScope } from '@/api/system-manage' |
| | | import { resolveBackendMenuTitle } from '@/utils/backend-menu-title' |
| | | import { guardRequestWithMessage } from '@/utils/sys/requestGuard' |
| | | import { ElMessage } from 'element-plus' |
| | | |
| | | const props = defineProps({ |
| | |
| | | requests.unshift(fetchGetRoleScopeList(config.scopeType, props.roleData.id)) |
| | | } |
| | | |
| | | const [checkedIds, treeData] = reloadSelection ? await Promise.all(requests) : [state.checkedKeys, await requests[0]] |
| | | const guardedResult = await guardRequestWithMessage( |
| | | reloadSelection ? Promise.all(requests) : Promise.resolve([state.checkedKeys, await requests[0]]), |
| | | null, |
| | | { |
| | | timeoutMessage: `${config.title}加载超时,已停止等待` |
| | | } |
| | | ) |
| | | if (!guardedResult) { |
| | | state.treeData = [] |
| | | state.checkedKeys = [] |
| | | state.halfCheckedKeys = [] |
| | | state.loaded = true |
| | | return |
| | | } |
| | | const [checkedIds, treeData] = guardedResult |
| | | state.treeData = normalizeRoleScopeTreeData(config.scopeType, treeData) |
| | | state.checkedKeys = normalizeScopeKeys(checkedIds) |
| | | state.halfCheckedKeys = [] |