feat: Users 自定义菜单增加禁用功能
This commit is contained in:
parent
08d5e498a0
commit
31c9c4de7b
|
@ -4,7 +4,7 @@
|
|||
IsPagination="IsPagination" PageItemsSource="PageItemsSource"
|
||||
UseInjectDataService="true" DataService="DataService" OnQueryAsync="OnQueryAsync!"
|
||||
ShowToolbar="true" ShowExtendButtons="true" ShowSearch="true"
|
||||
ShowCardView="true" ShowColumnList="true"
|
||||
ShowCardView="true" ShowColumnList="true" @bind-SelectedRows="SelectedRows"
|
||||
CustomerSearchModel="@TableSearchModel">
|
||||
<TableToolbarTemplate>
|
||||
@TableToolbarTemplate
|
||||
|
|
|
@ -56,5 +56,17 @@
|
|||
/// </summary>
|
||||
[Parameter]
|
||||
public Func<QueryPageOptions, Task<QueryData<TItem>>>? OnQueryAsync { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public List<TItem> SelectedRows { get; set; } = new List<TItem>();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<List<TItem>> SelectedRowsChanged { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
@page "/Admin/Users"
|
||||
|
||||
<BlazorTable TItem="DataAccess.Models.User">
|
||||
<BlazorTable TItem="DataAccess.Models.User" @bind-SelectedRows="SelectedRows">
|
||||
<TableToolbarTemplate>
|
||||
<TableToolbarButton TItem="DataAccess.Models.User" Color="Color.Info" Icon="fa fa-bank" Text="分配部门" OnClickCallback="OnAssignmentDept" />
|
||||
<TableToolbarButton TItem="DataAccess.Models.User" Color="Color.Warning" Icon="fa fa-sitemap" Text="分配角色" OnClickCallback="OnAssignmentRoles" />
|
||||
<TableToolbarButton TItem="DataAccess.Models.User" IsDisabled="SelectedRows.Count() != 1" Color="Color.Info" Icon="fa fa-bank" Text="分配部门" OnClickCallback="OnAssignmentDept" />
|
||||
<TableToolbarButton TItem="DataAccess.Models.User" IsDisabled="SelectedRows.Count() != 1" Color="Color.Warning" Icon="fa fa-sitemap" Text="分配角色" OnClickCallback="OnAssignmentRoles" />
|
||||
</TableToolbarTemplate>
|
||||
<ColumnsTemplete>
|
||||
<TableColumn @bind-Field="@context.UserName" Text="登录名称" Sortable="true" Filterable="true" Searchable="true"></TableColumn>
|
||||
|
|
|
@ -15,6 +15,8 @@ namespace BootstrapAdmin.Web.Pages.Admin
|
|||
[NotNull]
|
||||
private ToastService? ToastService { get; set; }
|
||||
|
||||
private List<User> SelectedRows { get; set; } = new List<User>();
|
||||
|
||||
private async Task OnAssignmentDept(IEnumerable<User> users)
|
||||
{
|
||||
if (users.Count() == 1)
|
||||
|
|
Loading…
Reference in New Issue