From ff87415d7bddb06de9ef599ab3266b5c1fb875b2 Mon Sep 17 00:00:00 2001 From: xlsea Date: Thu, 10 Jul 2025 13:55:07 +0800 Subject: [PATCH] =?UTF-8?q?fix(projects):=20=E4=BF=AE=E5=A4=8D=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E7=94=A8=E6=88=B7=E5=88=86=E9=85=8D=E6=9C=AA=E8=B0=83?= =?UTF-8?q?=E7=94=A8=E6=8E=A5=E5=8F=A3=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/locales/langs/en-us.ts | 1 + src/locales/langs/zh-cn.ts | 1 + src/service/api/system/role.ts | 18 +++++++++++ src/typings/app.d.ts | 1 + src/utils/common.ts | 10 ++++++ .../role/modules/role-auth-user-drawer.vue | 32 +++++++++++++++++-- 6 files changed, 61 insertions(+), 2 deletions(-) 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 @@