feat: 更新 TaskEditor 组件
This commit is contained in:
parent
794d90731a
commit
23dd2d05df
|
@ -0,0 +1,11 @@
|
||||||
|
<div class="row g-3 form-inline">
|
||||||
|
<div class="col-12">
|
||||||
|
<BootstrapInput @bind-Value="@Value.Name" placeholder="不可为空,50字以内" maxlength="50" />
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<Select @bind-Value="@Value.Trigger" Items="Items" />
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<Display TValue="string" Value="@TaskName" ShowLabel="true" DisplayText="内置任务" />
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -0,0 +1,35 @@
|
||||||
|
using BootstrapAdmin.Web.Models;
|
||||||
|
|
||||||
|
namespace BootstrapAdmin.Web.Components;
|
||||||
|
|
||||||
|
public partial class TaskEditor
|
||||||
|
{
|
||||||
|
[Parameter]
|
||||||
|
[NotNull]
|
||||||
|
public TasksModel? Value { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public EventCallback<TasksModel> ValueChanged { get; set; }
|
||||||
|
|
||||||
|
private static string TaskName => "测试任务";
|
||||||
|
|
||||||
|
[NotNull]
|
||||||
|
private List<SelectedItem>? Items { get; set; }
|
||||||
|
|
||||||
|
protected override void OnInitialized()
|
||||||
|
{
|
||||||
|
base.OnInitialized();
|
||||||
|
|
||||||
|
Items = new List<SelectedItem>
|
||||||
|
{
|
||||||
|
new(Longbow.Tasks.Cron.Secondly(5), "每 5 秒钟执行一次"),
|
||||||
|
new(Longbow.Tasks.Cron.Minutely(1), "每 1 分钟钟执行一次"),
|
||||||
|
new(Longbow.Tasks.Cron.Minutely(5), "每 5 分钟执行一次"),
|
||||||
|
};
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(Value.Trigger))
|
||||||
|
{
|
||||||
|
Value.Trigger = Items.First().Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue