From 29c34abcb6746598b1cfe4981ffed034c9722ddb Mon Sep 17 00:00:00 2001 From: SHM Date: Fri, 5 Sep 2025 16:43:53 +0900 Subject: [PATCH] =?UTF-8?q?[=EC=84=B1=ED=98=84=EB=AA=A8]=20Grid=20Column?= =?UTF-8?q?=20=EC=82=AC=EC=9D=B4=EC=A6=88=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Web.Tra/Components/Module/TraGrid.razor | 113 +++++++++++++----- .../Components/Module/TraGrid.razor.css | 3 - 2 files changed, 82 insertions(+), 34 deletions(-) delete mode 100644 Projects/WebClient/Web.Tra/Components/Module/TraGrid.razor.css diff --git a/Projects/WebClient/Web.Tra/Components/Module/TraGrid.razor b/Projects/WebClient/Web.Tra/Components/Module/TraGrid.razor index c485b06..3449f0d 100644 --- a/Projects/WebClient/Web.Tra/Components/Module/TraGrid.razor +++ b/Projects/WebClient/Web.Tra/Components/Module/TraGrid.razor @@ -2,12 +2,22 @@ @inject ContextMenuService ContextMenuService - + + + + + + + + + + + + RowSelect="@SelectRow" RowDoubleClick="@OnRowDoublClick"> - @if (VisibleRowNo == true) { @@ -21,15 +31,14 @@ @foreach (var col in typeof(TDataModel).GetProperties()) { - if(DisableColums?.Contains(col.Name.ToLower()) == true) continue; - + if (col.Name.ToLower().Equals("testdate")) - { - + { + @@ -39,7 +48,7 @@ { @@ -49,7 +58,27 @@ { + + } + else if (col.Name.ToLower().Equals("testdatetime")) + { + + + + } + else if (col.Name.ToLower().Contains("cntid") || col.Name.ToLower().Contains("reqid")) + { + + @@ -59,7 +88,7 @@ { @@ -96,6 +125,28 @@ private IList SelectedRow; + private string SummaryTestResult = string.Empty; + private string SummaryTestTime = string.Empty; + + protected override async Task OnParametersSetAsync() + { + if(typeof(TDataModel) == typeof(TestHistory)) + { + var dataList = DataList.Cast(); + + int ok = dataList.Count(x => x.TestResult.ToLower().Contains("ok")); + int ng = dataList.Count(x => !x.TestResult.ToLower().Contains("ok")); + double ratio = (double)(ok) / (double)(ok + ng) * 100.0; + + double testTimeAvg = dataList.Average(x => Convert.ToInt32(x.Duration)) / 1000.0; + double testTimeMin = dataList.Min(x => Convert.ToInt32(x.Duration)) / 1000.0; + double testTimeMax = dataList.Max(x => Convert.ToInt32(x.Duration)) / 1000.0; + + SummaryTestResult = $"Test Result: {ok + ng} (OK:{ok}/NG:{ng}) - Ratio:{ratio.ToString("F2")}%"; + SummaryTestTime = $"Test Time: Average={testTimeAvg.ToString("F2")}sec Min={testTimeMin.ToString("F2")}sec Max={testTimeMax.ToString("F2")}sec"; + } + } + private void CellRender(DataGridCellRenderEventArgs args) { if (args.Column.Property == null) @@ -154,28 +205,28 @@ } } - private async Task OnCellContextMenu(DataGridCellMouseEventArgs args) - { - SelectedRow = new List() { args.Data }; + // private async Task OnCellContextMenu(DataGridCellMouseEventArgs args) + // { + // SelectedRow = new List() { args.Data }; - ContextMenuService.Open(args, - new List { - new ContextMenuItem(){ Text = "Overview", Value = 1, Icon = "home" }, - new ContextMenuItem(){ Text = "Detail Overview", Value =2 , Icon = "assessment" }, - new ContextMenuItem(){ Text = "Test History", Value = 3, Icon = "description" }, - new ContextMenuItem(){ Text = "Test Summary", Value = 4, Icon = "assignment_turned_in" }, - new ContextMenuItem(){ Text = "Detail Data", Value = 5, Icon = "list" }, - new ContextMenuItem(){ Text = "Test-Error/Extended Search", Value = 6, Icon = "search" }, - }, - (e) => - { - ContextMenuService.Close(); - OnClickContextMenu.InvokeAsync(); - } - ); + // ContextMenuService.Open(args, + // new List { + // new ContextMenuItem(){ Text = "Overview", Value = 1, Icon = "home" }, + // new ContextMenuItem(){ Text = "Detail Overview", Value =2 , Icon = "assessment" }, + // new ContextMenuItem(){ Text = "Test History", Value = 3, Icon = "description" }, + // new ContextMenuItem(){ Text = "Test Summary", Value = 4, Icon = "assignment_turned_in" }, + // new ContextMenuItem(){ Text = "Detail Data", Value = 5, Icon = "list" }, + // new ContextMenuItem(){ Text = "Test-Error/Extended Search", Value = 6, Icon = "search" }, + // }, + // (e) => + // { + // ContextMenuService.Close(); + // OnClickContextMenu.InvokeAsync(); + // } + // ); - await OnSelectRow.InvokeAsync(args.Data); - } + // await OnSelectRow.InvokeAsync(args.Data); + // } private async Task SelectRow(TDataModel data) { diff --git a/Projects/WebClient/Web.Tra/Components/Module/TraGrid.razor.css b/Projects/WebClient/Web.Tra/Components/Module/TraGrid.razor.css deleted file mode 100644 index 2ef400d..0000000 --- a/Projects/WebClient/Web.Tra/Components/Module/TraGrid.razor.css +++ /dev/null @@ -1,3 +0,0 @@ -.custom-rz-value { - font-size: 1.5rem !important; -}