using AntDesign; using AntDesign.TableModels; using Microsoft.AspNetCore.Components; using Microsoft.JSInterop; using System; using System.Collections.Generic; using System.Linq; using System.Text.Json; using System.Threading.Tasks; using wispro.sp.entity; using wispro.sp.web.Services; namespace wispro.sp.web.Pages.Project { public partial class ProjectSearch { List ProjectInfos; int _pageIndex = 1; int _pageSize = 10; int _total = 0; bool _loading = false; ITable table; [Inject] protected IProjectService _itemService { get; set; } [Inject] public MessageService MsgSvr { get; set; } [Inject] protected NavigationManager navigation { get; set; } [Inject] protected IAuthService _authService { get; set; } [Inject] protected IJSRuntime JSRuntime { get; set; } protected async override Task OnInitializedAsync() { string strResourceId = navigation.Uri.Replace(navigation.BaseUri,"/"); Console.WriteLine(navigation.ToAbsoluteUri(navigation.Uri)); Console.WriteLine(navigation.ToBaseRelativePath(navigation.Uri)); var canVisist = await _authService.CanVisitResource(strResourceId); if (!canVisist) { var config = new MessageConfig() { Content = "您没有权限使用该功能", Type = MessageType.Error }; var ret = MsgSvr.Open(config); await JSRuntime.InvokeVoidAsync("history.back"); } ProjectInfos = await _itemService.GetAllProjects(); _total = ProjectInfos.Count; await base.OnInitializedAsync(); } public int serialNumber(int pageIndex, int pageSize, string name) { int iIndex = 0; foreach (ProjectInfo sf in ProjectInfos) { iIndex++; if (sf.CaseNo == name) { break; } } return iIndex; } public async Task SetFinished(string CaseNo) { var result = await _itemService.SetProjectFinish(CaseNo); if (!result) { await MsgSvr.Error($"设定专案[{CaseNo}]为已完成时出错,请稍后再试!"); } } public async Task OnChange(QueryModel queryModel) { Console.WriteLine(JsonSerializer.Serialize(queryModel)); } private void HandlePageChange(PaginationEventArgs args) { if (_pageIndex != args.Page) { _pageIndex = args.Page; } if (_pageSize != args.PageSize) { _pageSize = args.PageSize; } } } }