mirror of
https://gitee.com/ThingsGateway/ThingsGateway.git
synced 2025-10-27 05:37:10 +08:00
123 lines
5.7 KiB
Plaintext
123 lines
5.7 KiB
Plaintext
@*
|
||
//------------------------------------------------------------------------------
|
||
// 此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
|
||
// 此代码版权(除特别声明外的代码)归作者本人Diego所有
|
||
// 源代码使用协议遵循本仓库的开源协议及附加协议
|
||
// Gitee源代码仓库:https://gitee.com/diego2098/ThingsGateway
|
||
// Github源代码仓库:https://github.com/kimdiego2098/ThingsGateway
|
||
// 使用文档:https://diego2098.gitee.io/thingsgateway-docs/
|
||
// QQ群:605534569
|
||
//------------------------------------------------------------------------------
|
||
*@
|
||
|
||
@namespace ThingsGateway.Admin.Blazor
|
||
@using Masa.Blazor.Presets
|
||
@using ThingsGateway.Admin.Application;
|
||
@inherits LayoutComponentBase
|
||
@layout BaseLayout
|
||
@if (UserManager.UserId > 0)
|
||
{
|
||
<SysSignalR></SysSignalR>
|
||
}
|
||
<PPageTabsProvider>
|
||
|
||
<CascadingValue Value="@this" IsFixed>
|
||
<CascadingValue Value="@Changed" Name="Changed">
|
||
|
||
<MNavigationDrawer Color="barcolor" @bind-Value="_drawerOpen" App Width="200">
|
||
@if (IsMobile)
|
||
{
|
||
<MSystemBar Color="barcolor" Height="@(BlazorResourceConst.PageTabsHeight)">
|
||
<MButton Icon OnClick=@(()=> _drawerOpen = !_drawerOpen)>
|
||
<MIcon>
|
||
mdi-close-thick
|
||
</MIcon>
|
||
</MButton>
|
||
<MSpacer />
|
||
<AppbarButtons />
|
||
</MSystemBar>
|
||
}
|
||
<Logo CONFIG_COPYRIGHT=@CONFIG_COPYRIGHT CONFIG_TITLE=@CONFIG_TITLE HeightInt=@(IsMobile?BlazorResourceConst.AppBarHeight:BlazorResourceConst.AppBarHeight+BlazorResourceConst.PageTabsHeight) />
|
||
<AppList ClassString="overflow-y-auto" Routable
|
||
StyleString=@($"height: calc(100vh - {BlazorResourceConst.AppBarHeight+BlazorResourceConst.PageTabsHeight}px);")
|
||
Items="Navs" />
|
||
</MNavigationDrawer>
|
||
|
||
<MAppBar Color="barcolor" Style=@($"{(!(IsMobile||_drawerOpen!=true)? "left:200px;":"")}") Elevation="1" App Flat ClippedRight Dense ElevateOnScroll
|
||
MaxHeight="@(BlazorResourceConst.AppBarHeight)" Height="@(BlazorResourceConst.AppBarHeight)">
|
||
<MButton Class="mr-0" Icon Small=IsMobile OnClick=@(() => _drawerOpen = !_drawerOpen)>
|
||
<MIcon>mdi-menu</MIcon>
|
||
</MButton>
|
||
<AppBarItems BreadcrumbSysResources="BreadcrumbSysResources" SearchSysResources="SearchSysResources" CONFIG_COPYRIGHT=@CONFIG_COPYRIGHT CONFIG_COPYRIGHT_URL=@CONFIG_COPYRIGHT_URL CONFIG_TITLE=@CONFIG_TITLE>
|
||
</AppBarItems>
|
||
|
||
</MAppBar>
|
||
|
||
<MMain Style=@($"{(!(IsMobile||_drawerOpen!=true)? "padding-left:200px;":"")}")>
|
||
<div class="full-width">
|
||
<PageTabs @ref="_pageTabs" PageTabItems="PageTabItems" />
|
||
</div>
|
||
<MDivider Center></MDivider>
|
||
<MCard Flat Class="overflow-y-auto overflow-x-hidden ma-auto pa-0 rounded-0" Style=@($"height: calc(100vh - {BlazorResourceConst.AppBarHeight+BlazorResourceConst.PageTabsHeight+BlazorResourceConst.FooterHeight}px);")>
|
||
<PPageContainer PageTabs="@_pageTabs?.PPageTabs">
|
||
@Body
|
||
</PPageContainer>
|
||
</MCard>
|
||
<MSheet Class="d-flex justify-center align-center rounded-0" Style=@($"height: {BlazorResourceConst.FooterHeight}px; ")>
|
||
<Foter CONFIG_COPYRIGHT=@CONFIG_COPYRIGHT CONFIG_COPYRIGHT_URL=@CONFIG_COPYRIGHT_URL CONFIG_TITLE=@CONFIG_TITLE></Foter>
|
||
</MSheet>
|
||
</MMain>
|
||
</CascadingValue>
|
||
</CascadingValue>
|
||
|
||
</PPageTabsProvider>
|
||
|
||
|
||
@code {
|
||
private bool? _drawerOpen = true;
|
||
private PageTabs _pageTabs;
|
||
private List<SysResource> BreadcrumbSysResources = new();
|
||
private string CONFIG_COPYRIGHT = "";
|
||
private string CONFIG_COPYRIGHT_URL = "";
|
||
private string CONFIG_TITLE = "";
|
||
private List<SysResource> SearchSysResources = new();
|
||
/// <summary>
|
||
/// IsMobile
|
||
/// </summary>
|
||
[CascadingParameter(Name = "IsMobile")]
|
||
public bool IsMobile { get; set; }
|
||
|
||
bool Changed { get; set; }
|
||
private List<NavItem> Navs { get; set; } = new();
|
||
private List<PageTabItem> PageTabItems { get; set; } = new();
|
||
[Inject]
|
||
private UserResoures UserResoures { get; set; }
|
||
|
||
/// <summary>
|
||
/// 页面刷新
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public async Task StateHasChangedAsync()
|
||
{
|
||
CONFIG_COPYRIGHT = (await App.GetService<IConfigService>().GetByConfigKeyAsync(ConfigConst.SYS_CONFIGBASEDEFAULT, ConfigConst.CONFIG_COPYRIGHT)).ConfigValue;
|
||
CONFIG_TITLE = (await App.GetService<IConfigService>().GetByConfigKeyAsync(ConfigConst.SYS_CONFIGBASEDEFAULT, ConfigConst.CONFIG_TITLE)).ConfigValue;
|
||
CONFIG_COPYRIGHT_URL = (await App.GetService<IConfigService>().GetByConfigKeyAsync(ConfigConst.SYS_CONFIGBASEDEFAULT, ConfigConst.CONFIG_COPYRIGHT_URL)).ConfigValue;
|
||
await UserResoures.InitUserAsync();
|
||
await UserResoures.InitMenuAsync();
|
||
Navs = UserResoures.Menus.ParseNavItem();
|
||
PageTabItems = UserResoures.PageTabItems;
|
||
SearchSysResources = UserResoures.SameLevelMenus;
|
||
BreadcrumbSysResources = UserResoures.AllSameLevelMenuSpas;
|
||
Changed = !Changed;
|
||
await InvokeAsync(StateHasChanged);
|
||
}
|
||
/// <summary>
|
||
/// <inheritdoc/>
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
protected override async Task OnInitializedAsync()
|
||
{
|
||
await StateHasChangedAsync();
|
||
await base.OnInitializedAsync();
|
||
}
|
||
} |