|
@@ -1,5 +1,4 @@
|
|
using AntDesign;
|
|
using AntDesign;
|
|
-
|
|
|
|
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.AspNetCore.Components;
|
|
using System;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
@@ -7,16 +6,18 @@ using System.Data;
|
|
using System.Linq;
|
|
using System.Linq;
|
|
using System.Text.Json;
|
|
using System.Text.Json;
|
|
using System.Threading.Tasks;
|
|
using System.Threading.Tasks;
|
|
-using wispro.sp.share;
|
|
|
|
using wispro.sp.web.Services;
|
|
using wispro.sp.web.Services;
|
|
|
|
+using Blazor.ECharts.Options;
|
|
|
|
+using Blazor.ECharts.Options.Enum;
|
|
|
|
+using L = Blazor.ECharts.Options.Series.Line;
|
|
|
|
|
|
namespace wispro.sp.web.Pages.Report
|
|
namespace wispro.sp.web.Pages.Report
|
|
{
|
|
{
|
|
public partial class StaffStaticsReport
|
|
public partial class StaffStaticsReport
|
|
{
|
|
{
|
|
- private int iType = 3;
|
|
|
|
- private DateTime? start = new DateTime(DateTime.Now.Year, 1, 1);
|
|
|
|
- private DateTime? end = DateTime.Now;
|
|
|
|
|
|
+ private int iType = 0;
|
|
|
|
+ private EChartsOption<L.Line> option;
|
|
|
|
+ private Blazor.ECharts.Components.ELine chart;
|
|
|
|
|
|
internal class TJType
|
|
internal class TJType
|
|
{
|
|
{
|
|
@@ -26,87 +27,175 @@ namespace wispro.sp.web.Pages.Report
|
|
}
|
|
}
|
|
List<TJType> Types = new List<TJType>
|
|
List<TJType> Types = new List<TJType>
|
|
{
|
|
{
|
|
- new TJType { value = 0,Name = "代理人每月绩效统计" },
|
|
|
|
- new TJType { value = 2,Name = "代理人每年绩效统计" },
|
|
|
|
|
|
+ new TJType { value = 0,Name = "人员每月绩效统计" },
|
|
|
|
+ new TJType { value = 2,Name = "人员每年绩效统计" },
|
|
new TJType { value = 1,Name = "部门每月绩效统计" },
|
|
new TJType { value = 1,Name = "部门每月绩效统计" },
|
|
new TJType { value = 3,Name = "部门每年绩效统计" },
|
|
new TJType { value = 3,Name = "部门每年绩效统计" },
|
|
new TJType { value = 4,Name = "人员专案绩效统计" },
|
|
new TJType { value = 4,Name = "人员专案绩效统计" },
|
|
- //new TJType { value = 4,Name = "部门申诉统计" },
|
|
|
|
-
|
|
|
|
};
|
|
};
|
|
|
|
|
|
share.ChartDatas Datas = new share.ChartDatas()
|
|
share.ChartDatas Datas = new share.ChartDatas()
|
|
{
|
|
{
|
|
Title = "初始化标题",
|
|
Title = "初始化标题",
|
|
Datas = new List<share.ChartData>() {
|
|
Datas = new List<share.ChartData>() {
|
|
- //new share.ChartData(){ type ="部门一", value =1, year="2022-01", CustomerType ="", CustomerYear=""},
|
|
|
|
- //new share.ChartData(){ type ="部门一",value =5, year="2022-02",CustomerType ="", CustomerYear=""},
|
|
|
|
- //new share.ChartData(){ type ="部门二", value =3, year="2022-01", CustomerType ="", CustomerYear=""},
|
|
|
|
- //new share.ChartData(){ type ="部门二",value =4, year="2022-02",CustomerType ="", CustomerYear=""},
|
|
|
|
- //new share.ChartData(){ type ="部门三",value =2.5, year="2022-02",CustomerType ="", CustomerYear=""}
|
|
|
|
|
|
+ new share.ChartData(){ type ="部门一", value =1, year="2022-01", CustomerType ="", CustomerYear=""},
|
|
|
|
+ new share.ChartData(){ type ="部门一",value =5, year="2022-02",CustomerType ="", CustomerYear=""},
|
|
|
|
+ new share.ChartData(){ type ="部门二", value =3, year="2022-01", CustomerType ="", CustomerYear=""},
|
|
|
|
+ new share.ChartData(){ type ="部门二",value =4, year="2022-02",CustomerType ="", CustomerYear=""},
|
|
|
|
+ new share.ChartData(){ type ="部门三",value =2.5, year="2022-02",CustomerType ="", CustomerYear=""}
|
|
},
|
|
},
|
|
ATitle = "部门",
|
|
ATitle = "部门",
|
|
BTitle = "申诉月份"
|
|
BTitle = "申诉月份"
|
|
};
|
|
};
|
|
|
|
|
|
-
|
|
|
|
|
|
+ private void GetOption()
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ if (Datas != null)
|
|
|
|
+ {
|
|
|
|
+ List<object> series = new List<object>();
|
|
|
|
+
|
|
|
|
+ DataTable dt = Datas.GetTableData();
|
|
|
|
+
|
|
|
|
+ foreach (DataRow row in dt.Rows)
|
|
|
|
+ {
|
|
|
|
+ L.Line l = new L.Line();
|
|
|
|
+ l.Name = row[0].ToString();
|
|
|
|
+ List<double> data = new List<double>();
|
|
|
|
+
|
|
|
|
+ for (int i = 1; i < dt.Columns.Count; i++)
|
|
|
|
+ {
|
|
|
|
+ double dTem = 0;
|
|
|
|
+ double.TryParse(row[i].ToString(), out dTem);
|
|
|
|
+
|
|
|
|
+ data.Add(dTem);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ l.Data = data;
|
|
|
|
+
|
|
|
|
+ series.Add(l);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ option = new EChartsOption<L.Line>()
|
|
|
|
+ {
|
|
|
|
+ //Legend = new() {
|
|
|
|
+ // Show = true,
|
|
|
|
+ //},
|
|
|
|
+ Toolbox = new()
|
|
|
|
+ {
|
|
|
|
+ Show = true,
|
|
|
|
+ Feature = new()
|
|
|
|
+ {
|
|
|
|
+ DataView = new()
|
|
|
|
+ {
|
|
|
|
+ ReadOnly = false
|
|
|
|
+ },
|
|
|
|
+ Restore = new(),
|
|
|
|
+ MagicType = new() {
|
|
|
|
+ Type = new()
|
|
|
|
+ {
|
|
|
|
+ MagicTypeType.Bar,
|
|
|
|
+ MagicTypeType.Line,
|
|
|
|
+ MagicTypeType.Stack,
|
|
|
|
+ MagicTypeType.Tiled,
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ SaveAsImage = new()
|
|
|
|
+ {
|
|
|
|
+ PixelRatio = 2,
|
|
|
|
+ Name = "保存图片"
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ Tooltip = new()
|
|
|
|
+ {
|
|
|
|
+ Trigger = TooltipTrigger.Item,
|
|
|
|
+ Formatter = "{a} <br/>{b}: {c}"
|
|
|
|
+ },
|
|
|
|
+ Title = new()
|
|
|
|
+ {
|
|
|
|
+ Text = Datas.Title
|
|
|
|
+ },
|
|
|
|
+ YAxis = new()
|
|
|
|
+ {
|
|
|
|
+ new()
|
|
|
|
+ {
|
|
|
|
+ Type = AxisType.Value,
|
|
|
|
+ Name = "绩效",
|
|
|
|
+ Position = PositionY.Start,
|
|
|
|
+ AxisLine = new()
|
|
|
|
+ {
|
|
|
|
+ Show = true,
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ XAxis = new()
|
|
|
|
+ {
|
|
|
|
+ new()
|
|
|
|
+ {
|
|
|
|
+ Type = AxisType.Category,
|
|
|
|
+ Data = Datas.GetYear(),
|
|
|
|
+ Name = Datas.BTitle,
|
|
|
|
+ NameLocation = Location.Middle,
|
|
|
|
+ AxisLabel = new()
|
|
|
|
+ {
|
|
|
|
+ Show = true
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ Series = series
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
[Inject] ReportService reportService { get; set; }
|
|
[Inject] ReportService reportService { get; set; }
|
|
|
|
|
|
[Inject] MessageService msgService { get; set; }
|
|
[Inject] MessageService msgService { get; set; }
|
|
|
|
|
|
- private void OnTimeRangeChange(DateRangeChangedEventArgs args)
|
|
|
|
|
|
+ private bool _noIconLoading;
|
|
|
|
+ private async Task OnButtonClick()
|
|
{
|
|
{
|
|
- msgService.Info($"Selected Time: {JsonSerializer.Serialize(args.Dates)}");
|
|
|
|
- Console.WriteLine($"Selected Time: {JsonSerializer.Serialize(args.Dates)}");
|
|
|
|
- Console.WriteLine($"Formatted Selected Time: {JsonSerializer.Serialize(args.DateStrings)}");
|
|
|
|
-
|
|
|
|
- if (args.Dates?.Length > 0)
|
|
|
|
- {
|
|
|
|
- Console.WriteLine(args.Dates[0]);
|
|
|
|
- start = args.Dates[0];
|
|
|
|
- }
|
|
|
|
|
|
+ //option = null;
|
|
|
|
+ await GetChartDatas();
|
|
|
|
+
|
|
|
|
+ Console.WriteLine(chart.OptionRaw);
|
|
|
|
+ }
|
|
|
|
|
|
- if (args.Dates?.Length > 1)
|
|
|
|
|
|
+ private async Task OnButtonClick_1()
|
|
|
|
+ {
|
|
|
|
+ Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(option, new JsonSerializerOptions()
|
|
{
|
|
{
|
|
- Console.WriteLine(args.Dates[1]);
|
|
|
|
- end = args.Dates[1];
|
|
|
|
- }
|
|
|
|
|
|
+ DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull
|
|
|
|
+ }));
|
|
|
|
|
|
|
|
+ await msgService.Success(chart.OptionRaw);
|
|
}
|
|
}
|
|
|
|
|
|
- private bool _noIconLoading;
|
|
|
|
- private async Task OnButtonClick()
|
|
|
|
|
|
+ private async Task GetChartDatas()
|
|
{
|
|
{
|
|
_noIconLoading = true;
|
|
_noIconLoading = true;
|
|
Datas = await reportService.GetStaticReportData(iType);
|
|
Datas = await reportService.GetStaticReportData(iType);
|
|
-
|
|
|
|
- if (Datas != null)
|
|
|
|
- {
|
|
|
|
- //config.Title.Text = Datas.Title;
|
|
|
|
- //config.XField = Datas.ATitle;
|
|
|
|
- //await chart.ChangeData(Datas.Datas);
|
|
|
|
- //await chart.UpdateChart(config);
|
|
|
|
- StateHasChanged();
|
|
|
|
- }
|
|
|
|
|
|
+ GetOption();
|
|
|
|
+ StateHasChanged();
|
|
_noIconLoading = false;
|
|
_noIconLoading = false;
|
|
}
|
|
}
|
|
|
|
|
|
protected async override Task OnInitializedAsync()
|
|
protected async override Task OnInitializedAsync()
|
|
{
|
|
{
|
|
- //Datas = await reportService.GetAppealReportData(iType, DateTime.Parse("2022-01-01"), DateTime.Now, null);
|
|
|
|
-
|
|
|
|
- if (Datas != null)
|
|
|
|
- {
|
|
|
|
- //config.Title.Text = Datas.Title;
|
|
|
|
-
|
|
|
|
- //await chart.ChangeData(Datas.Datas);
|
|
|
|
- //await chart.UpdateChart(config);
|
|
|
|
- StateHasChanged();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ await GetChartDatas();
|
|
await base.OnInitializedAsync();
|
|
await base.OnInitializedAsync();
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+ private EchartsEventArgs callbackArgs;
|
|
|
|
+ private List<EventType> EventTypes = new List<EventType> { EventType.click };
|
|
|
|
+ private void OnEchartsEvent(EchartsEventArgs args)
|
|
|
|
+ {
|
|
|
|
+ msgService.Info($"您点击了:[{args.SeriesName},{args.Name}]!");
|
|
|
|
+ callbackArgs = args;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|