From 8d8e26e62384f954cb40bf9c77610a253b0be06d Mon Sep 17 00:00:00 2001 From: RubyLiu Date: Fri, 15 Sep 2023 17:12:48 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E9=A1=B9=E7=9B=AE=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=BB=84=E9=A1=B5=E9=9D=A2=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/project-management/usergroup.ts | 30 +-- .../requrls/project-management/usergroup.ts | 6 +- .../business/ms-user-group-comp/authTable.vue | 10 +- .../createOrUpdateUserGroup.vue | 5 +- .../business/ms-user-selector/utils.ts | 8 +- .../src/components/pure/ms-button/not-mr.vue | 70 +++++++ frontend/src/models/setting/usergroup.ts | 2 + .../userGroup/addUserModal.vue | 21 +-- .../userGroup/locale/en-US.ts | 3 + .../userGroup/locale/zh-CN.ts | 4 + .../userGroup/projectUserGroup.vue | 175 +++++++++++++++--- .../userGroup/userDrawer.vue | 44 ++--- .../organization/project/orgProject.vue | 2 +- 13 files changed, 287 insertions(+), 93 deletions(-) create mode 100644 frontend/src/components/pure/ms-button/not-mr.vue diff --git a/frontend/src/api/modules/project-management/usergroup.ts b/frontend/src/api/modules/project-management/usergroup.ts index 018b0bd7d2..762feb4022 100644 --- a/frontend/src/api/modules/project-management/usergroup.ts +++ b/frontend/src/api/modules/project-management/usergroup.ts @@ -5,12 +5,12 @@ import { UserGroupItem, SystemUserGroupParams, UserGroupAuthSetting, - SaveGlobalUSettingData, UserTableItem, + SaveGlobalUSettingData, } from '@/models/setting/usergroup'; // 项目-创建或修改用户组 -export function updateOrAddUserGroup(data: SystemUserGroupParams) { +export function updateOrAddProjectUserGroup(data: SystemUserGroupParams) { return MSR.post({ url: data.id ? ugUrl.updateUrl : ugUrl.addUrl, data, @@ -27,22 +27,14 @@ export function deleteUserGroup(id: string) { return MSR.get({ url: `${ugUrl.deleteUrl}${id}` }); } -// 项目-获取需要关联的用户选项 -export function getUserGroupOption(organizationId: string, roleId: string, keyword: string) { - return MSR.get({ - url: `${ugUrl.getMemberOptionsUrl}${organizationId}/${roleId}`, - params: { keyword }, - }); -} - // 项目-编辑用户组对应的权限配置 -export function saveUSetting(data: SaveGlobalUSettingData) { +export function saveProjectUGSetting(data: SaveGlobalUSettingData) { return MSR.post({ url: ugUrl.updatePermissionUrl, data }); } // 项目-获取用户组对应的权限 -export function postAuthByUserGroup(data: TableQueryParams) { - return MSR.post>({ url: ugUrl.listPermissionUrl, data }); +export function getAuthByUserGroup(id: string) { + return MSR.get({ url: ugUrl.listPermissionUrl + id }); } // 项目-获取用户组对应的用户列表 @@ -51,11 +43,19 @@ export function postUserByUserGroup(data: TableQueryParams) { } // 项目-删除用户组对应的用户 -export function deleteUserFromUserGroup(data: { userRoleId: string; userIds: string[]; organizationId: string }) { +export function deleteUserFromUserGroup(data: { projectId: string; userRoleId: string; userIds: string[] }) { return MSR.post>({ url: ugUrl.removeMemberUrl, data }); } +// 项目-获取需要关联的用户选项 +export function getProjectUserGroupOptions(projectId: string, userRoleId: string, keyword: string) { + return MSR.get({ + url: `${ugUrl.getMemberOptionsUrl}${projectId}/${userRoleId}`, + params: { keyword }, + }); +} + // 项目-添加用户到用户组 -export function addUserToUserGroup(data: { userRoleId: string; userIds: string[]; organizationId: string }) { +export function addUserToUserGroup(data: { projectId: string; userRoleId: string; userIds: string[] }) { return MSR.post({ url: ugUrl.addMemberUrl, data }); } diff --git a/frontend/src/api/requrls/project-management/usergroup.ts b/frontend/src/api/requrls/project-management/usergroup.ts index cc21a909a4..b8064bffab 100644 --- a/frontend/src/api/requrls/project-management/usergroup.ts +++ b/frontend/src/api/requrls/project-management/usergroup.ts @@ -5,6 +5,6 @@ export const updatePermissionUrl = '/user/role/project/permission/update'; export const listMemberUrl = '/user/role/project/list-member'; export const addMemberUrl = '/user/role/project/add-member'; export const listPermissionUrl = '/user/role/project/permission/setting/'; -export const listUserGroupUrl = '/user/role/project/list/'; -export const getMemberOptionsUrl = '/api/project-management/usergroup/getMemberOptions'; -export const deleteUrl = '/api/project-management/usergroup/delete'; +export const listUserGroupUrl = '/user/role/project/list'; +export const getMemberOptionsUrl = '/user/role/project/get-member/option/'; +export const deleteUrl = '/user/role/project/delete/'; diff --git a/frontend/src/components/business/ms-user-group-comp/authTable.vue b/frontend/src/components/business/ms-user-group-comp/authTable.vue index fbc6eca160..de2506d8a2 100644 --- a/frontend/src/components/business/ms-user-group-comp/authTable.vue +++ b/frontend/src/components/business/ms-user-group-comp/authTable.vue @@ -59,6 +59,7 @@ saveGlobalUSetting, saveOrgUSetting, } from '@/api/modules/setting/usergroup'; + import { getAuthByUserGroup, saveProjectUGSetting } from '@/api/modules/project-management/usergroup'; import { UserGroupAuthSetting, AuthTableItem, @@ -266,8 +267,7 @@ res = await getOrgUSetting(id); } } else { - // TODO 项目的 - res = await getOrgUSetting(id); + res = await getAuthByUserGroup(id); } tableData.value = transformData(res); @@ -306,7 +306,11 @@ permissions, }); } else { - // TODO 项目的 + // 项目的 + await saveProjectUGSetting({ + userRoleId: props.current.id, + permissions, + }); } Message.success(t('common.saveSuccess')); initData(props.current.id, props.current.internal); diff --git a/frontend/src/components/business/ms-user-group-comp/createOrUpdateUserGroup.vue b/frontend/src/components/business/ms-user-group-comp/createOrUpdateUserGroup.vue index b409d43e29..5709d4e357 100644 --- a/frontend/src/components/business/ms-user-group-comp/createOrUpdateUserGroup.vue +++ b/frontend/src/components/business/ms-user-group-comp/createOrUpdateUserGroup.vue @@ -51,6 +51,7 @@ import { Message } from '@arco-design/web-vue'; import type { FormInstance, ValidatedError } from '@arco-design/web-vue'; import { updateOrAddOrgUserGroup, updateOrAddUserGroup } from '@/api/modules/setting/usergroup'; + import { updateOrAddProjectUserGroup } from '@/api/modules/project-management/usergroup'; import { UserGroupItem } from '@/models/setting/usergroup'; import { AuthScopeEnum } from '@/enums/commonEnum'; import { useAppStore } from '@/store'; @@ -114,7 +115,6 @@ if (systemType === AuthScopeEnum.SYSTEM) { res = await updateOrAddUserGroup({ id: props.id, name: form.name, type: props.authScope }); } else if (systemType === AuthScopeEnum.ORGANIZATION) { - debugger; // 组织用户组 res = await updateOrAddOrgUserGroup({ id: props.id, @@ -123,7 +123,8 @@ scopeId: appStore.currentOrgId, }); } else { - res = await updateOrAddUserGroup({ id: props.id, name: form.name, type: props.authScope }); + // 项目用户组 项目用户组只有创建 + res = await updateOrAddProjectUserGroup({ name: form.name }); } if (res) { Message.success( diff --git a/frontend/src/components/business/ms-user-selector/utils.ts b/frontend/src/components/business/ms-user-selector/utils.ts index 8a60c6f7ed..07f92260fa 100644 --- a/frontend/src/components/business/ms-user-selector/utils.ts +++ b/frontend/src/components/business/ms-user-selector/utils.ts @@ -7,6 +7,7 @@ import { import { getOrgUserGroupOption, getSystemUserGroupOption } from '@/api/modules/setting/usergroup'; import { getUser, getProjectList } from '@/api/modules/setting/member'; import { getProjectMemberOptions } from '@/api/modules/project-management/projectMember'; +import { getProjectUserGroupOptions } from '@/api/modules/project-management/usergroup'; // eslint-disable-next-line no-shadow export enum UserRequesetTypeEnum { @@ -22,6 +23,7 @@ export enum UserRequesetTypeEnum { SYSTEM_ORGANIZATION_PROJECT = 'SYSTEM_ORGANIZATION_PROJECT', SYSTEM_ORGANIZATION_MEMBER = 'SYSTEM_ORGANIZATION_MEMBER', PROJECT_PERMISSION_MEMBER = 'PROJECT_PERMISSION_MEMBER', + PROJECT_USER_GROUP = 'PROJECT_USER_GROUP', } export default function initOptionsFunc(type: string, params: Record) { if (type === UserRequesetTypeEnum.SYSTEM_USER_GROUP) { @@ -57,7 +59,11 @@ export default function initOptionsFunc(type: string, params: Record +
+ +
+ + + + + diff --git a/frontend/src/models/setting/usergroup.ts b/frontend/src/models/setting/usergroup.ts index 9649a942a6..379171f279 100644 --- a/frontend/src/models/setting/usergroup.ts +++ b/frontend/src/models/setting/usergroup.ts @@ -48,6 +48,8 @@ export interface CurrentUserGroupItem { type: AuthScopeEnum; // 是否是内置用户组 internal: boolean; + // 组ID + scopeId?: string; } export interface SystemUserGroupParams { diff --git a/frontend/src/views/project-management/projectAndPermission/userGroup/addUserModal.vue b/frontend/src/views/project-management/projectAndPermission/userGroup/addUserModal.vue index 04b1a05f2f..e599996031 100644 --- a/frontend/src/views/project-management/projectAndPermission/userGroup/addUserModal.vue +++ b/frontend/src/views/project-management/projectAndPermission/userGroup/addUserModal.vue @@ -17,9 +17,9 @@ > @@ -37,21 +37,18 @@ diff --git a/frontend/src/views/project-management/projectAndPermission/userGroup/userDrawer.vue b/frontend/src/views/project-management/projectAndPermission/userGroup/userDrawer.vue index 9c0a71678d..07fc1ef92d 100644 --- a/frontend/src/views/project-management/projectAndPermission/userGroup/userDrawer.vue +++ b/frontend/src/views/project-management/projectAndPermission/userGroup/userDrawer.vue @@ -42,18 +42,18 @@ - - diff --git a/frontend/src/views/setting/organization/project/orgProject.vue b/frontend/src/views/setting/organization/project/orgProject.vue index 5b90ac1253..f75c59e12d 100644 --- a/frontend/src/views/setting/organization/project/orgProject.vue +++ b/frontend/src/views/setting/organization/project/orgProject.vue @@ -22,7 +22,7 @@