AppealTrend.razor.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. using AntDesign;
  2. using Microsoft.AspNetCore.Components;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text.Json;
  8. using System.Threading.Tasks;
  9. using wispro.sp.share;
  10. using wispro.sp.web.Services;
  11. namespace wispro.sp.web.Pages.Report
  12. {
  13. public partial class AppealTrend
  14. {
  15. private int iType = 3;
  16. private DateTime? start = new DateTime(DateTime.Now.Year, 1, 1);
  17. private DateTime? end = DateTime.Now;
  18. internal class TJType
  19. {
  20. public string Name { get; set; }
  21. public int value { get; set; }
  22. }
  23. List<TJType> Types = new List<TJType>
  24. {
  25. new TJType { value = 3,Name = "申诉人统计" },
  26. new TJType { value = 4,Name = "申诉类型统计" },
  27. new TJType { value = 4,Name = "部门申诉统计" },
  28. };
  29. share.ChartDatas Datas = new share.ChartDatas()
  30. {
  31. Title = "初始化标题",
  32. Datas = new List<share.ChartData>() {
  33. new share.ChartData(){ type ="部门一", value =1, year="2022-01", CustomerType ="", CustomerYear=""},
  34. new share.ChartData(){ type ="部门一",value =5, year="2022-02",CustomerType ="", CustomerYear=""},
  35. new share.ChartData(){ type ="部门二", value =3, year="2022-01", CustomerType ="", CustomerYear=""},
  36. new share.ChartData(){ type ="部门二",value =4, year="2022-02",CustomerType ="", CustomerYear=""},
  37. new share.ChartData(){ type ="部门三",value =2.5, year="2022-02",CustomerType ="", CustomerYear=""}
  38. },
  39. ATitle = "部门",
  40. BTitle = "申诉月份"
  41. };
  42. [Inject] ReportService reportService { get; set; }
  43. [Inject] MessageService msgService { get; set; }
  44. private void OnTimeRangeChange(DateRangeChangedEventArgs args)
  45. {
  46. msgService.Info($"Selected Time: {JsonSerializer.Serialize(args.Dates)}");
  47. Console.WriteLine($"Selected Time: {JsonSerializer.Serialize(args.Dates)}");
  48. Console.WriteLine($"Formatted Selected Time: {JsonSerializer.Serialize(args.DateStrings)}");
  49. if (args.Dates?.Length > 0)
  50. {
  51. Console.WriteLine(args.Dates[0]);
  52. start = args.Dates[0];
  53. }
  54. if (args.Dates?.Length > 1)
  55. {
  56. Console.WriteLine(args.Dates[1]);
  57. end = args.Dates[1];
  58. }
  59. }
  60. private bool _noIconLoading;
  61. private async Task OnButtonClick()
  62. {
  63. _noIconLoading = true;
  64. Datas = await reportService.GetAppealReportData(iType, start, end, null);
  65. if (Datas != null)
  66. {
  67. StateHasChanged();
  68. }
  69. _noIconLoading = false;
  70. }
  71. protected async override Task OnInitializedAsync()
  72. {
  73. //Datas = await reportService.GetAppealReportData(iType, DateTime.Parse("2022-01-01"), DateTime.Now, null);
  74. if (Datas != null)
  75. {
  76. //config.Title.Text = Datas.Title;
  77. //await chart.ChangeData(Datas.Datas);
  78. //await chart.UpdateChart(config);
  79. StateHasChanged();
  80. }
  81. await base.OnInitializedAsync();
  82. }
  83. }
  84. }