TAB:
- update gestione filtro articoli
This commit is contained in:
@@ -23,11 +23,15 @@
|
||||
{
|
||||
@foreach (var item in ListArticoli)
|
||||
{
|
||||
<option value="@item.CodArticolo">@item.CodArticolo | @item.DescArticolo | @item.Disegno</option>
|
||||
<option value="@item.Key">@item.Value</option>
|
||||
}
|
||||
@* @foreach (var item in ListArticoli)
|
||||
{
|
||||
<option value="@item.CodArticolo">@item.CodArticolo | @item.DescArticolo | @item.Disegno</option>
|
||||
} *@
|
||||
}
|
||||
</select>
|
||||
<label for="floatingSelect">Selezione Articolo (@Num2Displ / <b>@TotalCount</b>)</label>
|
||||
<label for="floatingSelect">Selezione Articolo (@DisplayCount / <b>@TotalCount</b>)</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-3 mb-2">
|
||||
@@ -43,54 +47,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* <div class="d-flex justify-content-between">
|
||||
<div>
|
||||
<h4>@Title</h4>
|
||||
</div>
|
||||
<div class="d-flex flex-row-reverse">
|
||||
<div class="px-1">
|
||||
<div class="input-group" title="Filtro Impianto">
|
||||
<span class="input-group-text"><i class="fa-solid fa-industry"></i></span>
|
||||
<select class="form-select" aria-label="Select Macchina" style="width: 15rem;">
|
||||
<option value="0" selected>-- Selezionare Impianto --</option>
|
||||
@if (ListMacchineAll == null || ListMacchineAll.Count == 0)
|
||||
{
|
||||
<b>loading...</b>
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var item in ListMacchineAll)
|
||||
{
|
||||
<option value="@item.IdxMacchina">@item.CodMacchina | @item.Descrizione</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-1">
|
||||
<div class="input-group" title="Filtro Articolo">
|
||||
<span class="input-group-text"><i class="fa-solid fa-box"></i></span>
|
||||
<input class="form-control" style="width: 4rem;" placeholder="*" title="Ricerca Articolo" @bind="@CurrFilt.SearchVal" />
|
||||
<select class="form-select" aria-label="Select Articolo" style="width: 25rem;">
|
||||
<option value="*" selected>-- Selezionare Articolo --</option>
|
||||
@if (ListArticoli == null || ListArticoli.Count == 0)
|
||||
{
|
||||
<b>loading...</b>
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var item in ListArticoli)
|
||||
{
|
||||
<option value="@item.CodArticolo">@item.CodArticolo | @item.DescArticolo</option>
|
||||
}
|
||||
<option disabled>...totale @TotalCount rec</option>
|
||||
}
|
||||
</select>
|
||||
<button class="btn btn-primary" @onclick="LoadMore" title="Show more"><b>+10</b</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> *@
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
@@ -110,8 +67,10 @@
|
||||
{
|
||||
if (!string.IsNullOrEmpty(SearchVal))
|
||||
{
|
||||
string ArtApiUrl = $"{BaseAddr}api/ListSelect/GetArticoli?SearchArt={SearchVal}";
|
||||
var rawData = await Http.GetFromJsonAsync<List<AnagArticoli>>(ArtApiUrl);
|
||||
string ArtApiUrl = $"{BaseAddr}api/ListSelect/GetDictArticoli?SearchArt={SearchVal}";
|
||||
// string ArtApiUrl = $"{BaseAddr}api/ListSelect/GetArticoli?SearchArt={SearchVal}";
|
||||
// var rawData = await Http.GetFromJsonAsync<List<AnagArticoli>>(ArtApiUrl);
|
||||
var rawData = await Http.GetFromJsonAsync<Dictionary<string,string>>(ArtApiUrl);
|
||||
if (rawData != null)
|
||||
{
|
||||
ListArticoliAll = rawData;
|
||||
@@ -120,7 +79,14 @@
|
||||
if (ListArticoliAll != null)
|
||||
{
|
||||
TotalCount = ListArticoliAll.Count;
|
||||
ListArticoli = ListArticoliAll.Take(Num2Displ).ToList();
|
||||
ListArticoli = ListArticoliAll.Take(Num2Displ).ToDictionary(x => x.Key, x => x.Value);
|
||||
DisplayCount = ListArticoli.Count;
|
||||
}
|
||||
else
|
||||
{
|
||||
TotalCount = 0;
|
||||
ListArticoli = new Dictionary<string, string>();
|
||||
DisplayCount = 0;
|
||||
}
|
||||
}
|
||||
await Task.Delay(1);
|
||||
@@ -176,6 +142,13 @@
|
||||
protected string CodArtSel { get; set; } = "";
|
||||
|
||||
|
||||
|
||||
protected Dictionary<string, string> ListArticoliAll { get; set; } = new Dictionary<string, string>();
|
||||
protected Dictionary<string, string>? ListArticoli { get; set; } = null;
|
||||
|
||||
// protected List<AnagArticoli>? ListArticoli { get; set; } = null;
|
||||
|
||||
|
||||
[Parameter]
|
||||
public int SearchMinChar { get; set; }
|
||||
[Parameter]
|
||||
@@ -187,8 +160,8 @@
|
||||
[Parameter]
|
||||
public List<Macchine> ListMacchineAll { get; set; } = new List<Macchine>();
|
||||
|
||||
[Parameter]
|
||||
public List<AnagArticoli> ListArticoliAll { get; set; } = new List<AnagArticoli>();
|
||||
// [Parameter]
|
||||
// public List<AnagArticoli> ListArticoliAll { get; set; } = new List<AnagArticoli>();
|
||||
|
||||
[Parameter]
|
||||
public int MatrOpr { get; set; } = 102;
|
||||
@@ -198,10 +171,10 @@
|
||||
|
||||
protected int Num2Displ { get; set; } = 50;
|
||||
protected int TotalCount { get; set; } = 0;
|
||||
protected int DisplayCount { get; set; } = 0;
|
||||
|
||||
|
||||
|
||||
protected List<AnagArticoli>? ListArticoli { get; set; } = null;
|
||||
|
||||
protected void LoadMore()
|
||||
{
|
||||
@@ -209,7 +182,7 @@
|
||||
// await Task.Delay(1);
|
||||
Num2Displ += 10;
|
||||
Num2Displ = Num2Displ < TotalCount ? Num2Displ : TotalCount;
|
||||
ListArticoli = ListArticoliAll.Take(Num2Displ).ToList();
|
||||
// ListArticoli = ListArticoliAll.Take(Num2Displ).ToList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<MP_TAB.Client.Components.HistTCFilt Title="Storico Tempi Ciclo" SearchMinChar="@SearchMinChar" E_SearchUpd="RepSearchUpd" ListArticoliAll="ListArticoli"></MP_TAB.Client.Components.HistTCFilt>
|
||||
<MP_TAB.Client.Components.HistTCFilt Title="Storico Tempi Ciclo" SearchMinChar="@SearchMinChar" E_SearchUpd="RepSearchUpd"></MP_TAB.Client.Components.HistTCFilt>
|
||||
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
@@ -50,6 +50,28 @@ namespace MP_TAB.Controllers
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("GetDictArticoli")]
|
||||
public async Task<Dictionary<string, string>> GetDictArticoli(string SearchArt, string Azienda = "*", int NumRec = 100000)
|
||||
{
|
||||
Dictionary<string, string> answ = new Dictionary<string, string>();
|
||||
await Task.Delay(1);
|
||||
try
|
||||
{
|
||||
var rawData = await FiltDataServ.ArticoliGetSearch(NumRec, Azienda, SearchArt);
|
||||
// trasformo!
|
||||
if (rawData != null)
|
||||
{
|
||||
answ = rawData.ToDictionary(x => x.CodArticolo, x => $"{x.CodArticolo} | {x.DescArticolo} | {x.Disegno}");
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in GetArticoli | SearchArt: {SearchArt} | Azienda: {Azienda} | NumRec: {NumRec}{Environment.NewLine}{exc}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
Reference in New Issue
Block a user