@page "/_Admin/WTM_CUSTOM/Edit/{id}"
@using wtmProject.Model
@using wtmProject.ViewModel._Admin.WTM_CUSTOMVMs;
@inject MessageService MessageService;
@inherits BasePage
OnInput(val))" />
@Model.Entity.CustomName
@* *@
@* *@
@* *@
@code {
private WTM_CUSTOMVM Model = null;
private ValidateForm vform { get; set; }
[Parameter]
public string id { get; set; }
private List AllWTM_AREAs = new List();
private List AllWTM_CUSTOMs = new List();
private IEnumerable list { get; set; }
protected override async Task OnInitializedAsync()
{
AllWTM_AREAs = await WtmBlazor.Api.CallItemsApi("/api/WTM_CUSTOM/GetWTM_AREAs", placeholder: WtmBlazor.Localizer["Sys.PleaseSelect"]);
AllWTM_CUSTOMs = await WtmBlazor.Api.CallItemsApi("/api/WTM_VISIT_PLAN/GetWTM_CUSTOMs", placeholder: WtmBlazor.Localizer["Sys.PleaseSelect"]);
var rv = await WtmBlazor.Api.CallAPI($"/api/WTM_CUSTOM/{id}");
Model = rv.Data;
list = Model.Entity.CustomPerson;
await base.OnInitializedAsync();
}
private async Task Submit(EditContext context)
{
Model.Entity.CustomPerson = list.ToList();
await PostsForm(vform, $"/api/WTM_CUSTOM/edit", (s) => "Sys.OprationSuccess", method: HttpMethodEnum.PUT);
}
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();
}
}