From 9afeb59766194acfa2d0dfd78569d690187d8f5a Mon Sep 17 00:00:00 2001 From: wcg Date: Tue, 27 Jan 2026 18:11:52 +0800 Subject: [PATCH] =?UTF-8?q?fix(rbac):=20=E8=A7=92=E8=89=B2=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E6=A0=91=E6=8E=A5=E5=8F=A3=E5=A2=9E=E5=8A=A0=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E6=9D=A5=E6=BA=90=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IServices/IRoleService.cs | 3 ++- .../Services/System/RoleService.cs | 4 ++-- Yi.Vben5.Vue3/apps/web-antd/src/api/system/role/index.ts | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application.Contracts/IServices/IRoleService.cs b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application.Contracts/IServices/IRoleService.cs index df48ee92..7fb9d25d 100644 --- a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application.Contracts/IServices/IRoleService.cs +++ b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application.Contracts/IServices/IRoleService.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Mvc; using Volo.Abp.Application.Services; using Yi.Framework.Ddd.Application.Contracts; using Yi.Framework.Rbac.Application.Contracts.Dtos.Role; +using Yi.Framework.Rbac.Domain.Shared.Enums; namespace Yi.Framework.Rbac.Application.Contracts.IServices { @@ -15,7 +16,7 @@ namespace Yi.Framework.Rbac.Application.Contracts.IServices /// /// 角色ID /// 角色菜单树数据,包含已选中的菜单ID和菜单树结构 - Task GetMenuTreeAsync(Guid roleId); + Task GetMenuTreeAsync(Guid roleId,MenuSourceEnum menuSource); /// /// 获取角色部门树 diff --git a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/System/RoleService.cs b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/System/RoleService.cs index 9f6fb7bb..280b5345 100644 --- a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/System/RoleService.cs +++ b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/System/RoleService.cs @@ -227,12 +227,12 @@ namespace Yi.Framework.Rbac.Application.Services.System /// /// /// - public async Task GetMenuTreeAsync(Guid roleId) + public async Task GetMenuTreeAsync(Guid roleId, MenuSourceEnum menuSource = MenuSourceEnum.Vben5) { var checkedKeys = await _menuRepository._DbQueryable .Where(m => SqlFunc.Subqueryable().Where(rm => rm.RoleId == roleId && rm.MenuId == m.Id).Any()) .Select(x => x.Id).ToListAsync(); - var menus = await _menuRepository._DbQueryable.ToListAsync(); + var menus = await _menuRepository._DbQueryable.Where(x => x.State == true && x.MenuSource == menuSource).ToListAsync(); var menuTrees = menus.TreeDtoBuild(); return new JsonResult(new { diff --git a/Yi.Vben5.Vue3/apps/web-antd/src/api/system/role/index.ts b/Yi.Vben5.Vue3/apps/web-antd/src/api/system/role/index.ts index 1d8c84eb..7046e1fd 100644 --- a/Yi.Vben5.Vue3/apps/web-antd/src/api/system/role/index.ts +++ b/Yi.Vben5.Vue3/apps/web-antd/src/api/system/role/index.ts @@ -157,5 +157,5 @@ export function roleDeptTree(roleId: ID) { * @returns resp */ export function roleMenuTreeSelect(roleId: ID) { - return requestClient.get(`${Api.roleMenuTree}/${roleId}`); + return requestClient.get(`${Api.roleMenuTree}/${roleId}?menuSource=Vben5`); }