106 lines
4.9 KiB
Plaintext
106 lines
4.9 KiB
Plaintext
@page "/_Admin/WTM_CUSTOM/Edit/{id}"
|
|
@using wtmProject.Model
|
|
@using wtmProject.ViewModel._Admin.WTM_CUSTOMVMs;
|
|
@inject MessageService MessageService;
|
|
@inherits BasePage
|
|
|
|
<ValidateForm @ref="vform" Model="@Model" OnValidSubmit="@Submit">
|
|
<Row ItemsPerRow="ItemsPerRow.Two" RowType="RowType.Normal">
|
|
|
|
<BootstrapInput @bind-Value="@Model.Entity.CustomAllName" @oninput="@(val => OnInput(val))" />
|
|
<div class="col-12">@Model.Entity.CustomName</div>
|
|
@* <BootstrapInput @bind-Value="@Model.Entity.CustomShortName" /> *@
|
|
<Select @bind-Value="@Model.Entity.CustomClass" PlaceHolder="@WtmBlazor.Localizer["Sys.PleaseSelect"]" />
|
|
@* <BootstrapInput @bind-Value="@Model.Entity.ParentUnit" />*@
|
|
<Select @bind-Value="@Model.Entity.AreaId" Items="@AllWTM_AREAs" PlaceHolder="@WtmBlazor.Localizer["Sys.PleaseSelect"]" />
|
|
<Select @bind-Value="@Model.Entity.CustomId" Items="@AllWTM_CUSTOMs" ShowSearch=true PlaceHolder="@WtmBlazor.Localizer["Sys.PleaseSelect"]" />
|
|
@* <Select @bind-Value="@Model.Entity.IndustryType" PlaceHolder="@WtmBlazor.Localizer["Sys.PleaseSelect"]" />*@
|
|
<Select @bind-Value="@Model.Entity.EnterprisesType" PlaceHolder="@WtmBlazor.Localizer["Sys.PleaseSelect"]" />
|
|
<Select @bind-Value="@Model.Entity.CreditLevel" PlaceHolder="@WtmBlazor.Localizer["Sys.PleaseSelect"]" />
|
|
<BootstrapInput @bind-Value="@Model.Entity.CustomCity" />
|
|
<Select @bind-Value="@Model.Entity.CustomType" />
|
|
<Textarea @bind-Value="@Model.Entity.BillingFile" rows="3" placeholder="请输入 ..." />
|
|
</Row>
|
|
<br />
|
|
<Table TItem="WTM_CUSTOM_PERSON"
|
|
IsPagination="false" IsTracking=true ShowRefresh="false" ShowEditButton="false"
|
|
IsStriped="true" IsBordered="true" IsMultipleSelect="true" @bind-Items="@list"
|
|
ShowToolbar="true" ShowExtendButtons="true" ShowSkeleton="true"
|
|
EditMode="EditMode.InCell">
|
|
<TableColumns>
|
|
<TableColumn @bind-Field="@context.PersonName" />
|
|
<TableColumn @bind-Field="@context.PersonPhone" />
|
|
<TableColumn @bind-Field="@context.PersonPost" />
|
|
</TableColumns>
|
|
</Table>
|
|
<br />
|
|
<div class="modal-footer table-modal-footer">
|
|
@* <Button Color="Color.Primary" Icon="fa fa-save" Text="@WtmBlazor.Localizer["Sys.Close"]" OnClick="OnClose" />*@
|
|
<Button Color="Color.Primary" ButtonType="ButtonType.Submit" Icon="fa fa-save" Text="@WtmBlazor.Localizer["Sys.Edit"]" IsAsync="true" />
|
|
</div>
|
|
</ValidateForm>
|
|
|
|
@code {
|
|
|
|
private WTM_CUSTOMVM Model = null;
|
|
private ValidateForm vform { get; set; }
|
|
[Parameter]
|
|
public string id { get; set; }
|
|
|
|
private List<SelectedItem> AllWTM_AREAs = new List<SelectedItem>();
|
|
private List<SelectedItem> AllWTM_CUSTOMs = new List<SelectedItem>();
|
|
private IEnumerable<WTM_CUSTOM_PERSON> 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<WTM_CUSTOMVM>($"/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<string>(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<WTM_CUSTOM>(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();
|
|
}
|
|
|
|
}
|