CreateAppeal.razor.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. using AntDesign;
  2. using Microsoft.AspNetCore.Components;
  3. using Microsoft.AspNetCore.Components.Forms;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text.Json;
  8. using System.Threading.Tasks;
  9. using wispro.sp.entity;
  10. using wispro.sp.web.Models;
  11. using wispro.sp.web.Services;
  12. namespace wispro.sp.web.Components
  13. {
  14. public partial class CreateAppeal
  15. {
  16. private CreateAppealModel _Model;
  17. [Inject]
  18. protected AppealTypeService _atService { get; set; }
  19. List<Staff> Reviewers = new List<Staff>()
  20. {
  21. new Staff(){Id =1,Name ="钟子敏"},
  22. new Staff(){Id =2,Name ="邢丽霞"},
  23. new Staff(){Id =3,Name ="李丽"},
  24. new Staff(){Id =4,Name ="贾凤涛"},
  25. };
  26. #region 文件上传控件设定
  27. List<UploadFileItem> fileList = new List<UploadFileItem>
  28. {
  29. new UploadFileItem
  30. {
  31. Id = "1",
  32. FileName = "客户往来邮件1.jpg",
  33. Url = "#",
  34. State = UploadState.Success
  35. },
  36. new UploadFileItem
  37. {
  38. Id = "2",
  39. FileName = "与客户微信聊天图片.jpg",
  40. Url = "#",
  41. State = UploadState.Success
  42. },
  43. new UploadFileItem
  44. {
  45. Id = "3",
  46. FileName = "附件.docx",
  47. Url = "#",
  48. State = UploadState.Success
  49. }
  50. };
  51. Dictionary<string, object> attrs = new Dictionary<string, object>
  52. {
  53. {"Action", "http://localhost:39476/api/AttachFiles/PostFile" },
  54. {"Name", "files" },
  55. {"Multiple", false }
  56. };
  57. void HandleChange(UploadInfo fileinfo)
  58. {
  59. //if (fileList.Count > 5)
  60. //{
  61. // fileList.RemoveRange(0, fileList.Count - 2);
  62. //}
  63. //fileList.Where(file => file.State == UploadState.Success && !string.IsNullOrWhiteSpace(file.Response)).ForEach(file => {
  64. // var result = file.GetResponse<ResponseModel>();
  65. // file.Url = result.url;
  66. //});
  67. }
  68. public class ResponseModel
  69. {
  70. public string name { get; set; }
  71. public string status { get; set; }
  72. public string url { get; set; }
  73. public string thumbUrl { get; set; }
  74. }
  75. #endregion
  76. protected override async void OnInitialized()
  77. {
  78. _Model = base.Options ?? new CreateAppealModel();
  79. Console.WriteLine($"Success:{JsonSerializer.Serialize(_Model)}");
  80. base.OnInitialized();
  81. }
  82. private void OnFinish()
  83. {
  84. Console.WriteLine($"Success:{JsonSerializer.Serialize(_Model)}");
  85. _ = base.FeedbackRef.CloseAsync();
  86. }
  87. private void OnCancel()
  88. {
  89. _ = base.FeedbackRef.CloseAsync();
  90. }
  91. //private void OnFinishFailed(EditContext editContext)
  92. //{
  93. // Console.WriteLine($"Failed:{JsonSerializer.Serialize(Model)}");
  94. //}
  95. }
  96. }