StaffStaticsReport.razor.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 StaffStaticsReport
  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 = 0,Name = "代理人每月绩效统计" },
  26. new TJType { value = 2,Name = "代理人每年绩效统计" },
  27. new TJType { value = 1,Name = "部门每月绩效统计" },
  28. new TJType { value = 3,Name = "部门每年绩效统计" },
  29. new TJType { value = 4,Name = "人员专案绩效统计" },
  30. //new TJType { value = 4,Name = "部门申诉统计" },
  31. };
  32. share.ChartDatas Datas = new share.ChartDatas()
  33. {
  34. Title = "初始化标题",
  35. Datas = new List<share.ChartData>() {
  36. //new share.ChartData(){ type ="部门一", value =1, year="2022-01", CustomerType ="", CustomerYear=""},
  37. //new share.ChartData(){ type ="部门一",value =5, year="2022-02",CustomerType ="", CustomerYear=""},
  38. //new share.ChartData(){ type ="部门二", value =3, year="2022-01", CustomerType ="", CustomerYear=""},
  39. //new share.ChartData(){ type ="部门二",value =4, year="2022-02",CustomerType ="", CustomerYear=""},
  40. //new share.ChartData(){ type ="部门三",value =2.5, year="2022-02",CustomerType ="", CustomerYear=""}
  41. },
  42. ATitle = "部门",
  43. BTitle = "申诉月份"
  44. };
  45. [Inject] ReportService reportService { get; set; }
  46. [Inject] MessageService msgService { get; set; }
  47. private void OnTimeRangeChange(DateRangeChangedEventArgs args)
  48. {
  49. msgService.Info($"Selected Time: {JsonSerializer.Serialize(args.Dates)}");
  50. Console.WriteLine($"Selected Time: {JsonSerializer.Serialize(args.Dates)}");
  51. Console.WriteLine($"Formatted Selected Time: {JsonSerializer.Serialize(args.DateStrings)}");
  52. if (args.Dates?.Length > 0)
  53. {
  54. Console.WriteLine(args.Dates[0]);
  55. start = args.Dates[0];
  56. }
  57. if (args.Dates?.Length > 1)
  58. {
  59. Console.WriteLine(args.Dates[1]);
  60. end = args.Dates[1];
  61. }
  62. }
  63. private bool _noIconLoading;
  64. private async Task OnButtonClick()
  65. {
  66. _noIconLoading = true;
  67. Datas = await reportService.GetStaticReportData(iType);
  68. if (Datas != null)
  69. {
  70. //config.Title.Text = Datas.Title;
  71. //config.XField = Datas.ATitle;
  72. //await chart.ChangeData(Datas.Datas);
  73. //await chart.UpdateChart(config);
  74. StateHasChanged();
  75. }
  76. _noIconLoading = false;
  77. }
  78. protected async override Task OnInitializedAsync()
  79. {
  80. //Datas = await reportService.GetAppealReportData(iType, DateTime.Parse("2022-01-01"), DateTime.Now, null);
  81. if (Datas != null)
  82. {
  83. //config.Title.Text = Datas.Title;
  84. //await chart.ChangeData(Datas.Datas);
  85. //await chart.UpdateChart(config);
  86. StateHasChanged();
  87. }
  88. await base.OnInitializedAsync();
  89. }
  90. }
  91. }