Сделал раздел с устройствами где есть Datagrid с выводом как местоположений так и устройств в них

This commit is contained in:
Hukuta committed 2026-05-07 19:04:10 +09:00
1 parent 3d52cd5691
commit 17e4794160
25 files changed
+595 -308

No files matched your search

+4 -34
View File
@@ -7,24 +7,10 @@
<RadzenSidebar @bind-Expanded="sideBarExpanded">
<RadzenPanelMenu>
<RadzenPanelMenuItem Text="Добавить принтер" Icon="Add" Click="@(() => NavigationManager.NavigateTo("/PrinterAdd"))" />
@if (locations == null)
{
<RadzenPanelMenuItem Text="..." />
}
else
{
@foreach (LocationDtoNameAndPrinters location in locations)
{
<RadzenPanelMenuItem Text="@(location.name)" Icon="Label">
@foreach (PrinterDtoWithNameAndId dto in location.printers)
{
<RadzenPanelMenuItem Text="@(dto.name)" Icon="Print" Click="@(() => NavigationManager.NavigateTo($"/PrinterPage/{dto.id}"))" />
}
</RadzenPanelMenuItem>
}
<RadzenPanelMenuItem Text="Картриджи" Icon="inventory_2" Click="@(() => NavigationManager.NavigateTo("/Cartridges"))"/>
}
<RadzenPanelMenuItem Text="Панель управления" Icon="dashboard_2"/>
<RadzenPanelMenuItem Text="Устроства" Icon="print" Click="@(() => NavigationManager.NavigateTo("/Printers"))" />
<RadzenPanelMenuItem Text="Картриджи" Icon="inventory_2" Click="@(() => NavigationManager.NavigateTo("/Cartridges"))" />
<RadzenPanelMenuItem Text="Настройки" Icon="settings"/>
</RadzenPanelMenu>
</RadzenSidebar>
@@ -35,21 +21,5 @@
[EditorRequired]
public bool sideBarExpanded { get; set; }
List<LocationDtoNameAndPrinters>? locations = null;
protected override async Task OnInitializedAsync()
{
try
{
HttpClient client = new HttpClient();
var response = await client.GetAsync("http://localhost:5197/api/Location/GetAll");
var content = await response.Content.ReadAsStringAsync();
locations = JsonConvert.DeserializeObject<List<LocationDtoNameAndPrinters>>(content)!;
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
}
}