@page "/_Admin/WTM_CUSTOM/Create"
@using wtmProject.Model
@using wtmProject.ViewModel._Admin.WTM_CUSTOMVMs;
@inject MessageService MessageService;
@inherits BasePage
OnInput(val))" />
@Model.Entity.CustomName
@* *@
@* *@
@* *@
@**@
@code {
private WTM_CUSTOMVM Model = new WTM_CUSTOMVM();
private ValidateForm vform { get; set; }
private List AllWTM_AREAs = new List();
private IEnumerable CustomPersonList { get; set; } = new List();
private List AllWTM_CUSTOMs = new List();
protected override async Task OnInitializedAsync()
{
AllWTM_CUSTOMs = await WtmBlazor.Api.CallItemsApi("/api/WTM_VISIT_PLAN/GetWTM_CUSTOMs", placeholder: WtmBlazor.Localizer["Sys.PleaseSelect"]);
AllWTM_AREAs = await WtmBlazor.Api.CallItemsApi("/api/WTM_CUSTOM/GetWTM_AREAs", placeholder: WtmBlazor.Localizer["Sys.PleaseSelect"]);
await base.OnInitializedAsync();
}
private async Task Submit(EditContext context)
{
Model.Entity.CustomPerson = CustomPersonList.ToList();
await PostsForm(vform, "/api/WTM_CUSTOM/add", (s) => "Sys.OprationSuccess");
}
private async Task OnInput(ChangeEventArgs e)
{
if (!string.IsNullOrEmpty(e.Value.ToString()))
{
var url = $"/api/WTM_CUSTOM/GetNameList?name={e.Value.ToString()}";
var temp = await WtmBlazor.Api.CallAPI(url);
if (temp != null && !string.IsNullOrEmpty(temp.Data))
{
Model.Entity.CustomName = temp.Data;
return;
}
else
{
Model.Entity.CustomName = null;
return;
}
// var url = $"/api/WTM_CUSTOM/GetName?name={e.Value.ToString()}";
// var rv = await WtmBlazor.Api.CallAPI(url);
// if (rv.Data != null)
// {
// await MessageService.Show(new MessageOption()
// {
// Content = "请勿重复添加,该客户已存在",
// Icon = "fa-solid fa-circle-info",
// Color = Color.Danger
// });
// return;
// }
}
// return new Task;
}
public void OnClose()
{
CloseDialog();
}
}