fix(rbac): 角色菜单树接口增加菜单来源参数
This commit is contained in:
@@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using Volo.Abp.Application.Services;
|
using Volo.Abp.Application.Services;
|
||||||
using Yi.Framework.Ddd.Application.Contracts;
|
using Yi.Framework.Ddd.Application.Contracts;
|
||||||
using Yi.Framework.Rbac.Application.Contracts.Dtos.Role;
|
using Yi.Framework.Rbac.Application.Contracts.Dtos.Role;
|
||||||
|
using Yi.Framework.Rbac.Domain.Shared.Enums;
|
||||||
|
|
||||||
namespace Yi.Framework.Rbac.Application.Contracts.IServices
|
namespace Yi.Framework.Rbac.Application.Contracts.IServices
|
||||||
{
|
{
|
||||||
@@ -15,7 +16,7 @@ namespace Yi.Framework.Rbac.Application.Contracts.IServices
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="roleId">角色ID</param>
|
/// <param name="roleId">角色ID</param>
|
||||||
/// <returns>角色菜单树数据,包含已选中的菜单ID和菜单树结构</returns>
|
/// <returns>角色菜单树数据,包含已选中的菜单ID和菜单树结构</returns>
|
||||||
Task<ActionResult> GetMenuTreeAsync(Guid roleId);
|
Task<ActionResult> GetMenuTreeAsync(Guid roleId,MenuSourceEnum menuSource);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取角色部门树
|
/// 获取角色部门树
|
||||||
|
|||||||
@@ -227,12 +227,12 @@ namespace Yi.Framework.Rbac.Application.Services.System
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="roleId"></param>
|
/// <param name="roleId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<ActionResult> GetMenuTreeAsync(Guid roleId)
|
public async Task<ActionResult> GetMenuTreeAsync(Guid roleId, MenuSourceEnum menuSource = MenuSourceEnum.Vben5)
|
||||||
{
|
{
|
||||||
var checkedKeys = await _menuRepository._DbQueryable
|
var checkedKeys = await _menuRepository._DbQueryable
|
||||||
.Where(m => SqlFunc.Subqueryable<RoleMenuEntity>().Where(rm => rm.RoleId == roleId && rm.MenuId == m.Id).Any())
|
.Where(m => SqlFunc.Subqueryable<RoleMenuEntity>().Where(rm => rm.RoleId == roleId && rm.MenuId == m.Id).Any())
|
||||||
.Select(x => x.Id).ToListAsync();
|
.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();
|
var menuTrees = menus.TreeDtoBuild();
|
||||||
return new JsonResult(new
|
return new JsonResult(new
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -157,5 +157,5 @@ export function roleDeptTree(roleId: ID) {
|
|||||||
* @returns resp
|
* @returns resp
|
||||||
*/
|
*/
|
||||||
export function roleMenuTreeSelect(roleId: ID) {
|
export function roleMenuTreeSelect(roleId: ID) {
|
||||||
return requestClient.get<MenuResp>(`${Api.roleMenuTree}/${roleId}`);
|
return requestClient.get<MenuResp>(`${Api.roleMenuTree}/${roleId}?menuSource=Vben5`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user