mh_custom/wtmProject.Shared/Pages/_Admin/WTM_BUSINESS/Index.razor

203 lines
10 KiB
Plaintext
Raw Permalink Normal View History

2026-01-06 10:55:05 +08:00
@page "/_Admin/WTM_BUSINESS"
@using wtmProject.ViewModel._Admin.WTM_BUSINESSVMs;
@inherits BasePage
@attribute [ActionDescription("商机线索维护", "wtmProject.Controllers,WTM_BUSINESS")]
<WTSearchPanel OnSearch="@DoSearch">
<ValidateForm Model="@SearchModel">
<Row ItemsPerRow="ItemsPerRow.Three" RowType="RowType.Inline">
<MultiSelect @bind-Value="@SearchModel.SelectedItemsID" Items="Items1" PlaceHolder="@WtmBlazor.Localizer["Sys.PleaseSelect"]" />
<BootstrapInput @bind-Value="@SearchModel.Year" />
<Select @bind-Value="@SearchModel.CustomId" Items="@AllWTM_CUSTOMs" ShowSearch=true PlaceHolder="@WtmBlazor.Localizer["Sys.All"]" />
<Select @bind-Value="@SearchModel.AreaId" Items="@AllWTM_AREAs" PlaceHolder="@WtmBlazor.Localizer["Sys.All"]"/>
<Select @bind-Value="@SearchModel.BusinessSource" PlaceHolder="@WtmBlazor.Localizer["Sys.PleaseSelect"]" />
@* <Select @bind-Value="@SearchModel.IndustryType" PlaceHolder="@WtmBlazor.Localizer["Sys.All"]"/>*@
<Select @bind-Value="@SearchModel.ProjectId" Items="@AllWTM_PROJECTs" ShowSearch="true" PlaceHolder="@WtmBlazor.Localizer["Sys.All"]" />
<Select @bind-Value="@SearchModel.MarkManageId" Items="@AllFrameworkUsers" ShowSearch=true 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_BUSINESS_View" OnQueryAsync="OnSearch" IsPagination="true" IsStriped="false" IsBordered="true" ShowRefresh="false"
FixedMultipleColumn="true" IsFixedHeader="true" Height="500" ShowColumnList="true"
ShowToolbar="true" IsMultipleSelect="true" ShowExtendButtons="true" ShowDefaultButtons="false" ShowExtendEditButton="false" ShowExtendDeleteButton="false" style="margin-top:10px;">
<TableColumns>
<TableColumn @bind-Field="@context.Year" Width="50" Fixed />
<TableColumn @bind-Field="@context.Month" Width="50" Fixed />
<TableColumn @bind-Field="@context.CustomAllName_view" Width="300" Fixed TextWrap="true">
<Template Context="value">
<div class="text-primary" @onclick="()=>OnDetailsClick(value.Row)">@value.Value</div>
</Template>
</TableColumn>
<TableColumn @bind-Field="@context.AreaName_view" Width="100" />
<TableColumn @bind-Field="@context.Name_view" Width="100" />
<TableColumn @bind-Field="@context.ProjectName_view" Width="100" />
<TableColumn @bind-Field="@context.BusinessName" Width="150" TextWrap="true" />
<TableColumn @bind-Field="@context.BusinessSource" Width="100" />
@* <TableColumn @bind-Field="@context.PersonName_view" /> *@
<TableColumn @bind-Field="@context.BusinessStatus" Width="100" />
<TableColumn @bind-Field="@context.ProjectTarget" Width="100" />
@* <TableColumn @bind-Field="@context.IndustryType" />*@
<TableColumn @bind-Field="@context.DealRate" Width="100" />
<TableColumn @bind-Field="@context.PreSignDate" Width="100" FormatString="yyyy-MM" />
<TableColumn @bind-Field="@context.ActSignDate" Width="100" FormatString="yyyy-MM" />
<TableColumn @bind-Field="@context.DealCycle" Width="100"/>
<TableColumn @bind-Field="@context.DealMoney" Width="100" />
@* <TableColumn @bind-Field="@context.UpdateTime" FormatString="yyyy-MM-dd" /> *@
@* <TableColumn @bind-Field="@context.UpdateBy" /> *@
</TableColumns>
<TableToolbarTemplate>
@if (IsAccessable("/api/WTM_BUSINESS/Add"))
{
<TableToolbarButton TItem="WTM_BUSINESS_View" Color="Color.Primary" Icon="fa fa-fw fa-plus" Text="@WtmBlazor.Localizer["Sys.Create"]" OnClickCallback="OnCreateClick" />
}
@* @if (IsAccessable("/api/WTM_BUSINESS/BatchDelete"))
{
<TableToolbarPopconfirmButton TItem="WTM_BUSINESS_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_BUSINESS/Import"))
{
<TableToolbarButton TItem="WTM_BUSINESS_View" Color="Color.Primary" Icon="fa fa-fw fa-upload" Text="@WtmBlazor.Localizer["Sys.Import"]" OnClickCallback="@OnImportClick" />
}
@if (IsAccessable("/api/WTM_BUSINESS/ExportExcel"))
{
<TableToolbarButton TItem="WTM_BUSINESS_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;">
@* && context.CreateBy == UserInfo.ITCode *@
@if (IsAccessable("/api/WTM_BUSINESS/Edit"))
{
<TableCellButton Size="Size.ExtraSmall" Color="Color.Success" Icon="fa fa-edit" Text="@WtmBlazor.Localizer["Sys.Edit"]" OnClick="() => OnEditClick(context)" />
}
@if (IsAccessable("/api/WTM_BUSINESS/{id}"))
{
<TableCellButton Size="Size.ExtraSmall" Color="Color.Info" Icon="fa fa-info" Text="@WtmBlazor.Localizer["Sys.Details"]" OnClick="()=>OnDetailsClick(context)" />
}
@if (IsAccessable("/api/WTM_BUSINESS/BatchDelete"))
{
<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_BUSINESSSearcher SearchModel = new WTM_BUSINESSSearcher();
private Table<WTM_BUSINESS_View> dataTable;
private List<SelectedItem> AllWTM_CUSTOMs = new List<SelectedItem>();
private List<SelectedItem> AllFrameworkUsers = new List<SelectedItem>();
private List<SelectedItem> AllWTM_AREAs = new List<SelectedItem>();
private List<SelectedItem> AllWTM_PROJECTs = new List<SelectedItem>();
private List<SelectedItem> Items1 = new List<SelectedItem>();
[Inject]
private IJSRuntime jsRuntime { get; set; }
[Inject]
private NavigationManager NavigationManager { get; set; }
protected override async Task OnInitializedAsync()
{
AllWTM_CUSTOMs = await WtmBlazor.Api.CallItemsApi("/api/WTM_BUSINESS/GetWTM_CUSTOMs", placeholder: WtmBlazor.Localizer["Sys.All"]);
AllFrameworkUsers = await WtmBlazor.Api.CallItemsApi("/api/WTM_BUSINESS/GetFrameworkUsers", placeholder: WtmBlazor.Localizer["Sys.All"]);
AllWTM_AREAs = await WtmBlazor.Api.CallItemsApi("/api/WTM_BUSINESS/GetWTM_AREAs", placeholder: WtmBlazor.Localizer["Sys.All"]);
AllWTM_PROJECTs = await WtmBlazor.Api.CallItemsApi("/api/WTM_BUSINESS/GetWTM_PROJECTs", placeholder: WtmBlazor.Localizer["Sys.All"]);
Items1 = GenerateItems();
_ = jsRuntime.InvokeVoidAsync("setTabTitle", "商机线索");
await base.OnInitializedAsync();
}
private List<SelectedItem> GenerateItems() => new List<SelectedItem>
{
new ("0", "线索获取"),
new ("1", "内部立项"),
new ("2", "商务跟进"),
new ("3", "项目成交"),
new ("4", "暂时搁置"),
new ("5", "项目关闭")
};
private async Task<QueryData<WTM_BUSINESS_View>> OnSearch(QueryPageOptions opts)
{
return await StartSearch<WTM_BUSINESS_View>("/api/WTM_BUSINESS/Search", SearchModel, opts);
}
private void DoSearch()
{
dataTable.QueryAsync();
}
private async Task OnCreateClick(IEnumerable<WTM_BUSINESS_View> items)
{
if (await OpenDialog<Create>(WtmBlazor.Localizer["Sys.Create"]) == DialogResult.Yes)
{
await dataTable.QueryAsync();
}
}
private async Task OnEditClick(WTM_BUSINESS_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_BUSINESS_View item)
{
await OpenDialog<Details>(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_BUSINESS/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_BUSINESS_View item)
{
await PostsData(new List<string> { item.ID.ToString() }, $"/api/WTM_BUSINESS/batchdelete", (s) => "Sys.OprationSuccess");
await dataTable.QueryAsync();
}
private async Task OnExportClick(IEnumerable<WTM_BUSINESS_View> items)
{
if (dataTable.SelectedRows?.Any() == true)
{
await Download("/api/WTM_BUSINESS/ExportExcelByIds", dataTable.SelectedRows.Select(x => x.ID.ToString()).ToList());
}
else
{
await Download("/api/WTM_BUSINESS/ExportExcel", SearchModel);
}
}
private async Task OnImportClick(IEnumerable<WTM_BUSINESS_View> items)
{
if (await OpenDialog<Import>(WtmBlazor.Localizer["Sys.Import"]) == DialogResult.Yes)
{
await dataTable.QueryAsync();
}
}
}