123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- using AntDesign;
- using Microsoft.AspNetCore.Components;
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Threading.Tasks;
- using wispro.sp.share;
- using wispro.sp.web.Services;
- using System.Linq;
- namespace wispro.sp.web.Pages.AppCase
- {
- public partial class LevelStatistics
- {
- CultureInfo CiEn = CultureInfo.GetCultureInfo("en-US");
- CultureInfo CiCn = CultureInfo.GetCultureInfo("zh-CN");
- DatePicker<DateTime?> refDate;
- DateTime? SelectedTime;
- [Inject]
- public MessageService MessageService { get; set; }
- DatePickerLocale CN = new DatePickerLocale
- {
- FirstDayOfWeek = DayOfWeek.Sunday,
- Lang = new DateLocale
- {
- YearFormat = "yyyy年",
- MonthFormat = "M月",
- DateSelect = "选择日期",
- WeekSelect = "选择周",
- MonthSelect = "选择月份",
- YearSelect = "选择年份",
- QuarterSelect = "选择季度",
- Today = "今天"
- }
- };
- [Inject]
- PerformanceItemServices pService { get; set; }
- private async Task ShowSelectedDate()
- {
- if (SelectedTime != null)
- {
- int year = SelectedTime.Value.Year;
- int quartar = 1;
- if (SelectedTime.Value.Month <= 3)
- {
- quartar = 1;
- }
- else
- {
- if (SelectedTime.Value.Month <= 6)
- {
- quartar = 2;
- }
- else
- {
- if (SelectedTime.Value.Month <= 9)
- {
- quartar = 3;
- }
- else
- {
- quartar = 4;
- }
- }
- }
- //await pService.StatisticsLevelCount(year, 1);
- //await pService.StatisticsLevelCount(year, 2);
- //await pService.StatisticsLevelCount(year, 3);
- try
- {
- AResult = await pService.CalAgentLevel(SelectedTime.Value.Year, quartar, "A");
- BResult = await pService.CalAgentLevel(SelectedTime.Value.Year, quartar, "B");
- CResult = await pService.CalAgentLevel(SelectedTime.Value.Year, quartar, "C");
- DResult = await pService.CalAgentLevel(SelectedTime.Value.Year, quartar, "D");
- }
- catch (Exception ex)
- {
- AResult = new LevelStatisticsResult();
- BResult = new LevelStatisticsResult();
- CResult = new LevelStatisticsResult();
- DResult = new LevelStatisticsResult();
- await MessageService.Error($"【{SelectedTime.Value.Year}】年【{quartar}】季度等级数据还没有汇总!");
- }
- StateHasChanged();
- }
- }
- [Inject] protected IAuthService _authService { get; set; }
- LevelStatisticsResult AResult;
- LevelStatisticsResult BResult;
- LevelStatisticsResult CResult;
- LevelStatisticsResult DResult;
- protected override async Task OnInitializedAsync()
- {
- await _authService.CanVisitResource();
- if (SelectedTime == null)
- {
- SelectedTime = DateTime.Now.AddMonths(-3);
- }
- //AResult = await pService.CalAgentLevel(SelectedTime.Value.Year, 1, "A");
- //BResult = await pService.CalAgentLevel(SelectedTime.Value.Year, 1, "B");
- //CResult = await pService.CalAgentLevel(SelectedTime.Value.Year, 1, "C");
- //DResult = await pService.CalAgentLevel(SelectedTime.Value.Year, 1, "D");
- await base.OnInitializedAsync();
- await ShowSelectedDate();
- }
-
- }
- }
|