diff --git a/src/locales/langs/en-us.ts b/src/locales/langs/en-us.ts index 17c811f6..3928cbae 100644 --- a/src/locales/langs/en-us.ts +++ b/src/locales/langs/en-us.ts @@ -61,6 +61,7 @@ const local: App.I18n.Schema = { update: 'Update', saveSuccess: 'Save Success', updateSuccess: 'Update Success', + noChange: 'No actions were taken', userCenter: 'User Center', yesOrNo: { yes: 'Yes', diff --git a/src/locales/langs/zh-cn.ts b/src/locales/langs/zh-cn.ts index 6c87c818..449a839c 100644 --- a/src/locales/langs/zh-cn.ts +++ b/src/locales/langs/zh-cn.ts @@ -61,6 +61,7 @@ const local: App.I18n.Schema = { update: '更新', saveSuccess: '保存成功', updateSuccess: '更新成功', + noChange: '没有进行任何操作', userCenter: '个人中心', yesOrNo: { yes: '是', diff --git a/src/service/api/system/role.ts b/src/service/api/system/role.ts index 378f658e..9aea88df 100644 --- a/src/service/api/system/role.ts +++ b/src/service/api/system/role.ts @@ -78,3 +78,21 @@ export function fetchGetRoleUserList(params: Api.System.UserSearchParams) { params }); } + +/** 批量选择用户授权 */ +export function fetchUpdateRoleAuthUser(roleId: CommonType.IdType, userIds: CommonType.IdType[]) { + return request({ + url: '/system/role/authUser/selectAll', + method: 'put', + params: { roleId, userIds: userIds.join(',') } + }); +} + +/** 批量取消用户授权 */ +export function fetchUpdateRoleAuthUserCancel(roleId: CommonType.IdType, userIds: CommonType.IdType[]) { + return request({ + url: '/system/role/authUser/cancelAll', + method: 'put', + params: { roleId, userIds: userIds.join(',') } + }); +} diff --git a/src/typings/app.d.ts b/src/typings/app.d.ts index d05303b0..d90bbbdd 100644 --- a/src/typings/app.d.ts +++ b/src/typings/app.d.ts @@ -376,6 +376,7 @@ declare namespace App { update: string; updateSuccess: string; saveSuccess: string; + noChange: string; userCenter: string; yesOrNo: { yes: string; diff --git a/src/utils/common.ts b/src/utils/common.ts index 1888dd27..47be6e4d 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -191,3 +191,13 @@ export function transformToURLSearchParams(obj: Record, excludeKeys }); return searchParams; } + +/** 判断两个数组是否相等 */ +export function arraysEqualSet(arr1: Array, arr2: Array) { + return ( + arr1.length === arr2.length && + new Set(arr1).size === arr1.length && + new Set(arr2).size === arr2.length && + [...arr1].sort().join() === [...arr2].sort().join() + ); +} diff --git a/src/views/system/role/modules/role-auth-user-drawer.vue b/src/views/system/role/modules/role-auth-user-drawer.vue index f599a9fa..6bb9e890 100644 --- a/src/views/system/role/modules/role-auth-user-drawer.vue +++ b/src/views/system/role/modules/role-auth-user-drawer.vue @@ -1,10 +1,16 @@