Welcome.razor.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. namespace wispro.sp.web.Pages
  12. {
  13. public partial class Welcome
  14. {
  15. private readonly EditableLink[] _links =
  16. {
  17. new EditableLink {Title = "Operation 1", Href = ""},
  18. new EditableLink {Title = "Operation 2", Href = ""},
  19. new EditableLink {Title = "Operation 3", Href = ""},
  20. new EditableLink {Title = "Operation 4", Href = ""},
  21. new EditableLink {Title = "Operation 5", Href = ""},
  22. new EditableLink {Title = "Operation 6", Href = ""}
  23. };
  24. private ActivitiesType[] _activities = { };
  25. private NoticeType[] _projectNotice = { };
  26. private CurrentUser _CurrentUser;
  27. private List<AppealRecord> AppealRecords = new List<AppealRecord>();
  28. [Inject] public IProjectService ProjectService { get; set; }
  29. [Inject] public IUserService _userService { get; set; }
  30. [Inject] protected AppealTypeService _atService { get; set; }
  31. private ModalRef _modalRef;
  32. [Inject] ModalService _ModalService { get; set; }
  33. protected override async System.Threading.Tasks.Task OnInitializedAsync()
  34. {
  35. await base.OnInitializedAsync();
  36. _CurrentUser = _userService.CurrentUser;
  37. _projectNotice = await ProjectService.GetProjectNoticeAsync();
  38. //_activities = await ProjectService.GetActivitiesAsync();
  39. AppealRecords = await _atService.GetUserAppeals(_CurrentUser.Userid);
  40. AppealRecords.Sort((a, b) =>
  41. {
  42. var sd = (a.ReviewTime == null) ? a.ReviewTime : a.CreateTime;
  43. var ed = (b.ReviewTime == null) ? b.ReviewTime : b.CreateTime;
  44. if (ed > sd)
  45. {
  46. return 1;
  47. }
  48. else
  49. {
  50. return -1;
  51. }
  52. });
  53. foreach (AppealRecord at in AppealRecords)
  54. {
  55. System.Diagnostics.Debug.WriteLine(at.Item.CaseNo);
  56. }
  57. }
  58. async Task ShowModel(AppealRecord appealRecord)
  59. {
  60. var templateOptions = new Models.ReviewerAppealModel();
  61. await templateOptions.Init(_atService, appealRecord.Id);
  62. var modalConfig = new ModalOptions();
  63. modalConfig.Title = $"{appealRecord.Type.Name}审核" ;
  64. modalConfig.Width = 650;
  65. //modalConfig.Footer = null;
  66. modalConfig.DestroyOnClose = true;
  67. _modalRef = await _ModalService
  68. .CreateModalAsync<Components.ReviewerAppeal, Models.ReviewerAppealModel>(modalConfig, templateOptions);
  69. _modalRef.OnOpen = () =>
  70. {
  71. Console.WriteLine("ModalRef OnOpen");
  72. return Task.CompletedTask;
  73. };
  74. _modalRef.OnOk = async () =>
  75. {
  76. Console.WriteLine(JsonSerializer.Serialize(templateOptions));
  77. try
  78. {
  79. await _atService.ReviewerAppeal(templateOptions);
  80. await _modalRef.CloseAsync();
  81. }
  82. catch (Exception ex)
  83. {
  84. //_ErrorMessage = ex.Message;
  85. }
  86. //return Task.CompletedTask;
  87. };
  88. _modalRef.OnCancel = () =>
  89. {
  90. Console.WriteLine("ModalRef OnCancel");
  91. return Task.CompletedTask;
  92. };
  93. _modalRef.OnClose = () =>
  94. {
  95. Console.WriteLine("ModalRef OnClose");
  96. return Task.CompletedTask;
  97. };
  98. StateHasChanged();
  99. }
  100. }
  101. }