169 lines
7.6 KiB
Plaintext
169 lines
7.6 KiB
Plaintext
@page "/_Admin/WTM_CUSTOM"
|
|
@using wtmProject.ViewModel._Admin.WTM_CUSTOMVMs;
|
|
@inherits BasePage
|
|
@attribute [ActionDescription("客户维护", "wtmProject.Controllers,WTM_CUSTOM")]
|
|
|
|
@*<WTSearchPanel OnSearch="@DoSearch">*@
|
|
<ValidateForm Model="@SearchModel">
|
|
<Row ItemsPerRow="ItemsPerRow.Three" RowType="RowType.Inline">
|
|
|
|
<BootstrapInput @bind-Value="@SearchModel.CustomAllName" />
|
|
<Select @bind-Value="@SearchModel.AreaId" Items="@AllWTM_AREAs" PlaceHolder="@WtmBlazor.Localizer["Sys.All"]"/>
|
|
<Button Color="Color.Primary" Icon="fa fa-search" Text="@WtmBlazor.Localizer["Sys.Search"]" OnClick="@DoSearch" />
|
|
</Row>
|
|
</ValidateForm>
|
|
@*</WTSearchPanel>*@
|
|
|
|
|
|
|
|
<Table @ref="dataTable" TItem="WTM_CUSTOM_View" OnQueryAsync="OnSearch" IsPagination="true" IsStriped="false" IsBordered="true" ShowRefresh="false"
|
|
ShowToolbar="true" IsMultipleSelect="true" ShowExtendButtons="true" ShowDefaultButtons="false" ShowExtendEditButton="false" ShowExtendDeleteButton="false" style="margin-top:10px;">
|
|
<TableColumns>
|
|
|
|
<TableColumn @bind-Field="@context.CustomAllName" />
|
|
<TableColumn @bind-Field="@context.CustomShortName" />
|
|
<TableColumn @bind-Field="@context.CustomClass" />
|
|
<TableColumn @bind-Field="@context.ParentName_view" />
|
|
<TableColumn @bind-Field="@context.EnterprisesType" />
|
|
<TableColumn @bind-Field="@context.AreaName_view" />
|
|
<TableColumn @bind-Field="@context.CustomCity" />
|
|
<TableColumn @bind-Field="@context.PersonCount_view" />
|
|
@* <TableColumn @bind-Field="@context.CreateBy" />*@
|
|
</TableColumns>
|
|
<TableToolbarTemplate>
|
|
@if (IsAccessable("/api/WTM_CUSTOM/Add"))
|
|
{
|
|
<TableToolbarButton TItem="WTM_CUSTOM_View" Color="Color.Primary" Icon="fa fa-fw fa-plus" Text="@WtmBlazor.Localizer["Sys.Create"]" OnClickCallback="OnCreateClick" />
|
|
}
|
|
@* @if (IsAccessable("/api/WTM_CUSTOM/BatchDelete"))
|
|
{
|
|
<TableToolbarPopconfirmButton TItem="WTM_CUSTOM_View" Color="Color.Primary"
|
|
Icon="fa fa-fw fa-trash" Text="@WtmBlazor.Localizer["Sys.BatchDelete"]"
|
|
OnConfirm="@OnBatchDeleteClick" Content="@WtmBlazor.Localizer["Sys.BatchDeleteConfirm"]" CloseButtonText="@WtmBlazor.Localizer["Sys.Close"]"
|
|
ConfirmButtonText="@WtmBlazor.Localizer["Sys.BatchDelete"]" ConfirmButtonColor="Color.Danger" />
|
|
}*@
|
|
|
|
@if (IsAccessable("/api/WTM_CUSTOM/Import"))
|
|
{
|
|
<TableToolbarButton TItem="WTM_CUSTOM_View" Color="Color.Primary" Icon="fa fa-fw fa-upload" Text="@WtmBlazor.Localizer["Sys.Import"]" OnClickCallback="@OnImportClick" />
|
|
}
|
|
@if (IsAccessable("/api/WTM_CUSTOM/ExportExcel"))
|
|
{
|
|
<TableToolbarButton TItem="WTM_CUSTOM_View" Color="Color.Primary" Icon="fa fa-fw fa-download" Text="@WtmBlazor.Localizer["Sys.Export"]" OnClickCallback="@OnExportClick" IsAsync="true" />
|
|
}
|
|
</TableToolbarTemplate>
|
|
<RowButtonTemplate>
|
|
<div style="padding-right:10px;">
|
|
@if (IsAccessable("/api/WTM_CUSTOM/Edit") && context.CreateBy == UserInfo.ITCode)
|
|
{
|
|
<TableCellButton Size="Size.ExtraSmall" Color="Color.Success" Icon="fa fa-edit" Text="@WtmBlazor.Localizer["Sys.Edit"]" OnClick="() => OnEditClick(context)" />
|
|
}
|
|
@* @if (IsAccessable("/api/WTM_CUSTOM/{id}"))
|
|
{
|
|
<TableCellButton Size="Size.ExtraSmall" Color="Color.Info" Icon="fa fa-info" Text="@WtmBlazor.Localizer["Sys.Details"]" OnClick="()=>OnDetailsClick(context)" />
|
|
}*@
|
|
@if (IsAccessable("/api/WTM_CUSTOM/{id}"))
|
|
{
|
|
<TableCellButton Size="Size.ExtraSmall" Color="Color.Info" Icon="fa fa-info" Text="@WtmBlazor.Localizer["Sys.Details"]" OnClick="()=>OnDetailsClick(context)" />
|
|
}
|
|
@if (IsAccessable("/api/WTM_CUSTOM/BatchDelete") && context.CreateBy == UserInfo.ITCode)
|
|
{
|
|
<PopConfirmButton Icon="fa fa-trash" Text="@WtmBlazor.Localizer["Sys.Delete"]" OnConfirm="() => OnDeleteClick(context)" Color="Color.Danger" Size="Size.ExtraSmall"
|
|
Content="@WtmBlazor.Localizer["Sys.DeleteConfirm"]" CloseButtonText="@WtmBlazor.Localizer["Sys.Close"]" ConfirmButtonText="@WtmBlazor.Localizer["Sys.Delete"]" ConfirmButtonColor="Color.Danger" />
|
|
}
|
|
</div>
|
|
</RowButtonTemplate>
|
|
</Table>
|
|
|
|
@code{
|
|
|
|
private WTM_CUSTOMSearcher SearchModel = new WTM_CUSTOMSearcher();
|
|
private Table<WTM_CUSTOM_View> dataTable;
|
|
|
|
private List<SelectedItem> AllWTM_AREAs = new List<SelectedItem>();
|
|
|
|
[Inject]
|
|
private IJSRuntime jsRuntime { get; set; }
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
|
|
AllWTM_AREAs = await WtmBlazor.Api.CallItemsApi("/api/WTM_CUSTOM/GetWTM_AREAs", placeholder: WtmBlazor.Localizer["Sys.All"]);
|
|
_ = jsRuntime.InvokeVoidAsync("setTabTitle", "客户档案");
|
|
await base.OnInitializedAsync();
|
|
}
|
|
|
|
private async Task<QueryData<WTM_CUSTOM_View>> OnSearch(QueryPageOptions opts)
|
|
{
|
|
return await StartSearch<WTM_CUSTOM_View>("/api/WTM_CUSTOM/Search", SearchModel, opts);
|
|
}
|
|
|
|
private void DoSearch()
|
|
{
|
|
dataTable.QueryAsync();
|
|
}
|
|
|
|
private async Task OnCreateClick(IEnumerable<WTM_CUSTOM_View> items)
|
|
{
|
|
if (await OpenDialog<Create>(WtmBlazor.Localizer["Sys.Create"]) == DialogResult.Yes)
|
|
{
|
|
await dataTable.QueryAsync();
|
|
}
|
|
}
|
|
|
|
private async Task OnEditClick(WTM_CUSTOM_View item)
|
|
{
|
|
if (await OpenDialog<Edit>(WtmBlazor.Localizer["Sys.Edit"], x => x.id == item.ID.ToString()) == DialogResult.Yes)
|
|
{
|
|
await dataTable.QueryAsync();
|
|
}
|
|
}
|
|
|
|
//private async Task OnDetailsClick(WTM_CUSTOM_View item)
|
|
//{
|
|
// await OpenDialog<Details>(WtmBlazor.Localizer["Sys.Details"], x => x.id == item.ID.ToString());
|
|
//}
|
|
private async Task OnDetailsClick(WTM_CUSTOM_View item)
|
|
{
|
|
await OpenDialog<Report>(WtmBlazor.Localizer["Sys.Details"], x => x.id == item.ID.ToString());
|
|
}
|
|
private async Task OnBatchDeleteClick()
|
|
{
|
|
if (dataTable.SelectedRows?.Any() == true)
|
|
{
|
|
await PostsData(dataTable.SelectedRows.Select(x => x.ID).ToList(), $"/api/WTM_CUSTOM/batchdelete", (s) => WtmBlazor.Localizer["Sys.BatchDeleteSuccess", s]);
|
|
await dataTable.QueryAsync();
|
|
}
|
|
else
|
|
{
|
|
await WtmBlazor.Toast.Information(WtmBlazor.Localizer["Sys.Info"], WtmBlazor.Localizer["Sys.SelectOneRowMin"]);
|
|
}
|
|
}
|
|
|
|
private async Task OnDeleteClick(WTM_CUSTOM_View item)
|
|
{
|
|
await PostsData(new List<string> { item.ID.ToString() }, $"/api/WTM_CUSTOM/batchdelete", (s) => "Sys.OprationSuccess");
|
|
await dataTable.QueryAsync();
|
|
}
|
|
|
|
|
|
private async Task OnExportClick(IEnumerable<WTM_CUSTOM_View> items)
|
|
{
|
|
if (dataTable.SelectedRows?.Any() == true)
|
|
{
|
|
await Download("/api/WTM_CUSTOM/ExportExcelByIds", dataTable.SelectedRows.Select(x => x.ID.ToString()).ToList());
|
|
}
|
|
else
|
|
{
|
|
await Download("/api/WTM_CUSTOM/ExportExcel", SearchModel);
|
|
}
|
|
}
|
|
private async Task OnImportClick(IEnumerable<WTM_CUSTOM_View> items)
|
|
{
|
|
if (await OpenDialog<Import>(WtmBlazor.Localizer["Sys.Import"]) == DialogResult.Yes)
|
|
{
|
|
await dataTable.QueryAsync();
|
|
}
|
|
}
|
|
|
|
}
|