CaseManager.razor.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. using AntDesign;
  2. using AntDesign.TableModels;
  3. using Microsoft.AspNetCore.Components;
  4. using Microsoft.Extensions.Configuration;
  5. using ServiceStack;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Threading.Tasks;
  10. using wispro.sp.entity;
  11. using wispro.sp.share;
  12. using wispro.sp.web.Services;
  13. namespace wispro.sp.web.Pages.AppCase
  14. {
  15. public partial class CaseManager
  16. {
  17. [Inject]
  18. protected IconService iconService { get; set; }
  19. public TableFilter<string>[] CaseCoeFilters = new TableFilter<string>[] {
  20. new() { Text = "S", Value = "S" },
  21. new() { Text = "A", Value = "A" },
  22. new() { Text = "B", Value = "B" },
  23. new() { Text = "C", Value = "C" },
  24. new() { Text = "D", Value = "D" }
  25. };
  26. [Inject]
  27. protected AppealTypeService apTypeService { get; set; }
  28. private List<PerformanceItem> _Datas;
  29. private List<StaffStatistics> MyStatistics;
  30. IEnumerable<PerformanceItem> selectedItems = new List<PerformanceItem>();
  31. private CalMonth HandlingCalMonth;
  32. private List<CalMonth> calMonths;
  33. int _pageIndex = 1;
  34. int _pageSize = 10;
  35. int _total;
  36. bool _loading = false;
  37. private Table<PerformanceItem> table;
  38. [Inject] public PerformanceItemServices _ItemService { get; set; }
  39. [Inject] public MessageService _message { get; set; }
  40. [Inject] protected NavigationManager NavigationManager { get; set; }
  41. [Inject] protected IUserService _userService { get; set; }
  42. [Inject] protected CalMonthServices _CalMonthService { get; set; }
  43. [Inject] IConfiguration _configuration { get; set; }
  44. protected override async Task OnInitializedAsync()
  45. {
  46. await iconService.CreateFromIconfontCN("//at.alicdn.com/t/font_8d5l8fzk5b87iudi.js");
  47. calMonths = await _CalMonthService.GetAll();
  48. if (calMonths != null && calMonths.Count > 0)
  49. {
  50. await calMonthClick(calMonths[0]);
  51. }
  52. }
  53. private async Task HandleTableChange(QueryModel<PerformanceItem> queryModel)
  54. {
  55. var _user = await _userService.GetUser();
  56. _loading = true;
  57. var data = await _ItemService.Query(HandlingCalMonth, queryModel);
  58. _Datas = data.Results;
  59. _total = data.TotalCount;
  60. _loading = false;
  61. StateHasChanged();
  62. }
  63. private async Task calMonthClick(CalMonth calMonth)
  64. {
  65. HandlingCalMonth = calMonth;
  66. var data = await _ItemService.Query(HandlingCalMonth,_pageIndex ,_pageSize,null);
  67. _Datas = data.Results;
  68. _total = data.TotalCount;
  69. _loading = false;
  70. StateHasChanged();
  71. }
  72. private async Task GuidangCalMonth(CalMonth calMonth)
  73. {
  74. //还未实现,此处需要添加归档代码
  75. await _ItemService.FinishedCalMonth(calMonth);
  76. await Task.Delay(1);
  77. StateHasChanged();
  78. }
  79. private int serialNumber(int pageIndex, int pageSize, int id)
  80. {
  81. int iIndex = 0;
  82. foreach (PerformanceItem sf in _Datas)
  83. {
  84. iIndex++;
  85. if (sf.Id == id)
  86. {
  87. break;
  88. }
  89. }
  90. return (pageIndex - 1) * pageSize + iIndex;
  91. }
  92. bool isDownloading = false;
  93. private async Task ExportDataAsync(CalMonth calMonth)
  94. {
  95. isDownloading = true;
  96. var fileData = await _ItemService.ExportData(calMonth.Id);
  97. while (!fileData.Finished)
  98. {
  99. fileData = await _ItemService.getExportDataProcessing(fileData.Id);
  100. await Task.Delay(20);
  101. }
  102. NavigationManager.NavigateTo($"{_configuration.GetValue<string>("APIUrl")}FileProcesTask/Download?Id={fileData.Id}");
  103. isDownloading = false;
  104. }
  105. }
  106. }