mh_custom/wtmProject.Shared/Pages/_Admin/WTM_CUSTOM/Edit.razor
何美荣 ca61741e4c 1
2024-05-28 14:49:22 +08:00

71 lines
3.3 KiB
Plaintext

@page "/_Admin/WTM_CUSTOM/Edit/{id}"
@using wtmProject.Model
@using wtmProject.ViewModel._Admin.WTM_CUSTOMVMs;
@inherits BasePage
<ValidateForm @ref="vform" Model="@Model" OnValidSubmit="@Submit">
<Row ItemsPerRow="ItemsPerRow.Three" RowType="RowType.Normal">
<BootstrapInput @bind-Value="@Model.Entity.CustomAllName" />
<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"]" />
<BootstrapInput @bind-Value="@Model.Entity.CustomCity" />
</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);
}
public void OnClose()
{
CloseDialog();
}
}