mh_custom/wtmProject.Shared/Pages/_Admin/FrameworkTenant/Create.razor

51 lines
1.9 KiB
Plaintext
Raw Permalink Normal View History

2024-05-16 17:30:33 +08:00
@page "/_Admin/FrameworkTenant/Create"
@using WalkingTec.Mvvm.Mvc.Admin.ViewModels.FrameworkTenantVMs
@inherits BasePage
<ValidateForm @ref="vform" Model="@Model" OnValidSubmit="@Submit">
<Row ItemsPerRow="ItemsPerRow.Two">
<BootstrapInput @bind-Value="@Model.Entity.TCode" />
<BootstrapInput @bind-Value="@Model.Entity.TName" />
<BootstrapInput @bind-Value="@Model.Entity.TDb" />
<Select @bind-Value="@Model.Entity.TDbType" />
<BootstrapInput @bind-Value="@Model.Entity.DbContext" />
<BootstrapInput @bind-Value="@Model.Entity.TDomain" />
<Select @bind-Value="@Model.Entity.EnableSub" Items="WtmBlazor.GlobalSelectItems.BoolItems"/>
<Select @bind-Value="@Model.Entity.Enabled" Items="WtmBlazor.GlobalSelectItems.BoolItems"/>
</Row>
<Row ItemsPerRow="ItemsPerRow.Two">
<Select @bind-Value="@Model.AdminRoleCode" Items="@AllParents" />
<div style="padding-top:35px;">@WtmBlazor.Localizer["_Admin.TenantRole"]</div>
</Row>
<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.Create"]" IsAsync="true" />
</div>
</ValidateForm>
@code {
private FrameworkTenantVM Model = new FrameworkTenantVM();
private ValidateForm vform { get; set; }
private List<SelectedItem> AllParents = new List<SelectedItem>();
protected override async Task OnInitializedAsync()
{
AllParents = await WtmBlazor.Api.CallItemsApi("/api/_account/GetFrameworkRoles", placeholder: WtmBlazor.Localizer["Sys.PleaseSelect"]);
}
private async Task Submit(EditContext context)
{
await PostsForm(vform, "/api/_FrameworkTenant/add", (s) => "Sys.OprationSuccess");
}
public void OnClose()
{
CloseDialog();
}
}