LevelStatistics.razor.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. using AntDesign;
  2. using Microsoft.AspNetCore.Components;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Globalization;
  6. using System.Threading.Tasks;
  7. using wispro.sp.share;
  8. using wispro.sp.web.Services;
  9. using System.Linq;
  10. namespace wispro.sp.web.Pages.AppCase
  11. {
  12. public partial class LevelStatistics
  13. {
  14. CultureInfo CiEn = CultureInfo.GetCultureInfo("en-US");
  15. CultureInfo CiCn = CultureInfo.GetCultureInfo("zh-CN");
  16. DatePicker<DateTime?> refDate;
  17. DateTime? SelectedTime;
  18. DatePickerLocale CN = new DatePickerLocale
  19. {
  20. FirstDayOfWeek = DayOfWeek.Sunday,
  21. Lang = new DateLocale
  22. {
  23. YearFormat = "yyyy年",
  24. MonthFormat = "M月",
  25. DateSelect = "选择日期",
  26. WeekSelect = "选择周",
  27. MonthSelect = "选择月份",
  28. YearSelect = "选择年份",
  29. QuarterSelect = "选择季度",
  30. Today = "今天"
  31. }
  32. };
  33. [Inject]
  34. PerformanceItemServices pService { get; set; }
  35. private async Task ShowSelectedDate()
  36. {
  37. if (SelectedTime != null)
  38. {
  39. int year = SelectedTime.Value.Year;
  40. int quartar = 1;
  41. if (SelectedTime.Value.Month <= 3)
  42. {
  43. quartar = 1;
  44. }
  45. else
  46. {
  47. if (SelectedTime.Value.Month <= 6)
  48. {
  49. quartar = 2;
  50. }
  51. else
  52. {
  53. if (SelectedTime.Value.Month <= 9)
  54. {
  55. quartar = 3;
  56. }
  57. else
  58. {
  59. quartar = 4;
  60. }
  61. }
  62. }
  63. await pService.StatisticsLevelCount(year, 1);
  64. await pService.StatisticsLevelCount(year, 2);
  65. await pService.StatisticsLevelCount(year, 3);
  66. }
  67. }
  68. [Inject] protected IAuthService _authService { get; set; }
  69. LevelStatisticsResult AResult;
  70. LevelStatisticsResult BResult;
  71. LevelStatisticsResult CResult;
  72. LevelStatisticsResult DResult;
  73. protected override async Task OnInitializedAsync()
  74. {
  75. await _authService.CanVisitResource();
  76. if(SelectedTime == null)
  77. {
  78. SelectedTime = DateTime.Now.AddMonths(-3);
  79. }
  80. AResult = await pService.CalAgentLevel(SelectedTime.Value.Year, 1, "A");
  81. BResult = await pService.CalAgentLevel(SelectedTime.Value.Year, 1, "B");
  82. CResult = await pService.CalAgentLevel(SelectedTime.Value.Year, 1, "C");
  83. DResult = await pService.CalAgentLevel(SelectedTime.Value.Year, 1, "D");
  84. await base.OnInitializedAsync();
  85. }
  86. }
  87. }