feat: 用户维护使用 AdminTable 组件
This commit is contained in:
parent
4182d86fd4
commit
f0e3e60514
|
@ -1,9 +1,7 @@
|
|||
@page "/Admin/Users"
|
||||
|
||||
<Table TItem="DataAccess.Models.User" IsBordered="true" IsStriped="true" IsMultipleSelect="true"
|
||||
ExtendButtonColumnWidth="270" ShowAddButton="@AuthorizeButton("add")" ShowDeleteButton="@AuthorizeButton("del")" ShowEditButton="@AuthorizeButton("edit")"
|
||||
ShowToolbar="true" ShowExtendButtons="true" ShowSearch="true"
|
||||
UseInjectDataService="true" OnSaveAsync="@OnSaveAsync">
|
||||
<AdminTable TItem="DataAccess.Models.User" IsMultipleSelect="true"
|
||||
ExtendButtonColumnWidth="270" OnSaveAsync="@OnSaveAsync">
|
||||
<TableToolbarTemplate>
|
||||
<TableToolbarButton TItem="DataAccess.Models.User" IsEnableWhenSelectedOneRow="true" Color="Color.Warning" Icon="fa fa-bank" Text="分配部门" OnClickCallback="users => OnAssignmentGroups(users.First())" />
|
||||
<TableToolbarButton TItem="DataAccess.Models.User" IsEnableWhenSelectedOneRow="true" Color="Color.Info" Icon="fa fa-sitemap" Text="分配角色" OnClickCallback="users => OnAssignmentRoles(users.First())" />
|
||||
|
@ -36,4 +34,4 @@
|
|||
<TableCellButton Size="Size.ExtraSmall" Color="Color.Warning" Icon="fa fa-bank" Text="分配部门" OnClick="() => OnAssignmentGroups(context)" />
|
||||
<TableCellButton Size="Size.ExtraSmall" Color="Color.Info" Icon="fa fa-sitemap" Text="分配角色" OnClick="() => OnAssignmentRoles(context)" />
|
||||
</RowButtonTemplate>
|
||||
</Table>
|
||||
</AdminTable>
|
||||
|
|
|
@ -85,11 +85,4 @@ public partial class Users
|
|||
{
|
||||
return Task.FromResult(UserService.SaveUser(user.UserName, user.DisplayName, user.NewPassword));
|
||||
}
|
||||
|
||||
private bool AuthorizeButton(string operate)
|
||||
{
|
||||
var url = NavigationManager.ToBaseRelativePath(NavigationManager.Uri);
|
||||
|
||||
return NavigationService.AuthorizationBlock(url, AppContext.UserName, operate);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue