From 79f1594681dc42529c0902b72e36f274808f2964 Mon Sep 17 00:00:00 2001 From: "xinxin.wu" Date: Tue, 1 Aug 2023 17:33:51 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):=20?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=88=90=E5=91=98=E6=9C=AC=E5=9C=B0=E8=81=94?= =?UTF-8?q?=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/modules/setting/member.ts | 24 +- frontend/src/api/requrls/setting/member.ts | 11 +- .../bussiness/ms-batch-modal/index.vue | 71 ++-- .../bussiness/ms-batch-modal/types.ts | 7 + frontend/src/models/setting/member.ts | 1 + .../member/components/addMemberModal.vue | 27 +- .../setting/organization/member/index.vue | 314 +++++++++--------- 7 files changed, 248 insertions(+), 207 deletions(-) create mode 100644 frontend/src/components/bussiness/ms-batch-modal/types.ts diff --git a/frontend/src/api/modules/setting/member.ts b/frontend/src/api/modules/setting/member.ts index 2cec05e3c5..eb1d33eb37 100644 --- a/frontend/src/api/modules/setting/member.ts +++ b/frontend/src/api/modules/setting/member.ts @@ -10,7 +10,7 @@ import { getUserList, getProjectListUrl, } from '@/api/requrls/setting/member'; -import type { MemberList, AddorUpdateMemberModel, BatchAddProjectModel } from '@/models/setting/member'; +import type { MemberList, AddorUpdateMemberModel, BatchAddProjectModel, LinkItem } from '@/models/setting/member'; import type { TableQueryParams } from '@/models/common'; // 获取成员列表 export function getMemberList(data: TableQueryParams) { @@ -27,23 +27,23 @@ export function addOrUpdate(data: AddorUpdateMemberModel, type: string) { export function batchAddProject(data: BatchAddProjectModel) { return MSR.post({ url: BatchAddProjectUrl, data }); } -// 添加到用户 -export function batchAddUserGroup(data: AddorUpdateMemberModel) { +// 添加到用户组 +export function batchAddUserGroup(data: BatchAddProjectModel) { return MSR.post({ url: BatchAddUserGroupUrl, data }); } // 移除成员 export function deleteMemberReq(organizationId: string, userId: string) { return MSR.get({ url: DeleteMemberUrl, params: `/${organizationId}/${userId}` }); } -// 获取全局用户组下拉 -export function getGlobalUserGroup() { - return MSR.get({ url: getUserGroupList }); +// 获取用户组下拉 +export function getGlobalUserGroup(organizationId: string) { + return MSR.get({ url: getUserGroupList, params: `/${organizationId}` }); } -// 获取用户下拉 -export function getUser() { - return MSR.get({ url: getUserList }); +// 获取系统用户下拉 +export function getUser(organizationId: string) { + return MSR.get({ url: getUserList, params: `/${organizationId}` }); } -// 【暂用】获取组织下边的项目 -export function getProjectList(data: any) { - return MSR.post({ url: getProjectListUrl, data }); +// 获取组织下边的项目 +export function getProjectList(organizationId: string) { + return MSR.get({ url: getProjectListUrl, params: `/${organizationId}` }); } diff --git a/frontend/src/api/requrls/setting/member.ts b/frontend/src/api/requrls/setting/member.ts index 60c6e5a24c..d2458c4751 100644 --- a/frontend/src/api/requrls/setting/member.ts +++ b/frontend/src/api/requrls/setting/member.ts @@ -6,10 +6,9 @@ export const BatchAddProjectUrl = '/organization/project/add-member'; // 添加至用户组 export const BatchAddUserGroupUrl = '/organization/role/update-member'; export const DeleteMemberUrl = '/organization/remove-member'; -// 暂用 -// 用户组下拉 -export const getUserGroupList = '/user/role/global/list'; -// 用户下拉 -export const getUserList = '/system/user/list'; +// 获取组织下边的用户组列表 +export const getUserGroupList = '/organization/user/role/list'; +// 获取当前组织内不存在成员 +export const getUserList = '/organization/not-exist/user/list'; // 获取弹窗里边的穿梭项目列表 -export const getProjectListUrl = '/system/project/page'; +export const getProjectListUrl = '/organization/project/list'; diff --git a/frontend/src/components/bussiness/ms-batch-modal/index.vue b/frontend/src/components/bussiness/ms-batch-modal/index.vue index 084a451bcc..cf9cb25783 100644 --- a/frontend/src/components/bussiness/ms-batch-modal/index.vue +++ b/frontend/src/components/bussiness/ms-batch-modal/index.vue @@ -38,6 +38,8 @@ diff --git a/frontend/src/components/bussiness/ms-batch-modal/types.ts b/frontend/src/components/bussiness/ms-batch-modal/types.ts new file mode 100644 index 0000000000..cac1daa7f5 --- /dev/null +++ b/frontend/src/components/bussiness/ms-batch-modal/types.ts @@ -0,0 +1,7 @@ +export interface BatchModel { + id?: string; + organizationId?: string; + memberIds?: string[]; + userRoleIds?: string[]; + projectIds?: string[]; +} diff --git a/frontend/src/models/setting/member.ts b/frontend/src/models/setting/member.ts index b36436e7e4..9f1333a7bc 100644 --- a/frontend/src/models/setting/member.ts +++ b/frontend/src/models/setting/member.ts @@ -48,6 +48,7 @@ export interface BatchAddProjectModel { organizationId?: string; memberIds?: Array; projectIds?: string[]; + userRoleIds?: string[]; } // 用户组下拉列表 diff --git a/frontend/src/views/setting/organization/member/components/addMemberModal.vue b/frontend/src/views/setting/organization/member/components/addMemberModal.vue index 76bfdec7d7..e59698d62e 100644 --- a/frontend/src/views/setting/organization/member/components/addMemberModal.vue +++ b/frontend/src/views/setting/organization/member/components/addMemberModal.vue @@ -11,13 +11,7 @@
- + - {{ item.name }} + {{ item.name }} (); const dialogVisible = ref(false); + const memberList = ref([]); const title = ref(''); const type = ref(''); const emits = defineEmits<{ @@ -110,12 +105,11 @@ dialogVisible.value = false; }; const edit = (record: MemberItem) => { - const { userRoleIdNameMap } = record; + const { userRoleIdNameMap, projectIdNameMap } = record; form.value.memberIds = [record.id as string]; - // form.value.userRoleIds = userRoleIdNameMap.map((item) => item.id); - form.value.userRoleIds = Object.keys(userRoleIdNameMap); + form.value.userRoleIds = (userRoleIdNameMap || []).map((item) => item.id); + form.value.projectIds = (projectIdNameMap || []).map((item) => item.id); }; - const handleOK = () => { memberFormRef.value?.validate(async (errors: undefined | Record) => { if (!errors) { @@ -136,6 +130,7 @@ : { ...params, projectIds, + memberId: memberIds?.join(), }; await addOrUpdate(params, type.value); Message.success( @@ -155,8 +150,12 @@ } }); }; + const getUserOptions = async () => { + memberList.value = await getUser(lastOrganizationId); + }; watchEffect(() => { dialogVisible.value = props.visible; + if (props.visible) getUserOptions(); }); watch( () => dialogVisible.value, diff --git a/frontend/src/views/setting/organization/member/index.vue b/frontend/src/views/setting/organization/member/index.vue index 9450193209..823181a3e7 100644 --- a/frontend/src/views/setting/organization/member/index.vue +++ b/frontend/src/views/setting/organization/member/index.vue @@ -2,7 +2,9 @@
- {{ t('organization.member.addMember') }} + {{ + t('organization.member.addMember') + }}
@@ -101,24 +107,25 @@