MyProject.razor.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using AntDesign;
  2. using Microsoft.AspNetCore.Components;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Threading.Tasks;
  7. using wispro.sp.entity;
  8. using wispro.sp.web.Services;
  9. namespace wispro.sp.web.Pages.Project
  10. {
  11. public partial class MyProject
  12. {
  13. List<ProjectContentRecord> ProjectInfos;
  14. int _pageIndex = 1;
  15. int _pageSize = 10;
  16. int _total = 0;
  17. bool _loading = false;
  18. [Inject] protected PerformanceItemServices _itemService { get; set; }
  19. [Inject] public MessageService MsgSvr { get; set; }
  20. [Inject] NavigationManager _NavigationManager { get; set; }
  21. protected async override Task OnInitializedAsync()
  22. {
  23. ProjectInfos = await _itemService.GetMyProjects();
  24. _total = ProjectInfos.Count;
  25. await base.OnInitializedAsync();
  26. }
  27. public int serialNumber(int pageIndex, int pageSize, ProjectContentRecord pr)
  28. {
  29. int iIndex = ProjectInfos.IndexOf(pr);
  30. return iIndex + 1;
  31. }
  32. public async Task SetFinished(string CaseNo)
  33. {
  34. var result = await _itemService.SetProjectFinish(CaseNo);
  35. if (!result)
  36. {
  37. await MsgSvr.Error($"设定专案[{CaseNo}]为已完成时出错,请稍后再试!");
  38. }
  39. }
  40. private void HandlePageChange(PaginationEventArgs args)
  41. {
  42. if (_pageIndex != args.Page)
  43. {
  44. _pageIndex = args.Page;
  45. }
  46. if (_pageSize != args.PageSize)
  47. {
  48. _pageSize = args.PageSize;
  49. }
  50. }
  51. public void AddNew()
  52. {
  53. _NavigationManager.NavigateTo("/Project/WorkContent");
  54. }
  55. public void Edit(ProjectContentRecord projectContent)
  56. {
  57. _NavigationManager.NavigateTo($"/Project/WorkContent/{projectContent.Id}");
  58. }
  59. public void Submit(ProjectContentRecord projectContent)
  60. {
  61. }
  62. }
  63. }