diff --git a/MP.SPEC/Components/ListPARAMS.razor.cs b/MP.SPEC/Components/ListPARAMS.razor.cs index 506d9efe..22bb17dd 100644 --- a/MP.SPEC/Components/ListPARAMS.razor.cs +++ b/MP.SPEC/Components/ListPARAMS.razor.cs @@ -45,8 +45,8 @@ namespace MP.SPEC.Components if (_selFlux != value) { _selFlux = value; - var pUpd = Task.Run(async () => await reloadData(false)); - pUpd.Wait(); + //var pUpd = Task.Run(async () => await reloadData(false)); + //pUpd.Wait(); } } } @@ -60,8 +60,8 @@ namespace MP.SPEC.Components if (_selMacchina != value) { _selMacchina = value; - var pUpd = Task.Run(async () => await reloadData(false)); - pUpd.Wait(); + //var pUpd = Task.Run(async () => await reloadData(false)); + //pUpd.Wait(); } } } diff --git a/MP.SPEC/Components/ParamsFilter.razor b/MP.SPEC/Components/ParamsFilter.razor new file mode 100644 index 00000000..5cf43c6c --- /dev/null +++ b/MP.SPEC/Components/ParamsFilter.razor @@ -0,0 +1,34 @@ +
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+
diff --git a/MP.SPEC/Components/ParamsFilter.razor.cs b/MP.SPEC/Components/ParamsFilter.razor.cs new file mode 100644 index 00000000..338e99af --- /dev/null +++ b/MP.SPEC/Components/ParamsFilter.razor.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Components; +using System.Net.Http; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.AspNetCore.Components.Forms; +using Microsoft.AspNetCore.Components.Routing; +using Microsoft.AspNetCore.Components.Web; +using Microsoft.AspNetCore.Components.Web.Virtualization; +using Microsoft.JSInterop; +using MP.SPEC; +using MP.SPEC.Shared; +using MP.SPEC.Components; +using MP.SPEC.Data; + +namespace MP.SPEC.Components +{ + public partial class ParamsFilter + { + [Parameter] + public SelectFluxParams SelFilter { get; set; } + + [Parameter] + public EventCallback FilterChanged { get; set; } + + protected string selMacchina + { + get + { + return SelFilter.IdxMacchina; + } + + set + { + if (!SelFilter.IdxMacchina.Equals(value)) + { + SelFilter.IdxMacchina = value; + SelFilter.CodFlux = "*"; + Task.Delay(1); + ListFlux = MDService.ParametriGetFilt(selMacchina).Result; + Task.Delay(1); + StateHasChanged(); + Task.Delay(1); + reportChange(); + } + } + } + + protected string selFlux + { + get + { + return SelFilter.CodFlux; + } + + set + { + if (!SelFilter.CodFlux.Equals(value)) + { + SelFilter.CodFlux = value; + reportChange(); + } + } + } + + private void reportChange() + { + FilterChanged.InvokeAsync(SelFilter); + } + + protected override async Task OnInitializedAsync() + { + SelFilter = new SelectFluxParams(); + ListMacchine = await MDService.MacchineWithFlux(); + ListFlux = await MDService.ParametriGetFilt(selMacchina); + } + + + private List? ListFlux; + + private List? ListMacchine; + + [Inject] + protected MpDataService MDService { get; set; } + + + private async Task reloadFiltFlux() + { + await Task.Delay(1); + ListFlux = await MDService.ParametriGetFilt(selMacchina); + await InvokeAsync(() => StateHasChanged()); + } + } +} \ No newline at end of file diff --git a/MP.SPEC/Data/SelectFluxParams.cs b/MP.SPEC/Data/SelectFluxParams.cs new file mode 100644 index 00000000..a783c5ef --- /dev/null +++ b/MP.SPEC/Data/SelectFluxParams.cs @@ -0,0 +1,36 @@ +namespace MP.SPEC.Data +{ + public class SelectFluxParams + { + #region Public Properties + + public string IdxMacchina { get; set; } = "*"; + public string CodFlux { get; set; } = "*"; + + #endregion Public Properties + + #region Public Methods + + + + public override bool Equals(object obj) + { + if (!(obj is SelectFluxParams item)) + return false; + + if (IdxMacchina != item.IdxMacchina) + return false; + if (CodFlux != item.CodFlux) + return false; + + return true; + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + #endregion Public Methods + } +} diff --git a/MP.SPEC/Pages/PARAMS.razor b/MP.SPEC/Pages/PARAMS.razor index 94f175d1..b1952d0d 100644 --- a/MP.SPEC/Pages/PARAMS.razor +++ b/MP.SPEC/Pages/PARAMS.razor @@ -11,7 +11,7 @@ @if (!liveUpdate) { } else @@ -29,7 +29,7 @@
-
+ @*
@@ -45,23 +45,34 @@
- + + @if (ListFlux != null) { - + foreach (var item in ListFlux) + { + + } } - } - + + }
-
+
*@ +
- + @if (isLoading) + { + + } + else + { + + }
- + @if (isLoading) + { + + } + else + { + + }