fix(全局): 切换组织、登录问题修复
This commit is contained in:
parent
e9009168dd
commit
28db5873ad
|
@ -12,15 +12,15 @@
|
|||
import { getOrgOptions, switchUserOrg } from '@/api/modules/system';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import useUser from '@/hooks/useUser';
|
||||
import { BOTTOM_MENU_LIST, NO_PROJECT_ROUTE_NAME } from '@/router/constants';
|
||||
import { BOTTOM_MENU_LIST } from '@/router/constants';
|
||||
import { useAppStore, useUserStore } from '@/store';
|
||||
import useLicenseStore from '@/store/modules/setting/license';
|
||||
import { openWindow, regexUrl } from '@/utils';
|
||||
import { scrollIntoView } from '@/utils/dom';
|
||||
import { getFirstRouterNameByCurrentRoute } from '@/utils/permission';
|
||||
import { getFirstRouteNameByPermission, getFirstRouterNameByCurrentRoute } from '@/utils/permission';
|
||||
import { listenerRouteChange } from '@/utils/route-listener';
|
||||
|
||||
import { ProjectManagementRouteEnum, SettingRouteEnum } from '@/enums/routeEnum';
|
||||
import { SettingRouteEnum } from '@/enums/routeEnum';
|
||||
|
||||
import useMenuTree from './use-menu-tree';
|
||||
import type { RouteMeta } from 'vue-router';
|
||||
|
@ -147,38 +147,15 @@
|
|||
Message.success(t('personal.switchOrgSuccess'));
|
||||
personalMenusVisible.value = false;
|
||||
orgKeyword.value = '';
|
||||
await userStore.isLogin(true);
|
||||
if (
|
||||
(!appStore.currentProjectId || appStore.currentProjectId === 'no_such_project') &&
|
||||
!(route.name as string).startsWith(SettingRouteEnum.SETTING)
|
||||
) {
|
||||
// 没有项目权限(组织没有项目, 或项目全被禁用)且访问的页面非系统菜单模块,则重定向到无项目权限页面
|
||||
router.push({
|
||||
name: NO_PROJECT_ROUTE_NAME,
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (route.name === NO_PROJECT_ROUTE_NAME) {
|
||||
// 无项目权限组织切换到正常组织, 默认跳转到项目基本信息页面
|
||||
router.replace({
|
||||
name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_PERMISSION_BASIC_INFO,
|
||||
query: {
|
||||
...route.query,
|
||||
orgId: appStore.currentOrgId,
|
||||
pId: appStore.currentProjectId,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
// 正常切换组织
|
||||
router.replace({
|
||||
path: route.path,
|
||||
query: {
|
||||
...route.query,
|
||||
orgId: appStore.currentOrgId,
|
||||
pId: appStore.currentProjectId,
|
||||
},
|
||||
});
|
||||
}
|
||||
await userStore.checkIsLogin();
|
||||
appStore.hideLoading();
|
||||
router.replace({
|
||||
name: getFirstRouteNameByPermission(router.getRoutes()),
|
||||
query: {
|
||||
orgId: appStore.currentOrgId,
|
||||
pId: appStore.currentProjectId,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<a-button type="primary" :disabled="props.disabled" class="save-btn bottom-[30px] right-[30px]" @click="save">
|
||||
{{ t('minder.main.main.save') }}
|
||||
</a-button>
|
||||
<navigator />
|
||||
<Navigator />
|
||||
<a-dropdown
|
||||
v-model:popup-visible="menuVisible"
|
||||
class="minder-dropdown"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { TableQueryParams } from '@/models/common';
|
||||
import { type MoveMode, TableQueryParams } from '@/models/common';
|
||||
import { StatusType } from '@/enums/caseEnum';
|
||||
|
||||
import { ReviewResult } from './caseReview';
|
||||
|
@ -369,14 +369,18 @@ export interface FeatureCaseMinderDeleteResourceList {
|
|||
id: string;
|
||||
type: string;
|
||||
}
|
||||
// 脑图用例操作类型(新增(ADD)/更新(UPDATE))
|
||||
export type FeatureCaseMinderActionType = 'ADD' | 'UPDATE';
|
||||
// 脑图用例编辑模式
|
||||
export type FeatureCaseMinderEditType = 'STEP' | 'TEXT';
|
||||
// 脑图新增/修改的模块集合(只记录操作的节点,节点下的子节点不需要记录)
|
||||
export interface FeatureCaseMinderUpdateModuleList {
|
||||
id: string;
|
||||
name: string;
|
||||
parentId: string;
|
||||
type: 'ADD' | 'UPDATE'; // 操作类型(新增(ADD)/更新(UPDATE))
|
||||
moveMode: string;
|
||||
targetId: string;
|
||||
type: FeatureCaseMinderActionType;
|
||||
moveMode?: MoveMode;
|
||||
targetId?: string;
|
||||
}
|
||||
|
||||
export interface CustomField {
|
||||
|
@ -389,23 +393,21 @@ export interface FeatureCaseMinderStepItem {
|
|||
num: number;
|
||||
desc: string;
|
||||
result?: string;
|
||||
actualResult?: string;
|
||||
executeResult?: string;
|
||||
}
|
||||
// 脑图新增/修改的用例对象集合
|
||||
export interface FeatureCaseMinderUpdateCaseList {
|
||||
id: string;
|
||||
id: string; // 用例id(新增的时候前端传UUid,更新的时候必填)
|
||||
templateId: string; // 模板id
|
||||
type: string;
|
||||
type: FeatureCaseMinderActionType;
|
||||
name: string;
|
||||
moduleId: string;
|
||||
moveMode?: string;
|
||||
moveMode?: MoveMode; // 移动方式(节点移动或新增时需要)
|
||||
targetId?: string;
|
||||
prerequisite: string;
|
||||
caseEditType: 'STEP' | 'TEXT'; // 编辑模式
|
||||
steps: string;
|
||||
textDescription: string;
|
||||
expectedResult: string;
|
||||
caseEditType: FeatureCaseMinderEditType;
|
||||
steps: FeatureCaseMinderStepItem[];
|
||||
textDescription: string; // 文本描述
|
||||
expectedResult: string; // 期望结果
|
||||
description: string;
|
||||
tags: string[];
|
||||
customFields: CustomField[];
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { onBeforeMount, Ref, ref } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import NoPermissionLayoutVue from '@/layout/no-permission-layout.vue';
|
||||
|
||||
|
@ -43,7 +43,6 @@
|
|||
|
||||
const userStore = useUserStore();
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
|
||||
|
@ -72,12 +71,13 @@
|
|||
// eslint-disable-next-line no-console
|
||||
console.log(error);
|
||||
} finally {
|
||||
await userStore.checkIsLogin();
|
||||
appStore.hideLoading();
|
||||
router.replace({
|
||||
name: getFirstRouteNameByPermission(router.getRoutes()),
|
||||
query: {
|
||||
...route.query,
|
||||
orgId: appStore.currentOrgId,
|
||||
pId: appStore.currentProjectId,
|
||||
pId: value as string,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
@ -179,7 +179,7 @@
|
|||
loginConfig.value.password = rememberPassword ? password : '';
|
||||
if (
|
||||
(!appStore.currentProjectId || appStore.currentProjectId === 'no_such_project') &&
|
||||
!(router.currentRoute.value as unknown as string).startsWith(SettingRouteEnum.SETTING)
|
||||
!router.currentRoute.value.path.startsWith(SettingRouteEnum.SETTING)
|
||||
) {
|
||||
// 没有项目权限(用户所在的当前项目被禁用&用户被移除出去该项目/白板用户没有项目)且访问的页面非系统菜单模块,则重定向到无项目权限页面
|
||||
router.push({
|
||||
|
|
|
@ -10,9 +10,7 @@ import { NO_PROJECT_ROUTE_NAME } from '@/router/constants';
|
|||
import { useUserStore } from '@/store';
|
||||
import useAppStore from '@/store/modules/app';
|
||||
import useLicenseStore from '@/store/modules/setting/license';
|
||||
import { hasAnyPermission } from '@/utils/permission';
|
||||
|
||||
import { ProjectManagementRouteEnum } from '@/enums/routeEnum';
|
||||
import { getFirstRouteNameByPermission, hasAnyPermission } from '@/utils/permission';
|
||||
|
||||
const { t } = useI18n();
|
||||
const userStore = useUserStore();
|
||||
|
@ -41,10 +39,10 @@ export async function enterProject(projectId: string, organizationId?: string) {
|
|||
await userStore.checkIsLogin();
|
||||
// 跳转到项目页面
|
||||
router.replace({
|
||||
name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_PERMISSION,
|
||||
name: getFirstRouteNameByPermission(router.getRoutes()),
|
||||
query: {
|
||||
orgId: appStore.currentOrgId,
|
||||
pId: appStore.currentProjectId,
|
||||
pId: projectId,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
|
|
Loading…
Reference in New Issue