AppealRecords.razor.cs 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. using Microsoft.AspNetCore.Components;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Threading.Tasks;
  6. using wispro.sp.entity;
  7. using wispro.sp.share;
  8. using wispro.sp.web.Services;
  9. namespace wispro.sp.web.Pages.AppCase
  10. {
  11. public partial class AppealRecords
  12. {
  13. AppealRecordFilter _filter = new AppealRecordFilter();
  14. AntDesign.Internal.IForm _form;
  15. bool ShowSearchPanel = true;
  16. bool _ShowDetail = false;
  17. List<AppealType> AppealTypes;
  18. private List<AppealRecord> showRecords;
  19. [Inject] protected AppealTypeService _atService { get; set; }
  20. [Inject] protected IAuthService _authService { get; set; }
  21. [Parameter]
  22. public int pageIndex { get; set; }
  23. [Parameter]
  24. public int pageSize { get; set; }
  25. protected async override Task OnInitializedAsync()
  26. {
  27. await _authService.CanVisitResource();
  28. AppealTypes = await _atService.GetItems();
  29. showRecords = await _atService.GetUserAppeals(0);
  30. await base.OnInitializedAsync();
  31. }
  32. string GetDescription(AppealRecord context)
  33. {
  34. if(context.State == 0)
  35. {
  36. if (context.Item != null)
  37. {
  38. return $"[{context.CreateTime.ToString("yyyy-MM-dd hh:mm:ss")}] {context.Creater.Name}提交[{context.Item.CaseNo}]{context.Type.Name}申诉,正等待{context.Reviewer.Name}审核中......";
  39. }
  40. else
  41. {
  42. return $"{context.Creater.Name}提交提交{context.Type.Name}申诉,正等待{context.Reviewer.Name}审核中......";
  43. }
  44. }
  45. else
  46. {
  47. if (context.Item != null)
  48. {
  49. return $"[{context.CreateTime.ToString("yyyy-MM-dd hh:mm:ss")}] {context.Creater.Name}提交[{context.Item.CaseNo}]{context.Type.Name}申诉,{context.Reviewer.Name}已审核!";
  50. }
  51. else
  52. {
  53. return $"{context.Creater.Name}提交提交{context.Type.Name}申诉,{context.Reviewer.Name}已审核!";
  54. }
  55. }
  56. }
  57. async void OnSearch()
  58. {
  59. showRecords = await _atService.GetUserAppeals(_filter);
  60. StateHasChanged();
  61. }
  62. AppealRecord CurrentAppealRecord;
  63. List<InputFieldValue> _FieldValues;
  64. List<InputFieldValue> _ReviewValues;
  65. List<AttachFile> attachFiles;
  66. async Task ShowDetail(AppealRecord appealRecord)
  67. {
  68. CurrentAppealRecord = appealRecord ;
  69. _FieldValues = await _atService.GetInputFieldValues(appealRecord.Id, 0);
  70. attachFiles = await _atService.GetAppealRecordAttachFiles(CurrentAppealRecord.Id);
  71. if (appealRecord.State > 0)
  72. {
  73. _ReviewValues = await _atService.GetInputFieldValues(appealRecord.Id, 1);
  74. }
  75. _ShowDetail = true;
  76. }
  77. void CloseDetail()
  78. {
  79. _ShowDetail = false;
  80. }
  81. }
  82. }