refactor: ui样式修改

This commit is contained in:
Diego
2025-03-21 10:48:11 +08:00
parent 1cc5f538aa
commit 3942819fed
15 changed files with 105 additions and 54 deletions

View File

@@ -2,7 +2,7 @@
@using ThingsGateway.Admin.Application @using ThingsGateway.Admin.Application
@inherits ComponentDefault @inherits ComponentDefault
<div class=" choice-module w-100"> <div class=" choice-module w-100">
<Tab Placement="Placement.TopCenter" class="w-100 mt-2" OnClickTabItemAsync="OnMenuClickAsync"> <Tab Placement="Placement.TopCenter" class="w-100" OnClickTabItemAsync="OnMenuClickAsync">
@foreach (var item in RibbonTabItems) @foreach (var item in RibbonTabItems)
{ {

View File

@@ -27,8 +27,8 @@
::deep .avatar { ::deep .avatar {
border-radius: 1.5rem; border-radius: 1.5rem;
width: 36px; width: 28px;
height: 36px; height: 28px;
background-color: var(--bs-green); background-color: var(--bs-green);
color: #fff; color: #fff;
} }
@@ -38,6 +38,6 @@
} }
.user-avatar { .user-avatar {
width: 36px; width: 28px;
height: 36px; height: 28px;
} }

View File

@@ -1,7 +1,7 @@
::deep .avatar { ::deep .avatar {
border-radius: 1.5rem; border-radius: 1.5rem;
width: 36px; width: 28px;
height: 36px; height: 28px;
background-color: var(--bs-green); background-color: var(--bs-green);
color: #fff; color: #fff;
flex: 0 0 auto; flex: 0 0 auto;
@@ -23,7 +23,7 @@
} }
.mainlayout ::deep .tabs { .mainlayout ::deep .tabs {
--bb-tabs-item-height: 32px; --bb-tabs-item-height: 28px;
--bb-tabs-body-padding: 0.5rem; --bb-tabs-body-padding: 0.5rem;
} }
@@ -86,7 +86,8 @@
} }
.mainlayout ::deep .tabs-item .tabs-item-close { .mainlayout ::deep .tabs-item .tabs-item-close {
top: 5px; right: .2rem;
top: 2.5px;
} }
.mainlayout ::deep .table-wrapper { .mainlayout ::deep .table-wrapper {
@@ -102,7 +103,7 @@
} }
.mainlayout ::deep .layout { .mainlayout ::deep .layout {
--bb-layout-header-height: 44px; --bb-layout-header-height: 32px;
--bb-layout-headerbar-background: transparent; --bb-layout-headerbar-background: transparent;
--bs-navbar-color: var(--bb-layout-header-color); --bs-navbar-color: var(--bb-layout-header-color);
--bb-layout-header-color: var(--bs-body-color); --bb-layout-header-color: var(--bs-body-color);
@@ -135,8 +136,8 @@
} }
.mainlayout ::deep .layout-header .dropdown-logout { .mainlayout ::deep .layout-header .dropdown-logout {
--bb-logout-avatar-width: 32px; --bb-logout-avatar-width: 28px;
--bb-logout-avatar-height: 32px; --bb-logout-avatar-height: 28px;
--bb-logout-user-bg: rgba(52,58,64,0.7); --bb-logout-user-bg: rgba(52,58,64,0.7);
--bb-logout-menu-border-color: var(--bs-border-color); --bb-logout-menu-border-color: var(--bs-border-color);
} }

View File

@@ -1,6 +1,6 @@
@inherits BootstrapComponentBase @inherits BootstrapComponentBase
@namespace ThingsGateway.Razor @namespace ThingsGateway.Razor
<div class="flex-xl-fill flex-xl-grow-0 justify-content-xl-end px-2"> <div class="flex-xl-fill flex-xl-grow-0 justify-content-xl-end px-2" style="width:150px">
<Select Value="@SelectedCulture" OnSelectedItemChanged="@SetCulture" IsPopover> <Select Value="@SelectedCulture" OnSelectedItemChanged="@SetCulture" IsPopover>
<Options> <Options>
@foreach (var kv in BootstrapOptions.CurrentValue.GetSupportedCultures()) @foreach (var kv in BootstrapOptions.CurrentValue.GetSupportedCultures())

View File

@@ -153,6 +153,6 @@ pre code.hljs {
} }
.tabs { .tabs {
--bb-tabs-item-height: 29px; --bb-tabs-item-height: 28px;
--bb-tabs-body-padding: .5rem; --bb-tabs-body-padding: .5rem;
} }

View File

