mh_custom/wtmProject.Shared/Pages/CustomCreate.razor

64 lines
3.4 KiB
Plaintext
Raw Permalink Normal View History

2024-05-16 17:30:33 +08:00
@page "/CustomCreate/Create"
@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" />
@* <BootstrapInput @bind-Value="@Model.Entity.ParentUnit" />*@
<Select @bind-Value="@Model.Entity.CustomClass" PlaceHolder="@WtmBlazor.Localizer["Sys.PleaseSelect"]" />
<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"]" />
</Row>
<br />
<Table TItem="WTM_CUSTOM_PERSON"
IsPagination="false" IsTracking=true ShowRefresh="false" ShowEditButton="false"
IsStriped="true" IsBordered="true" IsMultipleSelect="true" @bind-Items="@CustomPersonList"
ShowToolbar="true" ShowExtendButtons="true" ShowSkeleton="true" EditMode="EditMode.InCell" ShowToastAfterSaveOrDeleteModel="false" style="margin-top:10px;">
<TableColumns>
<TableColumn @bind-Field="@context.PersonName" />
<TableColumn @bind-Field="@context.PersonPhone" />
<TableColumn @bind-Field="@context.PersonPost" />
</TableColumns>
</Table>
<br />
@*<Table @ref="dataTable" TItem="WTM_CUSTOM_PERSON" IsPagination="true" IsStriped="true" IsBordered="true" ShowRefresh="false"
ShowToolbar="true" IsMultipleSelect="true" ShowExtendButtons="true" ShowDefaultButtons="false" ShowExtendEditButton="false" ShowExtendDeleteButton="false" style="margin-top:10px;">
</Table>*@
<div class="modal-footer table-modal-footer">
@*<Button Color="Color.Secondary" Icon="fa fa-close" Text="@WtmBlazor.Localizer["Sys.Close"]" OnClick="OnClose" />*@
<Button Color="Color.Primary" ButtonType="ButtonType.Submit" Icon="fa fa-save" Text="@WtmBlazor.Localizer["Sys.Save"]" IsAsync="true" />
</div>
</ValidateForm>
@code {
private WTM_CUSTOMVM Model = new WTM_CUSTOMVM();
private ValidateForm vform { get; set; }
private List<SelectedItem> AllWTM_AREAs = new List<SelectedItem>();
private IEnumerable<WTM_CUSTOM_PERSON> CustomPersonList { get; set; } = new List<WTM_CUSTOM_PERSON>();
private List<SelectedItem> AllWTM_CUSTOMs = new List<SelectedItem>();
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");
}
public void OnClose()
{
CloseDialog();
}
}