Welcome.razor.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. using System.Threading.Tasks;
  2. using wispro.sp.web.Models;
  3. using wispro.sp.web.Services;
  4. using Microsoft.AspNetCore.Components;
  5. using wispro.sp.web.Components;
  6. using System.Collections.Generic;
  7. using wispro.sp.entity;
  8. using System.Text.Json;
  9. using AntDesign;
  10. using System;
  11. using wispro.sp.share;
  12. namespace wispro.sp.web.Pages
  13. {
  14. public partial class Welcome
  15. {
  16. private readonly EditableLink[] _links =
  17. {
  18. new EditableLink {Title = "Operation 1", Href = ""},
  19. new EditableLink {Title = "Operation 2", Href = ""},
  20. new EditableLink {Title = "Operation 3", Href = ""},
  21. new EditableLink {Title = "Operation 4", Href = ""},
  22. new EditableLink {Title = "Operation 5", Href = ""},
  23. new EditableLink {Title = "Operation 6", Href = ""}
  24. };
  25. private ActivitiesType[] _activities = { };
  26. private NoticeType[] _projectNotice = { };
  27. private CurrentUser _CurrentUser;
  28. private List<AppealRecord> AppealRecords = new List<AppealRecord>();
  29. private List<ProjectInfo> WaitingReviewProjects = new List<ProjectInfo>();
  30. [Inject] public IProjectService ProjectService { get; set; }
  31. [Inject] public IUserService _userService { get; set; }
  32. [Inject] protected AppealTypeService _atService { get; set; }
  33. private ModalRef _modalRef;
  34. [Inject] ModalService _ModalService { get; set; }
  35. [Inject] MessageService _msgService { get; set; }
  36. private Models.CurrentUser _user;
  37. [Inject] PerformanceItemServices _ItemService { get; set; }
  38. [Inject] CalMonthServices CalMonthServices { get; set; }
  39. int waitingHandleItems = 0;
  40. int allItems = 0;
  41. CalMonth HandlingMonth = null;
  42. protected override async System.Threading.Tasks.Task OnInitializedAsync()
  43. {
  44. await base.OnInitializedAsync();
  45. _CurrentUser =await _userService.GetUser();
  46. //_user = _CurrentUser;
  47. HandlingMonth = await CalMonthServices.GetHandlingMonth();
  48. if (HandlingMonth != null)
  49. {
  50. //Console.WriteLine(System.Text.Json.JsonSerializer.Serialize())
  51. var data = await _ItemService.Query(_CurrentUser.Userid.Value, jxType.doing
  52. ,null);
  53. waitingHandleItems = data.TotalCount;
  54. }
  55. var data1 = await _ItemService.GetMyList(_CurrentUser.Userid.Value, jxType.all);
  56. allItems = data1.TotalCount;
  57. if (_CurrentUser != null)
  58. {
  59. AppealRecords = await _atService.GetUserAppeals(_CurrentUser.Userid);
  60. }
  61. WaitingReviewProjects = await ProjectService.GetWaitingReviewProjects();
  62. StateHasChanged();
  63. }
  64. async Task ShowModel(AppealRecord appealRecord)
  65. {
  66. var templateOptions = new Models.ReviewerAppealModel();
  67. await templateOptions.Init(_atService, appealRecord.Id);
  68. //Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(templateOptions));
  69. var modalConfig = new ModalOptions();
  70. modalConfig.Title = $"{appealRecord.Type.Name}审核" ;
  71. modalConfig.Width = 650;
  72. //modalConfig.Footer = null;
  73. modalConfig.DestroyOnClose = true;
  74. modalConfig.MaskClosable = false;
  75. _modalRef = await _ModalService
  76. .CreateModalAsync<ReviewerAppeal, Models.ReviewerAppealModel>(modalConfig, templateOptions);
  77. _modalRef.OnOpen = () =>
  78. {
  79. return Task.CompletedTask;
  80. };
  81. _modalRef.OnOk = async () =>
  82. {
  83. try
  84. {
  85. await _atService.ReviewerAppeal(templateOptions);
  86. await _modalRef.CloseAsync();
  87. AppealRecords = await _atService.GetUserAppeals(_CurrentUser.Userid);
  88. StateHasChanged();
  89. var SuccessConfig = new ConfirmOptions()
  90. {
  91. Content = @"审核成功!"
  92. };
  93. //modalConfig.Footer = null;
  94. modalConfig.DestroyOnClose = true;
  95. _ModalService.Success(SuccessConfig);
  96. }
  97. catch (Exception ex)
  98. {
  99. _ModalService.Error(new ConfirmOptions()
  100. {
  101. Title = "审核错误",
  102. Content = ex.Message,
  103. });
  104. }
  105. };
  106. _modalRef.OnCancel = () =>
  107. {
  108. return Task.CompletedTask;
  109. };
  110. _modalRef.OnClose = () =>
  111. {
  112. return Task.CompletedTask;
  113. };
  114. StateHasChanged();
  115. }
  116. int serialNumber(ProjectInfo project)
  117. {
  118. int i = 0;
  119. foreach(var p in WaitingReviewProjects)
  120. {
  121. i++;
  122. if(p.CaseNo == project.CaseNo)
  123. {
  124. break;
  125. }
  126. }
  127. return i;
  128. }
  129. }
  130. }