feat: 菜单默认全部展开
This commit is contained in:
parent
35cc0f5174
commit
e3b67c9427
|
@ -1,8 +1,8 @@
|
||||||
@page "/Admin/Menus"
|
@page "/Admin/Menus"
|
||||||
|
|
||||||
<AdminTable TItem="DataAccess.Models.Navigation"
|
<AdminTable TItem="DataAccess.Models.Navigation"
|
||||||
IsTree="true" OnTreeExpand="OnTreeExpand" TreeNodeConverter="TreeNodeConverter" ExtendButtonColumnWidth="200"
|
IsTree="true" OnTreeExpand="OnTreeExpand" TreeNodeConverter="TreeNodeConverter" ModelEqualityComparer="ModelEqualityComparer"
|
||||||
CustomerSearchModel="SearchModel" OnQueryAsync="OnQueryAsync">
|
ExtendButtonColumnWidth="200" CustomerSearchModel="SearchModel" OnQueryAsync="OnQueryAsync">
|
||||||
<TableToolbarTemplate>
|
<TableToolbarTemplate>
|
||||||
<TableToolbarButton TItem="DataAccess.Models.Navigation" Color="Color.Info" Icon="fa fa-sitemap" Text="分配角色"
|
<TableToolbarButton TItem="DataAccess.Models.Navigation" Color="Color.Info" Icon="fa fa-sitemap" Text="分配角色"
|
||||||
IsEnableWhenSelectedOneRow="true" IsShow="@AuthorizeButton("assignRole")"
|
IsEnableWhenSelectedOneRow="true" IsShow="@AuthorizeButton("assignRole")"
|
||||||
|
|
|
@ -141,12 +141,12 @@ public partial class Menus
|
||||||
ret.AddRange(items.Where(i => i.ParentId == parentId).Select((nav, index) => new TableTreeNode<Navigation>(nav)
|
ret.AddRange(items.Where(i => i.ParentId == parentId).Select((nav, index) => new TableTreeNode<Navigation>(nav)
|
||||||
{
|
{
|
||||||
HasChildren = navs.Any(i => i.ParentId == nav.Id),
|
HasChildren = navs.Any(i => i.ParentId == nav.Id),
|
||||||
IsExpand = false,
|
IsExpand = navs.Any(i => i.ParentId == nav.Id),
|
||||||
// 获得子项集合
|
Items = BuildTreeNodes(navs.Where(i => i.ParentId == nav.Id), nav.Id)
|
||||||
// IsExpand = navs.Any(i => i.ParentId == nav.Id)
|
|
||||||
// Items = BuildTreeNodes(navs.Where(i => i.ParentId == nav.Id), nav.Id)
|
|
||||||
}));
|
}));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool ModelEqualityComparer(Navigation x, Navigation y) => x.Id == y.Id;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue