feat: 根据最新组件更改 SortList 为 SortString

This commit is contained in:
Argo-Tianyi 2022-01-23 12:49:51 +08:00
parent 0d609c41b0
commit 434e7ab82b
10 changed files with 19 additions and 22 deletions

View File

@ -4,7 +4,7 @@
IsPagination="IsPagination" PageItemsSource="PageItemsSource" IsFixedHeader="IsFixedHeader"
IsTree="IsTree" OnTreeExpand="OnTreeExpand!" TreeIcon="fa-chevron-circle-right"
ShowDefaultButtons="ShowDefaultButtons" ShowAdvancedSearch="ShowAdvancedSearch"
ShowEmpty="ShowEmpty" EmptyText="暂无数据" EmptyImage="images/empty.svg" SortList="SortList"
ShowEmpty="ShowEmpty" EmptyText="暂无数据" EmptyImage="images/empty.svg" SortString="@SortString"
OnQueryAsync="OnQueryAsync!" OnDeleteAsync="OnDeleteAsync!" OnSaveAsync="OnSaveAsync!"
ShowSkeleton="true" ShowLoading="ShowLoading" ShowSearch="ShowSearch"
ShowToolbar="ShowToolbar" ShowExtendButtons="ShowExtendButtons" ShowAddButton="@AuthorizeButton("add")"

View File

@ -26,7 +26,7 @@ namespace BootstrapAdmin.Web.Components
///
/// </summary>
[Parameter]
public List<string>? SortList { get; set; }
public string? SortString { get; set; }
/// <summary>
///

View File

@ -1,6 +1,6 @@
@page "/Admin/Dicts"
<AdminTable TItem="DataAccess.Models.Dict" CustomerSearchModel="DictsSearchModel" SortList="SortList">
<AdminTable TItem="DataAccess.Models.Dict" CustomerSearchModel="DictsSearchModel" SortString="Define, Category, Name">
<TableColumns>
<TableColumn @bind-Field="context.Category" Filterable="true" Searchable="true" Sortable="true"></TableColumn>
<TableColumn @bind-Field="context.Name" Filterable="true" Searchable="true" Sortable="true"></TableColumn>

View File

@ -7,8 +7,6 @@ namespace BootstrapAdmin.Web.Pages.Admin
/// </summary>
public partial class Dicts
{
private ITableSearchModel DictsSearchModel { get; set; } = new DictsSearchModel();
private List<string> SortList { get; } = new List<string> { "Define", "Category", "Name" };
private ITableSearchModel DictsSearchModel { get; } = new DictsSearchModel();
}
}

View File

@ -1,6 +1,6 @@
@page "/admin/logins"
<AdminTable TItem="LoginLog" IsPagination="true" CustomerSearchModel="@TableSearchModel" SortList="SortList"
<AdminTable TItem="LoginLog" IsPagination="true" CustomerSearchModel="@TableSearchModel" SortString="LoginTime desc"
ShowDefaultButtons="false" ShowExtendButtons="false">
<TableColumns>
<TableColumn @bind-Field="@context.UserName" Filterable="true" Searchable="true"></TableColumn>

View File

@ -10,7 +10,5 @@ public partial class Logins
/// <summary>
///
/// </summary>
public ITableSearchModel TableSearchModel { get; set; } = new LoginLogModel();
private List<string> SortList { get; set; } = new List<string>() { "LoginTime desc" };
public ITableSearchModel TableSearchModel { get; } = new LoginLogModel();
}

View File

@ -31,7 +31,7 @@
<AdminAlert Text="演示系统禁止修改内置后台任务" IsShow="IsDemo" />
<AdminTable TItem="TasksModel" ExtendButtonColumnWidth="270" IsFixedHeader="false" SortList="SortList"
<AdminTable TItem="TasksModel" ExtendButtonColumnWidth="270" IsFixedHeader="false" SortString="Status, LastRuntime desc"
SelectedRows="SelectedRows"
ShowEditButtonCallback="OnShowButtonCallback" ShowDeleteButtonCallback="OnShowButtonCallback"
OnQueryAsync="OnQueryAsync" OnDeleteAsync="OnDeleteAsync" OnSaveAsync="OnSaveAsync">

View File

@ -30,8 +30,6 @@ public partial class Tasks
private bool IsDemo { get; set; }
private List<string> SortList { get; } = new List<string>() { "Name", "LastRuntime desc" };
/// <summary>
///
/// </summary>
@ -45,6 +43,10 @@ public partial class Tasks
private Task<QueryData<TasksModel>> OnQueryAsync(QueryPageOptions options)
{
var tasks = TaskServicesManager.ToList().ToTasksModelList();
if (options.SortList != null && options.SortList.Any())
{
tasks = tasks.Sort(options.SortList).ToList();
}
var model = tasks.FirstOrDefault(i => i.Name == SelectedRows.FirstOrDefault()?.Name);
SelectedRows.Clear();
if (model != null)
@ -83,7 +85,7 @@ public partial class Tasks
return Task.FromResult(true);
}
private bool OnShowButtonCallback(TasksModel model) => !IsDemo || !Jobs.Any(i => i == model.Name);
private bool OnShowButtonCallback(TasksModel model) => !IsDemo && !Jobs.Any(i => i == model.Name);
private static Color GetResultColor(TriggerResult result) => result switch
{
@ -122,7 +124,8 @@ public partial class Tasks
private static string GetStatusIcon(SchedulerStatus status) => status switch
{
SchedulerStatus.Running => "fa fa-play-circle",
SchedulerStatus.Ready => "fa fa-times-circle",
SchedulerStatus.Ready => "fa fa-stop-circle",
SchedulerStatus.Disabled => "fa fa-times-circle",
_ => "未知状态"
};

View File

@ -1,6 +1,6 @@
@page "/admin/traces"
<AdminTable TItem="DataAccess.Models.Trace" IsPagination="true" PageItemsSource="PageItemsSource" SortList="SortList"
<AdminTable TItem="DataAccess.Models.Trace" IsPagination="true" PageItemsSource="PageItemsSource" SortString="LogTime desc"
ShowDefaultButtons="false" ShowExtendButtons="false" CustomerSearchModel="TraceSearchModel"
OnQueryAsync="OnQueryAsync">
<TableColumns>

View File

@ -11,9 +11,7 @@ public partial class Traces
{
private List<int> PageItemsSource { get; } = new List<int> { 20, 40, 80, 100, 200 };
private TraceSearchModel TraceSearchModel { get; set; } = new();
private List<string> SortList { get; } = new() { "LogTime desc" };
private TraceSearchModel TraceSearchModel { get; } = new();
[Inject]
[NotNull]