浏览代码

采用新版树形组件进行权限配置
新增节点属性row: true,控制其子级节点行显示

zhontai 2 年之前
父节点
当前提交
638f66ed5e
共有 1 个文件被更改,包括 2 次插入8 次删除
  1. 2 8
      src/platform/ZhonTai.Admin/Services/Permission/PermissionService.cs

+ 2 - 8
src/platform/ZhonTai.Admin/Services/Permission/PermissionService.cs

@@ -171,22 +171,16 @@ public class PermissionService : BaseService, IPermissionService, IDynamicApi
                 .Where(b => b.PermissionId == a.Id && b.TenantId == User.TenantId)
                 .Any()
             )
-            .OrderBy(a => a.ParentId)
-            .OrderBy(a => a.Sort)
+            .OrderBy(a => new { a.ParentId, a.Sort })
             .ToListAsync(a => new { a.Id, a.ParentId, a.Label, a.Type });
 
-        var apis = permissions
-            .Where(a => a.Type == PermissionTypeEnum.Dot)
-            .Select(a => new { a.Id, a.ParentId, a.Label });
-
         var menus = permissions
-            .Where(a => (new[] { PermissionTypeEnum.Group, PermissionTypeEnum.Menu }).Contains(a.Type))
             .Select(a => new
             {
                 a.Id,
                 a.ParentId,
                 a.Label,
-                Apis = apis.Where(b => b.ParentId == a.Id).Select(b => new { b.Id, b.Label })
+                Row = a.Type == PermissionTypeEnum.Menu
             });
 
         return ResultOutput.Ok(menus);