@@ -5,7 +5,7 @@
--bs-primary-bg1: rgba(var(--bs-blue-rgb),0.1); --bs-primary-bg1: rgba(var(--bs-blue-rgb),0.1);
--bs-primary-bg7: rgba(var(--bs-blue-rgb),0.7); --bs-primary-bg7: rgba(var(--bs-blue-rgb),0.7);
--bs-nav-link-font-size: 0.8rem; --bs-nav-link-font-size: 0.8rem;
--bb-layout-header-height: 44px; --bb-layout-header-height: 32px;
--bb-layout-headerbar-background: transparent; --bb-layout-headerbar-background: transparent;
--bs-navbar-color: var(--bb-layout-header-color); --bs-navbar-color: var(--bb-layout-header-color);
--bs-navbar-hover-color: var(--bs-primary); --bs-navbar-hover-color: var(--bs-primary);

View File

@@ -1,8 +1,8 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<PluginVersion>10.1.28</PluginVersion> <PluginVersion>10.1.29</PluginVersion>
<ProPluginVersion>10.1.28</ProPluginVersion> <ProPluginVersion>10.1.29</ProPluginVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>

View File

@@ -1464,7 +1464,30 @@ EventCallback.Factory.Create<MouseEventArgs>(this, async e =>
} }
private static bool ModelEqualityComparer(ChannelDeviceTreeItem x, ChannelDeviceTreeItem y) => x.Equals(y); private static bool ModelEqualityComparer(ChannelDeviceTreeItem x, ChannelDeviceTreeItem y)
{
if (x.ChannelDevicePluginType == y.ChannelDevicePluginType)
{
if (x.ChannelDevicePluginType == ChannelDevicePluginTypeEnum.Device)
{
return x.DeviceRuntime.Id == y.DeviceRuntime.Id; ;
}
else if (x.ChannelDevicePluginType == ChannelDevicePluginTypeEnum.PluginType)
{
return x.PluginType == y.PluginType;
}
else if (x.ChannelDevicePluginType == ChannelDevicePluginTypeEnum.Channel)
{
return x.ChannelRuntime.Id == y.ChannelRuntime.Id;
}
else if (x.ChannelDevicePluginType == ChannelDevicePluginTypeEnum.PluginName)
{
return x.PluginName == y.PluginName;
}
}
return false;
}
private bool Disposed; private bool Disposed;
public void Dispose() public void Dispose()
{ {

View File

@@ -29,13 +29,13 @@
} }
else else
{ {
if (ShowDeviceRuntime != null) if (GlobalData.ReadOnlyIdDevices.TryGetValue(ShowDeviceRuntime,out var device))
{ {
<DeviceRuntimeInfo DeviceRuntime="ShowDeviceRuntime" /> <DeviceRuntimeInfo DeviceRuntime="device" />
} }
if (ShowChannelRuntime != null) if (GlobalData.ReadOnlyChannels.TryGetValue(ShowChannelRuntime, out var channel))
{ {
<ChannelRuntimeInfo ChannelRuntime="ShowChannelRuntime" /> <ChannelRuntimeInfo ChannelRuntime="channel" />
} }
} }
</SecondPaneTemplate> </SecondPaneTemplate>

View File

