Welcome.razor.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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. [Inject] public IProjectService ProjectService { get; set; }
  30. [Inject] public IUserService _userService { get; set; }
  31. [Inject] protected AppealTypeService _atService { get; set; }
  32. private ModalRef _modalRef;
  33. [Inject] ModalService _ModalService { get; set; }
  34. [Inject] MessageService _msgService { get; set; }
  35. private Models.CurrentUser _user;
  36. [Inject] PerformanceItemServices _ItemService { get; set; }
  37. [Inject] CalMonthServices CalMonthServices { get; set; }
  38. int waitingHandleItems = 0;
  39. int allItems = 0;
  40. CalMonth HandlingMonth = null;
  41. protected override async System.Threading.Tasks.Task OnInitializedAsync()
  42. {
  43. await base.OnInitializedAsync();
  44. _CurrentUser =await _userService.GetUser();
  45. //_user = _CurrentUser;
  46. HandlingMonth = await CalMonthServices.GetHandlingMonth();
  47. if (HandlingMonth != null)
  48. {
  49. //Console.WriteLine(System.Text.Json.JsonSerializer.Serialize())
  50. var data = await _ItemService.Query(_CurrentUser.Userid.Value, jxType.doing
  51. ,null);
  52. waitingHandleItems = data.TotalCount;
  53. }
  54. var data1 = await _ItemService.GetMyList(_CurrentUser.Userid.Value, jxType.all);
  55. allItems = data1.TotalCount;
  56. if (_CurrentUser != null)
  57. {
  58. AppealRecords = await _atService.GetUserAppeals(_CurrentUser.Userid);
  59. }
  60. StateHasChanged();
  61. }
  62. async Task ShowModel(AppealRecord appealRecord)
  63. {
  64. var templateOptions = new Models.ReviewerAppealModel();
  65. await templateOptions.Init(_atService, appealRecord.Id);
  66. //Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(templateOptions));
  67. var modalConfig = new ModalOptions();
  68. modalConfig.Title = $"{appealRecord.Type.Name}审核" ;
  69. modalConfig.Width = 650;
  70. //modalConfig.Footer = null;
  71. modalConfig.DestroyOnClose = true;
  72. modalConfig.MaskClosable = false;
  73. _modalRef = await _ModalService
  74. .CreateModalAsync<ReviewerAppeal, Models.ReviewerAppealModel>(modalConfig, templateOptions);
  75. _modalRef.OnOpen = () =>
  76. {
  77. return Task.CompletedTask;
  78. };
  79. _modalRef.OnOk = async () =>
  80. {
  81. try
  82. {
  83. await _atService.ReviewerAppeal(templateOptions);
  84. await _modalRef.CloseAsync();
  85. AppealRecords = await _atService.GetUserAppeals(_CurrentUser.Userid);
  86. StateHasChanged();
  87. var SuccessConfig = new ConfirmOptions()
  88. {
  89. Content = @"审核成功!"
  90. };
  91. //modalConfig.Footer = null;
  92. modalConfig.DestroyOnClose = true;
  93. _ModalService.Success(SuccessConfig);
  94. }
  95. catch (Exception ex)
  96. {
  97. _ModalService.Error(new ConfirmOptions()
  98. {
  99. Title = "审核错误",
  100. Content = ex.Message,
  101. });
  102. }
  103. };
  104. _modalRef.OnCancel = () =>
  105. {
  106. return Task.CompletedTask;
  107. };
  108. _modalRef.OnClose = () =>
  109. {
  110. return Task.CompletedTask;
  111. };
  112. StateHasChanged();
  113. }
  114. }
  115. }