feat(rbac): 添加Vben5菜单

This commit is contained in:
wcg
2026-01-04 10:55:28 +08:00
parent 38463fc477
commit f77c775229
4 changed files with 1018 additions and 4 deletions

View File

@@ -423,7 +423,7 @@ namespace Yi.Framework.Rbac.Application.Services
{ {
//将后端菜单转换成前端路由,组件级别需要过滤 //将后端菜单转换成前端路由,组件级别需要过滤
output = output =
ObjectMapper.Map<List<MenuDto>, List<MenuAggregateRoot>>(menus.Where(x=>x.MenuSource==MenuSourceEnum.Ruoyi).ToList()).Vue3RuoYiRouterBuild(); ObjectMapper.Map<List<MenuDto>, List<MenuAggregateRoot>>(menus.Where(x=>x.MenuSource==MenuSourceEnum.Ruoyi).ToList()).Vue3RuoYiRouterBuild(MenuSourceEnum.Ruoyi);
} }
else if (routerType == "pure") else if (routerType == "pure")
{ {
@@ -431,6 +431,12 @@ namespace Yi.Framework.Rbac.Application.Services
output = output =
ObjectMapper.Map<List<MenuDto>, List<MenuAggregateRoot>>(menus.Where(x=>x.MenuSource==MenuSourceEnum.Pure).ToList()).Vue3PureRouterBuild(); ObjectMapper.Map<List<MenuDto>, List<MenuAggregateRoot>>(menus.Where(x=>x.MenuSource==MenuSourceEnum.Pure).ToList()).Vue3PureRouterBuild();
} }
else if ( routerType == "vben5")
{
//将后端菜单转换成前端路由,组件级别需要过滤
output =
ObjectMapper.Map<List<MenuDto>, List<MenuAggregateRoot>>(menus.Where(x=>x.MenuSource==MenuSourceEnum.Vben5).ToList()).Vue3RuoYiRouterBuild(MenuSourceEnum.Vben5);
}
return output; return output;
} }

View File

@@ -3,5 +3,6 @@
public enum MenuSourceEnum public enum MenuSourceEnum
{ {
Ruoyi=0, Ruoyi=0,
Pure=1 Pure=1,
Vben5=2
} }

View File

@@ -168,12 +168,12 @@ namespace Yi.Framework.Rbac.Domain.Entities
/// </summary> /// </summary>
/// <param name="menus"></param> /// <param name="menus"></param>
/// <returns></returns> /// <returns></returns>
public static List<Vue3RouterDto> Vue3RuoYiRouterBuild(this List<MenuAggregateRoot> menus) public static List<Vue3RouterDto> Vue3RuoYiRouterBuild(this List<MenuAggregateRoot> menus,MenuSourceEnum menuSource)
{ {
menus = menus menus = menus
.Where(m => m.State == true) .Where(m => m.State == true)
.Where(m => m.MenuType != MenuTypeEnum.Component) .Where(m => m.MenuType != MenuTypeEnum.Component)
.Where(m => m.MenuSource == MenuSourceEnum.Ruoyi) .Where(m => m.MenuSource == menuSource)
.ToList(); .ToList();
List<Vue3RouterDto> routers = new(); List<Vue3RouterDto> routers = new();
foreach (var m in menus) foreach (var m in menus)