diff --git a/src/Admin/ThingsGateway.Admin.Razor/Components/AdminTable.razor b/src/Admin/ThingsGateway.Admin.Razor/Components/AdminTable.razor
index cd18ce8ee..b27b18179 100644
--- a/src/Admin/ThingsGateway.Admin.Razor/Components/AdminTable.razor
+++ b/src/Admin/ThingsGateway.Admin.Razor/Components/AdminTable.razor
@@ -5,7 +5,7 @@
where TItem : class, new()
{
+ ///
+ [Parameter]
+ public TableRenderMode RenderMode { get; set; }
+
public List Columns => Instance?.Columns;
diff --git a/src/Admin/ThingsGateway.NewLife.X/Common/WaitLock.cs b/src/Admin/ThingsGateway.NewLife.X/Common/WaitLock.cs
index 38dbe0e3e..43854ce84 100644
--- a/src/Admin/ThingsGateway.NewLife.X/Common/WaitLock.cs
+++ b/src/Admin/ThingsGateway.NewLife.X/Common/WaitLock.cs
@@ -8,8 +8,6 @@
// QQ群:605534569
//------------------------------------------------------------------------------
-using ThingsGateway.NewLife.Log;
-
namespace ThingsGateway.NewLife;
///
diff --git a/src/Admin/ThingsGateway.NewLife.X/Extension/PathExtensions.cs b/src/Admin/ThingsGateway.NewLife.X/Extension/PathExtensions.cs
index 7d8ca2fa7..a45652d04 100644
--- a/src/Admin/ThingsGateway.NewLife.X/Extension/PathExtensions.cs
+++ b/src/Admin/ThingsGateway.NewLife.X/Extension/PathExtensions.cs
@@ -8,8 +8,6 @@
// QQ群:605534569
//------------------------------------------------------------------------------
-using ThingsGateway.NewLife;
-
namespace ThingsGateway;
///
diff --git a/src/Admin/ThingsGateway.NewLife.X/Threading/TimerX.cs b/src/Admin/ThingsGateway.NewLife.X/Threading/TimerX.cs
index b4c5c7041..42e8e3f6a 100644
--- a/src/Admin/ThingsGateway.NewLife.X/Threading/TimerX.cs
+++ b/src/Admin/ThingsGateway.NewLife.X/Threading/TimerX.cs
@@ -1,7 +1,6 @@
using System.Reflection;
using ThingsGateway.NewLife.Log;
-using ThingsGateway.NewLife.Reflection;
namespace ThingsGateway.NewLife.Threading;
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 7eb2d180f..83aaa70a3 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -1,9 +1,9 @@
- 10.11.100
- 10.11.100
- 10.11.100
+ 10.11.101
+ 10.11.101
+ 10.11.101
10.11.6
10.11.6
8.0.20
diff --git a/src/Foundation/ThingsGateway.Foundation/Channel/IChannelOptions.cs b/src/Foundation/ThingsGateway.Foundation/Channel/IChannelOptions.cs
index 3c75b81f9..483a1f8f2 100644
--- a/src/Foundation/ThingsGateway.Foundation/Channel/IChannelOptions.cs
+++ b/src/Foundation/ThingsGateway.Foundation/Channel/IChannelOptions.cs
@@ -73,7 +73,7 @@ public interface IChannelOptions
bool RtsEnable { get; set; }
bool StreamAsync { get; set; }
-
+
Handshake Handshake { get; set; }
#endregion
///
diff --git a/src/Foundation/ThingsGateway.Foundation/Extensions/LoggerExtensions.cs b/src/Foundation/ThingsGateway.Foundation/Extensions/LoggerExtensions.cs
index 02f1dfcb5..1766eab5e 100644
--- a/src/Foundation/ThingsGateway.Foundation/Extensions/LoggerExtensions.cs
+++ b/src/Foundation/ThingsGateway.Foundation/Extensions/LoggerExtensions.cs
@@ -100,7 +100,7 @@ public static class LoggerExtensions
///
public static string GetDeviceLogBasePath()
{
- return PathExtensions.CombinePathWithOs("Logs","DeviceLog");
+ return PathExtensions.CombinePathWithOs("Logs", "DeviceLog");
}
///
diff --git a/src/Gateway/ThingsGateway.Gateway.Application/Entity/Channel.cs b/src/Gateway/ThingsGateway.Gateway.Application/Entity/Channel.cs
index b16b1fe96..9b362b748 100644
--- a/src/Gateway/ThingsGateway.Gateway.Application/Entity/Channel.cs
+++ b/src/Gateway/ThingsGateway.Gateway.Application/Entity/Channel.cs
@@ -143,7 +143,7 @@ public class Channel : ChannelOptionsBase, IPrimaryIdEntity, IBaseDataEntity, IB
[SugarColumn(ColumnDescription = "StreamAsync", IsNullable = true)]
[AutoGenerateColumn(Visible = false, Filterable = true, Sortable = true)]
public override bool StreamAsync { get; set; }
-
+
///
/// Handshake
///
diff --git a/src/Gateway/ThingsGateway.Gateway.Razor/Pages/GatewayMonitorPage/Variable/VariableRow.razor b/src/Gateway/ThingsGateway.Gateway.Razor/Pages/GatewayMonitorPage/Variable/VariableRow.razor
index c3f490f8e..d62e2f9cd 100644
--- a/src/Gateway/ThingsGateway.Gateway.Razor/Pages/GatewayMonitorPage/Variable/VariableRow.razor
+++ b/src/Gateway/ThingsGateway.Gateway.Razor/Pages/GatewayMonitorPage/Variable/VariableRow.razor
@@ -5,7 +5,6 @@
@using ThingsGateway.Admin.Razor
@using ThingsGateway.Gateway.Application
@inherits ComponentDefault
-@typeparam TItem
@foreach (var col in RowContent.Columns)
@@ -14,13 +13,7 @@
- @{
-
- @GetValue(col, RowContent.Row)
-
- }
+ @GetValue(col, RowContent.Row)
}
diff --git a/src/Gateway/ThingsGateway.Gateway.Razor/Pages/GatewayMonitorPage/Variable/VariableRow.razor.cs b/src/Gateway/ThingsGateway.Gateway.Razor/Pages/GatewayMonitorPage/Variable/VariableRow.razor.cs
index 16c4fda81..9abcf91a2 100644
--- a/src/Gateway/ThingsGateway.Gateway.Razor/Pages/GatewayMonitorPage/Variable/VariableRow.razor.cs
+++ b/src/Gateway/ThingsGateway.Gateway.Razor/Pages/GatewayMonitorPage/Variable/VariableRow.razor.cs
@@ -16,25 +16,33 @@ using TouchSocket.Core;
namespace ThingsGateway.Gateway.Razor;
-public partial class VariableRow : IDisposable
+public partial class VariableRow : IDisposable
{
[Parameter]
- public TableRowContext? RowContent { get; set; }
-
+ public TableRowContext? RowContent { get; set; }
+ private bool Disposed;
public void Dispose()
{
+ Disposed = true;
timer?.SafeDispose();
GC.SuppressFinalize(this);
}
TimerX? timer;
- protected override void OnInitialized()
+ protected override void OnAfterRender(bool firstRender)
{
- timer = new TimerX(Refresh, null, 1000, 1000, "VariableRow");
- base.OnInitialized();
+ if (firstRender)
+ {
+ timer = new TimerX(Refresh, null, 1000, 1000, "VariableRow");
+ }
+ base.OnAfterRender(firstRender);
}
+
private Task Refresh(object? state)
{
- return InvokeAsync(StateHasChanged);
+ if (!Disposed)
+ return InvokeAsync(StateHasChanged);
+ else
+ return Task.CompletedTask;
}
protected override void OnParametersSet()
@@ -49,7 +57,7 @@ public partial class VariableRow : IDisposable
///
///
///
- protected RenderFragment GetValue(ITableColumn col, TItem item) => builder =>
+ protected RenderFragment GetValue(ITableColumn col, VariableRuntime item) => builder =>
{
if (col.Template != null)
{
@@ -66,9 +74,9 @@ public partial class VariableRow : IDisposable
}
};
- internal static string? GetDoubleClickCellClassString(bool trigger) => CssBuilder.Default()
-.AddClass("is-dbcell", trigger)
-.Build();
+ // internal static string? GetDoubleClickCellClassString(bool trigger) => CssBuilder.Default()
+ //.AddClass("is-dbcell", trigger)
+ //.Build();
///
/// 获得指定列头固定列样式
@@ -160,16 +168,29 @@ public partial class VariableRow : IDisposable
///
///
///
- protected string? GetCellClassString(ITableColumn col, bool hasChildren, bool inCell) => CellClassStringCache.GetOrAdd(col, col => CssBuilder.Default("table-cell")
- .AddClass(col.GetAlign().ToDescriptionString(), col.Align == Alignment.Center || col.Align == Alignment.Right)
- .AddClass("is-wrap", col.GetTextWrap())
- .AddClass("is-ellips", col.GetTextEllipsis())
- .AddClass("is-tips", col.GetShowTips())
- .AddClass("is-resizable", AllowResizing)
- .AddClass("is-tree", IsTree && hasChildren)
- .AddClass("is-incell", inCell)
- .AddClass(col.CssClass)
- .Build());
+ protected string? GetCellClassString(ITableColumn col, bool hasChildren, bool inCell)
+ {
+ if (CellClassStringCache.TryGetValue(col, out var cached))
+ {
+ return cached;
+ }
+ else
+ {
+ bool trigger = false;
+ return CellClassStringCache.GetOrAdd(col, col => CssBuilder.Default("table-cell")
+ .AddClass(col.GetAlign().ToDescriptionString(), col.Align == Alignment.Center || col.Align == Alignment.Right)
+ .AddClass("is-wrap", col.GetTextWrap())
+ .AddClass("is-ellips", col.GetTextEllipsis())
+ .AddClass("is-tips", col.GetShowTips())
+ .AddClass("is-resizable", AllowResizing)
+ .AddClass("is-tree", IsTree && hasChildren)
+ .AddClass("is-incell", inCell)
+.AddClass("is-dbcell", trigger)
+ .AddClass(col.CssClass)
+ .Build());
+ }
+
+ }
private bool AllowResizing = true;
private bool IsTree = false;
@@ -180,12 +201,24 @@ public partial class VariableRow : IDisposable
///
///
///
- protected string? GetFixedCellClassString(ITableColumn col) => FixedCellClassStringCache.GetOrAdd(col, col => CssBuilder.Default()
- .AddClass("fixed", col.Fixed)
- .AddClass("fixed-right", col.Fixed && IsTail(col))
- .AddClass("fr", IsLastColumn(col))
- .AddClass("fl", IsFirstColumn(col))
- .Build());
+ protected string? GetFixedCellClassString(ITableColumn col)
+ {
+ if (FixedCellClassStringCache.TryGetValue(col, out var cached))
+ {
+ return cached;
+ }
+ else
+ {
+ return FixedCellClassStringCache.GetOrAdd(col, col => CssBuilder.Default()
+ .AddClass("fixed", col.Fixed)
+ .AddClass("fixed-right", col.Fixed && IsTail(col))
+ .AddClass("fr", IsLastColumn(col))
+ .AddClass("fl", IsFirstColumn(col))
+ .Build());
+
+ }
+
+ }
[Parameter]
@@ -193,33 +226,53 @@ public partial class VariableRow : IDisposable
public List Columns => ColumnsFunc();
private ConcurrentDictionary LastFixedColumnCache { get; } = new(ReferenceEqualityComparer.Instance);
- private bool IsLastColumn(ITableColumn col) => LastFixedColumnCache.GetOrAdd(col, col =>
+ private bool IsLastColumn(ITableColumn col)
{
- var ret = false;
- if (col.Fixed && !IsTail(col))
+ if (LastFixedColumnCache.TryGetValue(col, out var cached))
{
- var index = Columns.IndexOf(col) + 1;
- ret = index < Columns.Count && Columns[index].Fixed == false;
+ return cached;
}
- return ret;
- });
- private ConcurrentDictionary FirstFixedColumnCache { get; } = new(ReferenceEqualityComparer.Instance);
- private bool IsFirstColumn(ITableColumn col) => FirstFixedColumnCache.GetOrAdd(col, col =>
- {
- var ret = false;
- if (col.Fixed && IsTail(col))
+ else
{
- // 查找前一列是否固定
- var index = Columns.IndexOf(col) - 1;
- if (index > 0)
+ return LastFixedColumnCache.GetOrAdd(col, col =>
{
- ret = !Columns[index].Fixed;
- }
+ var ret = false;
+ if (col.Fixed && !IsTail(col))
+ {
+ var index = Columns.IndexOf(col) + 1;
+ ret = index < Columns.Count && Columns[index].Fixed == false;
+ }
+ return ret;
+ });
+
}
- return ret;
- });
-
+ }
+ private ConcurrentDictionary FirstFixedColumnCache { get; } = new(ReferenceEqualityComparer.Instance);
+ private bool IsFirstColumn(ITableColumn col)
+ {
+ if (FirstFixedColumnCache.TryGetValue(col, out var cached))
+ {
+ return cached;
+ }
+ else
+ {
+ return FirstFixedColumnCache.GetOrAdd(col, col =>
+ {
+ var ret = false;
+ if (col.Fixed && IsTail(col))
+ {
+ // 查找前一列是否固定
+ var index = Columns.IndexOf(col) - 1;
+ if (index > 0)
+ {
+ ret = !Columns[index].Fixed;
+ }
+ }
+ return ret;
+ });
+ }
+ }
diff --git a/src/Gateway/ThingsGateway.Gateway.Razor/Pages/GatewayMonitorPage/Variable/VariableRuntimeInfo.razor b/src/Gateway/ThingsGateway.Gateway.Razor/Pages/GatewayMonitorPage/Variable/VariableRuntimeInfo.razor
index 59778b99e..29e0265fa 100644
--- a/src/Gateway/ThingsGateway.Gateway.Razor/Pages/GatewayMonitorPage/Variable/VariableRuntimeInfo.razor
+++ b/src/Gateway/ThingsGateway.Gateway.Razor/Pages/GatewayMonitorPage/Variable/VariableRuntimeInfo.razor
@@ -15,12 +15,13 @@
AllowResizing="true"
OnAdd="OnAdd"
IsFixedHeader=true
+ ShowCardView=false
IsMultipleSelect=true
SearchMode=SearchMode.Top
ShowExtendButtons=true
ShowToolbar="true"
ShowExportButton
-
+ RenderMode="TableRenderMode.Table"
ShowDefaultButtons=true
ShowSearch=false
ExtendButtonColumnWidth=220
diff --git a/src/ThingsGateway.Server/Index/GatewayIndexComponent.razor.cs b/src/ThingsGateway.Server/Index/GatewayIndexComponent.razor.cs
index 4af48c3f7..0462ffae2 100644
--- a/src/ThingsGateway.Server/Index/GatewayIndexComponent.razor.cs
+++ b/src/ThingsGateway.Server/Index/GatewayIndexComponent.razor.cs
@@ -15,9 +15,6 @@ using BootstrapBlazor.Components;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Localization;
-using System.ComponentModel;
-using System.Diagnostics.CodeAnalysis;
-
using ThingsGateway.Gateway.Application;
namespace ThingsGateway.Server;