@@ -12,20 +12,45 @@ using ThingsGateway.Gateway.Application;
namespace ThingsGateway.Gateway.Razor; namespace ThingsGateway.Gateway.Razor;
public partial class GatewayMonitorPage public partial class GatewayMonitorPage : IDisposable
{ {
private ChannelDeviceTreeItem SelectModel { get; set; } = new() { ChannelDevicePluginType = ChannelDevicePluginTypeEnum.PluginType, PluginType = PluginTypeEnum.Collect }; private ChannelDeviceTreeItem SelectModel { get; set; } = new() { ChannelDevicePluginType = ChannelDevicePluginTypeEnum.PluginType, PluginType = PluginTypeEnum.Collect };
#region #region
[Inject]
private IDispatchService<DeviceRuntime> DeviceRuntimeDispatchService { get; set; }
[Inject]
private IDispatchService<ChannelRuntime> ChannelRuntimeDispatchService { get; set; }
protected override void OnInitialized()
{
ChannelRuntimeDispatchService.Subscribe(Refresh);
DeviceRuntimeDispatchService.Subscribe(Refresh);
base.OnInitialized();
}
public void Dispose()
{
ChannelRuntimeDispatchService.UnSubscribe(Refresh);
DeviceRuntimeDispatchService.UnSubscribe(Refresh);
GC.SuppressFinalize(this);
}
private async Task Refresh(DispatchEntry<DeviceRuntime> entry)
{
await InvokeAsync(StateHasChanged);
}
private async Task Refresh(DispatchEntry<ChannelRuntime> entry)
{
await InvokeAsync(StateHasChanged);
}
private async Task TreeChangedAsync(ChannelDeviceTreeItem channelDeviceTreeItem) private async Task TreeChangedAsync(ChannelDeviceTreeItem channelDeviceTreeItem)
{ {
ShowChannelRuntime = null; ShowChannelRuntime = 0;
ShowDeviceRuntime = null; ShowDeviceRuntime = 0;
SelectModel = channelDeviceTreeItem; SelectModel = channelDeviceTreeItem;
if (channelDeviceTreeItem.TryGetChannelRuntime(out var channelRuntime)) if (channelDeviceTreeItem.TryGetChannelRuntime(out var channelRuntime))
{ {
ShowChannelRuntime = channelRuntime; ShowChannelRuntime = channelRuntime.Id;
if (channelRuntime.IsCollect == true) if (channelRuntime.IsCollect == true)
{ {
VariableRuntimes = channelRuntime.ReadDeviceRuntimes.SelectMany(a => a.Value.ReadOnlyVariableRuntimes.Select(a => a.Value).Where(a => a != null)); VariableRuntimes = channelRuntime.ReadDeviceRuntimes.SelectMany(a => a.Value.ReadOnlyVariableRuntimes.Select(a => a.Value).Where(a => a != null));
@@ -38,7 +63,7 @@ public partial class GatewayMonitorPage
} }
else if (channelDeviceTreeItem.TryGetDeviceRuntime(out var deviceRuntime)) else if (channelDeviceTreeItem.TryGetDeviceRuntime(out var deviceRuntime))
{ {
ShowDeviceRuntime = deviceRuntime; ShowDeviceRuntime = deviceRuntime.Id;
if (deviceRuntime.IsCollect == true) if (deviceRuntime.IsCollect == true)
{ {
VariableRuntimes = deviceRuntime.ReadOnlyVariableRuntimes.Select(a => a.Value).Where(a => a != null); VariableRuntimes = deviceRuntime.ReadOnlyVariableRuntimes.Select(a => a.Value).Where(a => a != null);
@@ -81,8 +106,8 @@ public partial class GatewayMonitorPage
} }
public IEnumerable<VariableRuntime> VariableRuntimes { get; set; } = Enumerable.Empty<VariableRuntime>(); public IEnumerable<VariableRuntime> VariableRuntimes { get; set; } = Enumerable.Empty<VariableRuntime>();
private ChannelRuntime ShowChannelRuntime { get; set; } private long ShowChannelRuntime { get; set; }
private DeviceRuntime ShowDeviceRuntime { get; set; } private long ShowDeviceRuntime { get; set; }
public ShowTypeEnum? ShowType { get; set; } public ShowTypeEnum? ShowType { get; set; }
private bool AutoRestartThread { get; set; } = true; private bool AutoRestartThread { get; set; } = true;

View File

@@ -1,7 +1,7 @@
::deep .avatar { ::deep .avatar {
border-radius: 1.5rem; border-radius: 1.5rem;
width: 36px; width: 28px;
height: 36px; height: 28px;
background-color: var(--bs-green); background-color: var(--bs-green);
color: #fff; color: #fff;
flex: 0 0 auto; flex: 0 0 auto;
@@ -23,7 +23,7 @@
} }
.mainlayout ::deep .tabs { .mainlayout ::deep .tabs {
--bb-tabs-item-height: 32px; --bb-tabs-item-height: 28px;
--bb-tabs-body-padding: 0.5rem; --bb-tabs-body-padding: 0.5rem;
} }
@@ -86,7 +86,8 @@
} }
.mainlayout ::deep .tabs-item .tabs-item-close { .mainlayout ::deep .tabs-item .tabs-item-close {
top: 5px; right: .2rem;
top: 2.5px;
} }
.mainlayout ::deep .table-wrapper { .mainlayout ::deep .table-wrapper {
@@ -102,7 +103,7 @@
} }
.mainlayout ::deep .layout { .mainlayout ::deep .layout {
--bb-layout-header-height: 44px; --bb-layout-header-height: 32px;
--bb-layout-headerbar-background: transparent; --bb-layout-headerbar-background: transparent;
--bs-navbar-color: var(--bb-layout-header-color); --bs-navbar-color: var(--bb-layout-header-color);
--bb-layout-header-color: var(--bs-body-color); --bb-layout-header-color: var(--bs-body-color);
@@ -135,8 +136,8 @@
} }
.mainlayout ::deep .layout-header .dropdown-logout { .mainlayout ::deep .layout-header .dropdown-logout {
--bb-logout-avatar-width: 32px; --bb-logout-avatar-width: 28px;
--bb-logout-avatar-height: 32px; --bb-logout-avatar-height: 28px;
--bb-logout-user-bg: rgba(52,58,64,0.7); --bb-logout-user-bg: rgba(52,58,64,0.7);
--bb-logout-menu-border-color: var(--bs-border-color); --bb-logout-menu-border-color: var(--bs-border-color);
} }

View File

@@ -27,8 +27,8 @@
::deep .avatar { ::deep .avatar {
border-radius: 1.5rem; border-radius: 1.5rem;
width: 36px; width: 28px;
height: 36px; height: 28px;
background-color: var(--bs-green); background-color: var(--bs-green);
color: #fff; color: #fff;
} }
@@ -38,6 +38,6 @@
} }
.user-avatar { .user-avatar {
width: 36px; width: 28px;
height: 36px; height: 28px;
} }

View File

@@ -60,7 +60,7 @@
@* 全屏按钮 *@ @* 全屏按钮 *@
<FullScreenButton class="layout-header-bar d-none d-lg-flex px-2" Icon="fa fa-arrows-alt" <FullScreenButton class="layout-header-bar d-none d-lg-flex px-2" Icon="fa fa-arrows-alt"
TooltipPlacement=Placement.Bottom TooltipText="@Localizer[nameof(FullScreenButton)]" /> TooltipPlacement=Placement.Bottom TooltipText="@Localizer[nameof(FullScreenButton)]" />
@if (WebsiteOption.Value.IsShowAbout) @if (WebsiteOption.Value.IsShowAbout)
{ {
@@ -87,11 +87,11 @@
</Side> </Side>
<Main> <Main>
<Tab @ref=Tab ClickTabToNavigation="true" ShowExtendButtons="false" ShowClose="true" AllowDrag=true <Tab @ref=Tab ClickTabToNavigation="true" ShowExtendButtons="false" ShowClose="true" AllowDrag=true
AdditionalAssemblies="@App.RazorAssemblies" Menus="@MenuService.AllOwnMenuItems" AdditionalAssemblies="@App.RazorAssemblies" Menus="@MenuService.AllOwnMenuItems"
DefaultUrl=@("/") Body=@(Body!) OnCloseTabItemAsync=@((a)=> DefaultUrl=@("/") Body=@(Body!) OnCloseTabItemAsync=@((a)=>
{ {
return Task.FromResult(!(a.Url=="/"||a.Url.IsNullOrEmpty())); return Task.FromResult(!(a.Url=="/"||a.Url.IsNullOrEmpty()));
})> })>
</Tab> </Tab>
</Main> </Main>

View File

@@ -1,7 +1,7 @@
::deep .avatar { ::deep .avatar {
border-radius: 1.5rem; border-radius: 1.5rem;
width: 36px; width: 28px;
height: 36px; height: 28px;
background-color: var(--bs-green); background-color: var(--bs-green);
color: #fff; color: #fff;
flex: 0 0 auto; flex: 0 0 auto;
@@ -23,7 +23,7 @@
} }
.mainlayout ::deep .tabs { .mainlayout ::deep .tabs {
--bb-tabs-item-height: 32px; --bb-tabs-item-height: 28px;
--bb-tabs-body-padding: 0.5rem; --bb-tabs-body-padding: 0.5rem;
} }
@@ -86,7 +86,8 @@
} }
.mainlayout ::deep .tabs-item .tabs-item-close { .mainlayout ::deep .tabs-item .tabs-item-close {
top: 5px; right: .2rem;
top: 2.5px;
} }
.mainlayout ::deep .table-wrapper { .mainlayout ::deep .table-wrapper {
@@ -102,7 +103,7 @@
} }
.mainlayout ::deep .layout { .mainlayout ::deep .layout {
--bb-layout-header-height: 44px; --bb-layout-header-height: 32px;
--bb-layout-headerbar-background: transparent; --bb-layout-headerbar-background: transparent;
--bs-navbar-color: var(--bb-layout-header-color); --bs-navbar-color: var(--bb-layout-header-color);
--bb-layout-header-color: var(--bs-body-color); --bb-layout-header-color: var(--bs-body-color);
@@ -135,8 +136,8 @@
} }
.mainlayout ::deep .layout-header .dropdown-logout { .mainlayout ::deep .layout-header .dropdown-logout {
--bb-logout-avatar-width: 32px; --bb-logout-avatar-width: 28px;
--bb-logout-avatar-height: 32px; --bb-logout-avatar-height: 28px;
--bb-logout-user-bg: rgba(52,58,64,0.7); --bb-logout-user-bg: rgba(52,58,64,0.7);
--bb-logout-menu-border-color: var(--bs-border-color); --bb-logout-menu-border-color: var(--bs-border-color);
} }

View File

@@ -1,6 +1,6 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<Version>10.1.28</Version> <Version>10.1.29</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>