!106 fix TableTreeNode && freesql Trace实体映射
* fix TableTreeNode && freesql Trace实体映射 * Revert "fix TableTreeNode && freesql Trace实体映射" * fix TableTreeNode && freesql Trace实体映射
This commit is contained in:
parent
026b1bb990
commit
9343a9522e
|
@ -24,6 +24,10 @@ static class FreeSqlExtensions
|
|||
i.Property(n => n.Period).IsIgnore(true);
|
||||
i.Property(n => n.IsReset).IsIgnore(true);
|
||||
});
|
||||
freeSql.CodeFirst.ConfigEntity<Trace>(i =>
|
||||
{
|
||||
i.Name("Traces");
|
||||
});
|
||||
freeSql.CodeFirst.ConfigEntity<Group>(i =>
|
||||
{
|
||||
i.Name("Groups");
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<Table TItem="TItem" IsBordered="true" IsStriped="true" IsMultipleSelect="IsMultipleSelect" @ref="Instance"
|
||||
IsPagination="IsPagination" PageItemsSource="PageItemsSource" IsFixedHeader="IsFixedHeader"
|
||||
IsTree="IsTree" OnTreeExpand="OnTreeExpand!" TreeIcon="fa-chevron-circle-right"
|
||||
IsTree="IsTree" OnTreeExpand="OnTreeExpand!" TreeNodeConverter="TreeNodeConverter!" TreeIcon="fa-chevron-circle-right"
|
||||
ShowDefaultButtons="ShowDefaultButtons" ShowAdvancedSearch="ShowAdvancedSearch"
|
||||
ShowEmpty="ShowEmpty" EmptyText="暂无数据" EmptyImage="images/empty.svg" SortString="@SortString"
|
||||
OnQueryAsync="OnQueryAsync!" OnDeleteAsync="OnDeleteAsync!" OnSaveAsync="OnSaveAsync!"
|
||||
|
|
|
@ -145,7 +145,13 @@ namespace BootstrapAdmin.Web.Components
|
|||
///
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public Func<TItem, Task<IEnumerable<TItem>>>? OnTreeExpand { get; set; }
|
||||
public Func<TItem, Task<IEnumerable<TableTreeNode<TItem>>>>? OnTreeExpand { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public Func<IEnumerable<TItem>, Task<IEnumerable<TableTreeNode<TItem>>>>? TreeNodeConverter { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
@page "/Admin/Menus"
|
||||
|
||||
<AdminTable TItem="DataAccess.Models.Navigation"
|
||||
IsTree="true" OnTreeExpand="OnTreeExpand" ExtendButtonColumnWidth="200"
|
||||
IsTree="true" OnTreeExpand="OnTreeExpand" TreeNodeConverter="TreeNodeConverter" ExtendButtonColumnWidth="200"
|
||||
CustomerSearchModel="SearchModel" OnQueryAsync="OnQueryAsync">
|
||||
<TableToolbarTemplate>
|
||||
<TableToolbarButton TItem="DataAccess.Models.Navigation" Color="Color.Info" Icon="fa fa-sitemap" Text="分配角色"
|
||||
|
|
|
@ -123,9 +123,30 @@ public partial class Menus
|
|||
});
|
||||
}
|
||||
|
||||
private Task<IEnumerable<Navigation>> OnTreeExpand(Navigation menu)
|
||||
private Task<IEnumerable<TableTreeNode<Navigation>>> OnTreeExpand(Navigation menu)
|
||||
{
|
||||
var navs = NavigationService.GetAllMenus(AppContext.UserName);
|
||||
return Task.FromResult(navs.Where(m => m.ParentId == menu.Id).OrderBy(m => m.Order).AsEnumerable());
|
||||
return Task.FromResult(navs.Where(m => m.ParentId == menu.Id).OrderBy(m => m.Order).AsEnumerable().Select(i => new TableTreeNode<Navigation>(i)));
|
||||
}
|
||||
|
||||
private Task<IEnumerable<TableTreeNode<Navigation>>> TreeNodeConverter(IEnumerable<Navigation> items)
|
||||
{
|
||||
var ret = BuildTreeNodes(items, "0");
|
||||
return Task.FromResult(ret);
|
||||
|
||||
IEnumerable<TableTreeNode<Navigation>> BuildTreeNodes(IEnumerable<Navigation> items, string parentId)
|
||||
{
|
||||
var navs = NavigationService.GetAllMenus(AppContext.UserName);
|
||||
var ret = new List<TableTreeNode<Navigation>>();
|
||||
ret.AddRange(items.Where(i => i.ParentId == parentId).Select((nav, index) => new TableTreeNode<Navigation>(nav)
|
||||
{
|
||||
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)
|
||||
}));
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<Table TItem="TItem" IsBordered="true" IsStriped="true" IsMultipleSelect="IsMultipleSelect" @ref="Instance"
|
||||
IsPagination="IsPagination" PageItemsSource="PageItemsSource" IsFixedHeader="IsFixedHeader"
|
||||
IsTree="IsTree" OnTreeExpand="OnTreeExpand!" TreeIcon="fa-chevron-circle-right"
|
||||
IsTree="IsTree" OnTreeExpand="OnTreeExpand!" TreeNodeConverter="TreeNodeConverter!" TreeIcon="fa-chevron-circle-right"
|
||||
ShowDefaultButtons="ShowDefaultButtons" ShowAdvancedSearch="ShowAdvancedSearch"
|
||||
ShowEmpty="ShowEmpty" EmptyText="暂无数据" EmptyImage="images/empty.svg" SortString="@SortString"
|
||||
OnQueryAsync="OnQueryAsync!" OnDeleteAsync="OnDeleteAsync!" OnSaveAsync="OnSaveAsync!"
|
||||
|
|
|
@ -145,7 +145,13 @@ namespace BootstrapClient.Web.Shared.Components
|
|||
///
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public Func<TItem, Task<IEnumerable<TItem>>>? OnTreeExpand { get; set; }
|
||||
public Func<TItem, Task<IEnumerable<TableTreeNode<TItem>>>>? OnTreeExpand { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public Func<IEnumerable<TItem>, Task<IEnumerable<TableTreeNode<TItem>>>>? TreeNodeConverter { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
|
|
Loading…
Reference in New Issue