fix(系统设置): 修复点击“进入项目” 返回页面无权限的缺陷

--bug=1041002 --user=吕梦园
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001041002
This commit is contained in:
teukkk 2024-05-23 12:10:53 +08:00 committed by Craftsman
parent 7afaa42513
commit 9fc4e18c30
3 changed files with 6 additions and 4 deletions

View File

@ -230,7 +230,7 @@
try { try {
loading.value = true; loading.value = true;
const res = await createOrUpdateProject({ id: isEdit.value ? props.currentProject?.id : '', ...form }); const res = await createOrUpdateProject({ id: isEdit.value ? props.currentProject?.id : '', ...form });
showUpdateOrCreateMessage(isEdit.value, res.id); showUpdateOrCreateMessage(isEdit.value, res.id, res.organizationId);
appStore.initProjectList(); appStore.initProjectList();
handleCancel(true); handleCancel(true);
} catch (error) { } catch (error) {

View File

@ -165,6 +165,7 @@
{ {
title: 'system.organization.subordinateOrg', title: 'system.organization.subordinateOrg',
dataIndex: 'organizationName', dataIndex: 'organizationName',
showTooltip: true,
width: 200, width: 200,
}, },
{ {

View File

@ -24,12 +24,13 @@ export async function enterProject(projectId: string, organizationId?: string) {
if (organizationId) { if (organizationId) {
await switchUserOrg(organizationId, userStore.id || ''); await switchUserOrg(organizationId, userStore.id || '');
} }
await userStore.isLogin(true);
// 切换项目 // 切换项目
await switchProject({ await switchProject({
projectId, projectId,
userId: userStore.id || '', userId: userStore.id || '',
}); });
await userStore.isLogin(true); appStore.setCurrentProjectId(projectId);
if (!appStore.currentProjectId || appStore.currentProjectId === 'no_such_project') { if (!appStore.currentProjectId || appStore.currentProjectId === 'no_such_project') {
// 没有项目权限(组织没有项目, 或项目全被禁用),则重定向到无项目权限页面 // 没有项目权限(组织没有项目, 或项目全被禁用),则重定向到无项目权限页面
router.push({ router.push({
@ -53,7 +54,7 @@ export async function enterProject(projectId: string, organizationId?: string) {
} }
} }
export function showUpdateOrCreateMessage(isEdit: boolean, id: string) { export function showUpdateOrCreateMessage(isEdit: boolean, id: string, organizationId?: string) {
if (isEdit) { if (isEdit) {
Message.success(t('system.project.updateProjectSuccess')); Message.success(t('system.project.updateProjectSuccess'));
} else if (!hasAnyPermission(['PROJECT_BASE_INFO:READ'])) { } else if (!hasAnyPermission(['PROJECT_BASE_INFO:READ'])) {
@ -68,7 +69,7 @@ export function showUpdateOrCreateMessage(isEdit: boolean, id: string) {
{ {
type: 'text', type: 'text',
onClick() { onClick() {
enterProject(id); enterProject(id, organizationId);
}, },
}, },
{ default: () => t('system.project.enterProject') } { default: () => t('system.project.enterProject') }