feat: 用户维护使用 AdminTable 组件

This commit is contained in:
Argo-Tianyi 2022-01-20 13:09:19 +08:00
parent 4182d86fd4
commit f0e3e60514
2 changed files with 3 additions and 12 deletions

View File

@ -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>

View File

@ -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);
}
}