using AntDesign; using Microsoft.AspNetCore.Components; using System.Collections.Generic; using System; using wispro.sp.entity.CompareCase; using wispro.sp.entity; using AntDesign.TableModels; using System.Threading.Tasks; using wispro.sp.web.Services; using wispro.sp.share; namespace wispro.sp.web.Pages.CompareFile { public partial class List { [Inject] public CompareFileService _CompareFileService { get; set; } int _pageIndex = 1; int _pageSize = 10; Pagination _pagination; int _total; bool _loading = false; QueryFilter _filter; Field _selectedItem; List _caseList; List _fields = new List() { new Field(){ FieldName="处理人",FieldValue="Handlers"}, new Field(){ FieldName="审核人",FieldValue="Reviewer.Name"}, new Field(){ FieldName="客户",FieldValue="Customer.Name"}, new Field(){ FieldName="案号",FieldValue="CaseNo"}, new Field(){ FieldName="案件名称",FieldValue="CaseName"} }; protected override async Task OnInitializedAsync() { _filter = new QueryFilter(); _filter.PageIndex = 1; _filter.PageSize = 1; await GetData(); StateHasChanged(); } private void OnSelectedItemChangedHandler(Field value) { _selectedItem = value; } private string txtValue = string.Empty; private async void OnSearch() { if (!string.IsNullOrEmpty(txtValue)) { _filter.ConditionTree.Clear(); _filter.ConditionTree.Add( new FieldCondition() { FieldName = _selectedItem.FieldValue, LogicOperate = LogicEnum.And, Operator = OperatorEnum.Contains, Value = txtValue, ValueType = "System.String" } ); } await GetData(); StateHasChanged(); } private int serialNumber(int pageIndex, int pageSize, int id) { int iIndex = 0; foreach (CaseInfo sf in _caseList) { iIndex++; if (sf.Id == id) { break; } } return (pageIndex - 1) * pageSize + iIndex; } CaseInfo _currentCase = null; private void Showdetail(CaseInfo caseInfo) { _currentCase = caseInfo; } private async Task GetData() { _loading = true; var data = await _CompareFileService.Query(_filter); _caseList = data.Results; _total = data.TotalCount; _loading = false; StateHasChanged(); } async void OnPageChange(PaginationEventArgs args) { _pageIndex = args.Page; _pageSize = args.PageSize; await GetData(); StateHasChanged(); } class Field { public string FieldName { get; set; } public string FieldValue { get; set; } } } }