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" IsPagination="IsPagination" PageItemsSource="PageItemsSource" IsFixedHeader="IsFixedHeader"
IsTree="IsTree" OnTreeExpand="OnTreeExpand!" TreeIcon="fa-chevron-circle-right" IsTree="IsTree" OnTreeExpand="OnTreeExpand!" TreeIcon="fa-chevron-circle-right"
ShowDefaultButtons="ShowDefaultButtons" ShowAdvancedSearch="ShowAdvancedSearch" 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!" OnQueryAsync="OnQueryAsync!" OnDeleteAsync="OnDeleteAsync!" OnSaveAsync="OnSaveAsync!"
ShowSkeleton="true" ShowLoading="ShowLoading" ShowSearch="ShowSearch" ShowSkeleton="true" ShowLoading="ShowLoading" ShowSearch="ShowSearch"
ShowToolbar="ShowToolbar" ShowExtendButtons="ShowExtendButtons" ShowAddButton="@AuthorizeButton("add")" ShowToolbar="ShowToolbar" ShowExtendButtons="ShowExtendButtons" ShowAddButton="@AuthorizeButton("add")"

View File

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

View File

@ -1,6 +1,6 @@
@page "/Admin/Dicts" @page "/Admin/Dicts"
<AdminTable TItem="DataAccess.Models.Dict" CustomerSearchModel="DictsSearchModel" SortList="SortList"> <AdminTable TItem="DataAccess.Models.Dict" CustomerSearchModel="DictsSearchModel" SortString="Define, Category, Name">
<TableColumns> <TableColumns>
<TableColumn @bind-Field="context.Category" Filterable="true" Searchable="true" Sortable="true"></TableColumn> <TableColumn @bind-Field="context.Category" Filterable="true" Searchable="true" Sortable="true"></TableColumn>
<TableColumn @bind-Field="context.Name" 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> /// </summary>
public partial class Dicts public partial class Dicts
{ {
private ITableSearchModel DictsSearchModel { get; set; } = new DictsSearchModel(); private ITableSearchModel DictsSearchModel { get; } = new DictsSearchModel();
private List<string> SortList { get; } = new List<string> { "Define", "Category", "Name" };
} }
} }

View File

@ -1,6 +1,6 @@
@page "/admin/logins" @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"> ShowDefaultButtons="false" ShowExtendButtons="false">
<TableColumns> <TableColumns>
<TableColumn @bind-Field="@context.UserName" Filterable="true" Searchable="true"></TableColumn> <TableColumn @bind-Field="@context.UserName" Filterable="true" Searchable="true"></TableColumn>

View File

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

View File

@ -31,10 +31,10 @@
<AdminAlert Text="演示系统禁止修改内置后台任务" IsShow="IsDemo" /> <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" SelectedRows="SelectedRows"
ShowEditButtonCallback="OnShowButtonCallback" ShowDeleteButtonCallback="OnShowButtonCallback" ShowEditButtonCallback="OnShowButtonCallback" ShowDeleteButtonCallback="OnShowButtonCallback"
OnQueryAsync="OnQueryAsync" OnDeleteAsync="OnDeleteAsync" OnSaveAsync="OnSaveAsync"> OnQueryAsync="OnQueryAsync" OnDeleteAsync="OnDeleteAsync" OnSaveAsync="OnSaveAsync">
<TableColumns> <TableColumns>
<TableColumn @bind-Field="@context.Name" Sortable="true" Filterable="true" Searchable="true" Width="80"></TableColumn> <TableColumn @bind-Field="@context.Name" Sortable="true" Filterable="true" Searchable="true" Width="80"></TableColumn>
<TableColumn @bind-Field="@context.CreateTime" Sortable="true" Filterable="true" Searchable="true" FormatString="yyyy-MM-dd HH:mm:ss"></TableColumn> <TableColumn @bind-Field="@context.CreateTime" Sortable="true" Filterable="true" Searchable="true" FormatString="yyyy-MM-dd HH:mm:ss"></TableColumn>

View File

@ -30,8 +30,6 @@ public partial class Tasks
private bool IsDemo { get; set; } private bool IsDemo { get; set; }
private List<string> SortList { get; } = new List<string>() { "Name", "LastRuntime desc" };
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -45,6 +43,10 @@ public partial class Tasks
private Task<QueryData<TasksModel>> OnQueryAsync(QueryPageOptions options) private Task<QueryData<TasksModel>> OnQueryAsync(QueryPageOptions options)
{ {
var tasks = TaskServicesManager.ToList().ToTasksModelList(); 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); var model = tasks.FirstOrDefault(i => i.Name == SelectedRows.FirstOrDefault()?.Name);
SelectedRows.Clear(); SelectedRows.Clear();
if (model != null) if (model != null)
@ -83,7 +85,7 @@ public partial class Tasks
return Task.FromResult(true); 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 private static Color GetResultColor(TriggerResult result) => result switch
{ {
@ -122,7 +124,8 @@ public partial class Tasks
private static string GetStatusIcon(SchedulerStatus status) => status switch private static string GetStatusIcon(SchedulerStatus status) => status switch
{ {
SchedulerStatus.Running => "fa fa-play-circle", 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" @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" ShowDefaultButtons="false" ShowExtendButtons="false" CustomerSearchModel="TraceSearchModel"
OnQueryAsync="OnQueryAsync"> OnQueryAsync="OnQueryAsync">
<TableColumns> <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 List<int> PageItemsSource { get; } = new List<int> { 20, 40, 80, 100, 200 };
private TraceSearchModel TraceSearchModel { get; set; } = new(); private TraceSearchModel TraceSearchModel { get; } = new();
private List<string> SortList { get; } = new() { "LogTime desc" };
[Inject] [Inject]
[NotNull] [NotNull]