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