refactor: 优化 Exception 与 任务管理页面

This commit is contained in:
Argo Zhang 2020-02-20 13:26:11 +08:00
parent 9eff344f7e
commit 6e594b08a7
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
5 changed files with 18 additions and 19 deletions

View File

@ -91,6 +91,12 @@ namespace Bootstrap.Admin.Pages.Components
[Parameter] [Parameter]
public bool ShowSearch { get; set; } public bool ShowSearch { get; set; }
/// <summary>
/// 获得/设置 是否显示高级搜索按钮 默认显示
/// </summary>
[Parameter]
public bool ShowAdvancedSearch { get; set; } = true;
/// <summary> /// <summary>
/// 获得/设置 数据集合 /// 获得/设置 数据集合
/// </summary> /// </summary>

View File

@ -36,9 +36,12 @@
<button class="btn btn-secondary" type="button" title="清空过滤" @onclick="ClearSearchClick"> <button class="btn btn-secondary" type="button" title="清空过滤" @onclick="ClearSearchClick">
<i class="fa fa-trash"></i> <span>清空过滤</span> <i class="fa fa-trash"></i> <span>清空过滤</span>
</button> </button>
<button class="btn btn-secondary" type="button" title="高级搜索" @onclick="AdvancedSearchClick"> @if (ShowAdvancedSearch)
<i class="fa fa-search-plus"></i><span>高级搜索</span> {
</button> <button class="btn btn-secondary" type="button" title="高级搜索" @onclick="AdvancedSearchClick">
<i class="fa fa-search-plus"></i><span>高级搜索</span>
</button>
}
</div> </div>
</div> </div>
</div> </div>
@ -194,7 +197,7 @@
</Modal> </Modal>
} }
@if (OnSave != null) @if (OnSave != null || OnAdd != null)
{ {
<SubmitModal @ref="EditModal" Id="@($"{Id}_edit")" TItem="TItem" Title="@SubmitModalTitle" Size="ModalSize.ExtraLarge" @bind-Model="EditModel" OnValidSubmit="Save"> <SubmitModal @ref="EditModal" Id="@($"{Id}_edit")" TItem="TItem" Title="@SubmitModalTitle" Size="ModalSize.ExtraLarge" @bind-Model="EditModel" OnValidSubmit="Save">
<ModalBody> <ModalBody>
@ -203,7 +206,7 @@
</SubmitModal> </SubmitModal>
} }
@if (ShowSearch) @if (ShowSearch && ShowAdvancedSearch)
{ {
<Modal @ref="SearchModal" Id="@($"{Id}_search")" Title="查询条件"> <Modal @ref="SearchModal" Id="@($"{Id}_search")" Title="查询条件">
<ModalBody> <ModalBody>

View File

@ -1,11 +1,11 @@
@inherits ExceptionsBase @inherits ExceptionsBase
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<span>查询结果</span> <span>查询结果</span>
</div> </div>
<div class="card-body"> <div class="card-body">
<Table Id="exception" TItem="Bootstrap.DataAccess.Exceptions" ShowToolBar="true" ShowSearch="true" ShowRefresh="true" QueryModel="QueryModel" EditModel="DataContext" OnQuery="Query" OnResetSearch="ResetSearch"> <Table Id="exception" TItem="Bootstrap.DataAccess.Exceptions" ShowToolBar="true" ShowSearch="true" ShowAdvancedSearch="false" ShowRefresh="true" QueryModel="QueryModel" EditModel="DataContext" OnQuery="Query">
<TableHeader> <TableHeader>
<LgbTableHeader TItem="DateTime" @bind-Value="@context.LogTime" class="text-nowrap datetime"></LgbTableHeader> <LgbTableHeader TItem="DateTime" @bind-Value="@context.LogTime" class="text-nowrap datetime"></LgbTableHeader>
<LgbTableHeader TItem="string" @bind-Value="@context.ErrorPage"></LgbTableHeader> <LgbTableHeader TItem="string" @bind-Value="@context.ErrorPage"></LgbTableHeader>
@ -25,8 +25,6 @@
<TableToolbarTemplate> <TableToolbarTemplate>
<TableToolbarButton class="btn btn-danger" Icon="fa fa-file-text-o" Title="服务器日志" OnClick="ShowDetail" /> <TableToolbarButton class="btn btn-danger" Icon="fa fa-file-text-o" Title="服务器日志" OnClick="ShowDetail" />
</TableToolbarTemplate> </TableToolbarTemplate>
<SearchTemplate>
</SearchTemplate>
</Table> </Table>
</div> </div>
</div> </div>
@ -35,7 +33,7 @@
<ModalBody> <ModalBody>
<form class="form-inline"> <form class="form-inline">
<div class="row"> <div class="row">
@foreach(var item in Items) @foreach (var item in Items)
{ {
<div class="form-group col-md-3 col-sm-4 col-6"> <div class="form-group col-md-3 col-sm-4 col-6">
<a href="#" @onclick:preventDefault OnClick="e => ShowLog(item)">@item</a> <a href="#" @onclick:preventDefault OnClick="e => ShowLog(item)">@item</a>

View File

@ -43,14 +43,6 @@ namespace Bootstrap.Admin.Pages.Views.Admin.Components
return data.ToQueryData(); return data.ToQueryData();
} }
/// <summary>
/// 重置搜索方法
/// </summary>
protected void ResetSearch()
{
}
/// <summary> /// <summary>
/// 获得 错误日志文件集合 /// 获得 错误日志文件集合
/// </summary> /// </summary>

View File

@ -26,7 +26,7 @@ namespace Bootstrap.Admin.Pages.Views.Admin.Components
/// <returns></returns> /// <returns></returns>
protected QueryData<DefaultScheduler> Query(QueryPageOptions options) protected QueryData<DefaultScheduler> Query(QueryPageOptions options)
{ {
var data = TaskServicesManager.ToList().OrderBy(s => s.Name).Select(s => new DefaultScheduler() var data = (string.IsNullOrEmpty(options.SearchText) ? TaskServicesManager.ToList() : TaskServicesManager.ToList().Where(t => t.Name.Contains(options.SearchText, StringComparison.OrdinalIgnoreCase))).OrderBy(s => s.Name).Select(s => new DefaultScheduler()
{ {
Name = s.Name, Name = s.Name,
Status = s.Status, Status = s.Status,