mirror of
				https://gitee.com/ThingsGateway/ThingsGateway.git
				synced 2025-10-31 23:53:58 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			614 lines
		
	
	
		
			37 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			614 lines
		
	
	
		
			37 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| @*
 | ||
| //------------------------------------------------------------------------------
 | ||
| //  此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
 | ||
| //  此代码版权(除特别声明外的代码)归作者本人Diego所有
 | ||
| //  源代码使用协议遵循本仓库的开源协议及附加协议
 | ||
| //  Gitee源代码仓库:https://gitee.com/diego2098/ThingsGateway
 | ||
| //  Github源代码仓库:https://github.com/kimdiego2098/ThingsGateway
 | ||
| //  使用文档:https://diego2098.gitee.io/thingsgateway-docs/
 | ||
| //  QQ群:605534569
 | ||
| //------------------------------------------------------------------------------
 | ||
| *@
 | ||
| 
 | ||
| @page "/gatewayruntime/devicestatus"
 | ||
| @namespace ThingsGateway.Blazor
 | ||
| @using System.Linq.Expressions;
 | ||
| @using BlazorComponent;
 | ||
| @using Mapster;
 | ||
| @using Masa.Blazor
 | ||
| @using Masa.Blazor.Presets;
 | ||
| @using System.IO;
 | ||
| @using Microsoft.AspNetCore.Authorization;
 | ||
| @using ThingsGateway.Admin.Blazor.Core;
 | ||
| @using ThingsGateway.Admin.Blazor;
 | ||
| @using ThingsGateway.Admin.Core;
 | ||
| @using ThingsGateway.Application;
 | ||
| @using TouchSocket.Core;
 | ||
| @inject ICollectDeviceService CollectDeviceService
 | ||
| @inject IUploadDeviceService UploadDeviceService
 | ||
| 
 | ||
| @attribute [Authorize]
 | ||
| @inherits BaseComponentBase
 | ||
| @inject UserResoures UserResoures
 | ||
| @inject NavigationManager NavigationManager
 | ||
| @inject IDriverPluginService DriverPluginService
 | ||
| @layout MainLayout
 | ||
| <MSheet Style="overflow:auto">
 | ||
| 
 | ||
| 
 | ||
|     <MTabs @bind-Value="tab">
 | ||
|         <MTab Style="height:50px;" Value="1">
 | ||
|             采集设备状态
 | ||
|         </MTab>
 | ||
|         <MTab Style="height:50px;" Value="2">
 | ||
|             上传设备状态
 | ||
|         </MTab>
 | ||
|         <MTab Style="height:50px;" Value="3">
 | ||
|             其他服务状态
 | ||
|         </MTab>
 | ||
|         <MButton Class="position-button" Disabled=@(!UserResoures.IsHasButtonWithRole("gatewaydevicerestart")) Color="red" Dark Fab Small Loading=isAllRestart OnClick="AllRestartAsync">
 | ||
|             <MIcon>   mdi-restart   </MIcon>
 | ||
|         </MButton>
 | ||
|     </MTabs>
 | ||
|     <MTabsItems Value="tab">
 | ||
|         <MTabItem Value="1">
 | ||
|             @if (tab == 1)
 | ||
|             {
 | ||
|                 <MRow NoGutters>
 | ||
|                 <MCol Md=2 Cols="12">
 | ||
| 
 | ||
|                     <MCard Class="ma-2" Style=@($"height: calc(100vh - {BlazorResourceConst.DefaultHeight + 80}px );")>
 | ||
|                         <MCardTitle>
 | ||
|                             <MTextField Dense Style="max-width:200px;" HideDetails=@("auto") Class="mx-2 my-1" @bind-Value="_collectDeviceGroupSearchName"
 | ||
|                                             Outlined Label=@typeof(CollectDevice).GetDescription(nameof(CollectDevice.DeviceGroup)) />
 | ||
|                             </MCardTitle>
 | ||
| 
 | ||
|                             <MTreeview Style=@($"height: calc(100vh - {BlazorResourceConst.DefaultHeight + 240}px; overflow-y:auto)") Dense TItem="string" TKey="string" ActiveChanged=@(async a=>
 | ||
|                                    {
 | ||
|                                    if(_collectDeviceGroup!=a.FirstOrDefault())
 | ||
|                                    {
 | ||
|                                    _collectDeviceGroup=a.FirstOrDefault(); CollectDeviceQuery();
 | ||
|                                    }
 | ||
|                                    } )
 | ||
|                                        Items="_collectDeviceGroups" ItemText="r=>r" ItemChildren="r=>null"
 | ||
|                                        Search="@_collectDeviceGroupSearchName"
 | ||
|                                       Activatable ItemKey=@(r=>r)>
 | ||
|                                 <LabelContent>
 | ||
|                                     <span title=@context.Item>
 | ||
|                                         @context.Item
 | ||
|                                     </span>
 | ||
|                                 </LabelContent>
 | ||
|                             </MTreeview>
 | ||
|                         </MCard>
 | ||
|                     </MCol>
 | ||
|                     <MCol Md=3 Cols="12">
 | ||
|                         <MCard Height=@($"calc(100vh - {BlazorResourceConst.DefaultHeight + 80}px; )") Style="overflow-y:auto;" Flat Class="ml-2 my-4">
 | ||
| 
 | ||
|                             <MVirtualScroll Context="item" Height=@($"calc(100vh - {BlazorResourceConst.DefaultHeight+100}px)") OverscanCount=2 ItemSize="60" Items="_collectDeviceCores">
 | ||
| 
 | ||
|                                 <ItemContent>
 | ||
|                                     @if (item.Device != null)
 | ||
|                                     {
 | ||
| 
 | ||
|                                         <MListItem OnClick=@(()=>CollectDeviceInfo(item))>
 | ||
|                                             <MListItemContent>
 | ||
|                                                 <MListItemTitle>
 | ||
|                                                     <MLabel Class=@((item.Device?.DeviceStatus==DeviceStatusEnum.OnLine?"green--text":"red--text")+$" text-h6")>
 | ||
|                                                         <div class="mt-1  d-flex align-center justify-space-between" title=@item.Device?.Name>
 | ||
|                                                             <span>@item.Device?.Name</span>
 | ||
|                                                             <span style="white-space: nowrap !important;overflow: hidden !important; text-overflow: ellipsis !important;" class="text-caption">@(item.Device?.ActiveTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + "     " + typeof(DeviceStatusEnum).GetDescription(item.Device?.DeviceStatus.ToString()))</span>
 | ||
|                                                         </div>
 | ||
|                                                     </MLabel>
 | ||
|                                                 </MListItemTitle>
 | ||
|                                             </MListItemContent>
 | ||
| 
 | ||
|                                         </MListItem>
 | ||
| 
 | ||
|                                         <MDivider></MDivider>
 | ||
| 
 | ||
|                                     }
 | ||
| 
 | ||
|                                 </ItemContent>
 | ||
|                             </MVirtualScroll>
 | ||
| 
 | ||
| 
 | ||
|                         </MCard>
 | ||
| 
 | ||
|                     </MCol>
 | ||
|                     <MCol Md=7 Cols="12">
 | ||
|                         <MCard Style=@($"height: calc(100vh - {BlazorResourceConst.DefaultHeight + 80}px); overflow:auto)") Flat Elevation="0">
 | ||
|                             @if (collectDeviceInfoItem != null && collectDeviceInfoItem?.Device != null)
 | ||
|                             {
 | ||
|                                 var item = collectDeviceInfoItem;
 | ||
|                                 <MCard Style="height:100px;overflow:auto;" Flat Class="ml-4 my-4 ma-2" Elevation="0">
 | ||
| 
 | ||
|                                     <MCardActions>
 | ||
|                                         <div class="mr-12"></div>
 | ||
| 
 | ||
|                                         <MLabel Class=@((item.Device?.DeviceStatus==DeviceStatusEnum.OnLine?"green--text":"red--text")+$" text-h6")>
 | ||
|                                             <div class="mt-1  d-flex align-center justify-space-between">
 | ||
|                                                 <span class="mx-3">@item.Device?.Name</span>
 | ||
|                                                 <span style="white-space: nowrap !important;overflow: hidden !important; text-overflow: ellipsis !important;" class="text-caption mx-3">@(item.Device?.ActiveTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + "     " + typeof(DeviceStatusEnum).GetDescription(item.Device?.DeviceStatus.ToString()))</span>
 | ||
|                                             </div>
 | ||
|                                         </MLabel>
 | ||
| 
 | ||
|                                         <MSpacer></MSpacer>
 | ||
|                                         <MTooltip Bottom Context="tip">
 | ||
|                                             <ActivatorContent>
 | ||
|                                                 <MButton Disabled=@(!UserResoures.IsHasPageWithRole("/gatewayruntime/devicevariable")) Class="mx-2" @attributes="@tip.Attrs" Dark Fab Small Loading=isRestart
 | ||
|                                                          OnClick=@(()=>NavigationManager.NavigateTo("/gatewayruntime/devicevariable?devicename="+item.Device?.Name))>
 | ||
|                                                     <MIcon>mdi-information-outline</MIcon>
 | ||
|                                                 </MButton>
 | ||
|                                             </ActivatorContent>
 | ||
|                                             <ChildContent>
 | ||
|                                                 <span>相关变量</span>
 | ||
|                                             </ChildContent>
 | ||
|                                         </MTooltip>
 | ||
| 
 | ||
| 
 | ||
|                                         <MTooltip Bottom Context="tip">
 | ||
|                                             <ActivatorContent>
 | ||
|                                                 <MButton Disabled=@(!UserResoures.IsHasButtonWithRole("gatewaydevicepause")) Class="mx-2" @attributes="@tip.Attrs" Dark Fab Small OnClick=@(()=>ConfigAsync(item.DeviceId,!item.Device?.KeepRun))>
 | ||
|                                                     <MIcon>@(item.Device?.KeepRun == true ? "mdi-pause" : "mdi-play")</MIcon>
 | ||
|                                                     </MButton>
 | ||
|                                                 </ActivatorContent>
 | ||
|                                                 <ChildContent>
 | ||
|                                                     <span>@(item.Device?.KeepRun == true ? "暂停" : "运行")</span>
 | ||
|                                             </ChildContent>
 | ||
|                                         </MTooltip>
 | ||
| 
 | ||
|                                         @*                                        <MTooltip Bottom Context="tip">
 | ||
|                                 <ActivatorContent>
 | ||
|                                 <MButton Disabled=@(!UserResoures.IsHasButtonWithRole("gatewaydevicerestart")) Class="mx-2" @attributes="@tip.Attrs" Dark Fab Small Loading=isRestart OnClick=@(()=>RestartAsync(item.DeviceId))>
 | ||
|                                 <MIcon>mdi-restart</MIcon>
 | ||
|                                 </MButton>
 | ||
|                                 </ActivatorContent>
 | ||
|                                 <ChildContent>
 | ||
|                                 <span>重启</span>
 | ||
|                                 </ChildContent>
 | ||
|                                 </MTooltip>*@
 | ||
| 
 | ||
|                                     </MCardActions>
 | ||
| 
 | ||
| 
 | ||
|                                 </MCard>
 | ||
| 
 | ||
|                                 <MCard Style="height:200px;overflow:auto;" Flat Class="ml-4 my-4 ma-2" Elevation="0">
 | ||
| 
 | ||
|                                     <MSubheader>
 | ||
|                                         运行状态
 | ||
|                                     </MSubheader>
 | ||
|                                     <MRow Class="ml-2 mr-2 d-flex" NoGutters>
 | ||
|                                     <MCol Md=6 Cols="12" Class="px-4 mt-1  d-flex align-center justify-space-between">
 | ||
|                                         <span class="text-subtitle-2 grey--text">@item.Device?.Description(a=>a.ActiveTime)</span>
 | ||
|                                         <span class="text-caption">@item.Device?.ActiveTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset)</span>
 | ||
|                                     </MCol>
 | ||
|                                     <MCol Md=6 Cols="12" Class="px-4 mt-1  d-flex align-center justify-space-between">
 | ||
|                                         <span class="text-subtitle-2 grey--text">@item.Device?.Description(a=>a.SourceVariableCount)</span>
 | ||
|                                         <span class="text-caption">@item.Device?.SourceVariableCount</span>
 | ||
|                                     </MCol>
 | ||
|                                     <MCol Md=6 Cols="12" Class="px-4 mt-1  d-flex align-center justify-space-between">
 | ||
|                                         <span class="text-subtitle-2 grey--text">@item.Device?.Description(a=>a.DeviceVariableCount)</span>
 | ||
|                                         <span class="text-caption">@item.Device?.DeviceVariableCount</span>
 | ||
|                                     </MCol>
 | ||
|                                     <MCol Md=6 Cols="12" Class="px-4 mt-1  d-flex align-center justify-space-between">
 | ||
|                                         <span class="text-subtitle-2 grey--text">@item.Device?.Description(a=>a.MethodVariableCount)</span>
 | ||
|                                         <span class="text-caption">@item.Device?.MethodVariableCount</span>
 | ||
|                                     </MCol>
 | ||
|                                     <MCol Md=12 Cols="12" Class="px-4 mt-1  d-flex align-center justify-space-between">
 | ||
|                                         <span class="text-subtitle-2 grey--text">@item.Device?.Description(a=>a.LastErrorMessage)</span>
 | ||
|                                         <span class="text-caption red--text">@item.Device?.LastErrorMessage</span>
 | ||
|                                     </MCol>
 | ||
|                                 </MRow>
 | ||
| 
 | ||
|                                 <MSubheader>
 | ||
|                                     配置信息
 | ||
|                                 </MSubheader>
 | ||
|                                 <MRow Class="ml-2 mr-2 d-flex" NoGutters>
 | ||
|                                     <MCol Md=6 Cols="12" Class="px-4 mt-1  d-flex align-center justify-space-between">
 | ||
|                                         <span class="text-subtitle-2 grey--text">@item.Device?.Description(a=>a.PluginName)</span>
 | ||
|                                         <span class="text-caption">@item.Device?.PluginName</span>
 | ||
|                                     </MCol>
 | ||
|                                     <MCol Md=6 Cols="12" Class="px-4 mt-1  d-flex align-center justify-space-between">
 | ||
|                                         <span class="text-subtitle-2 grey--text">@item.Device?.Description(a=>a.IsLogOut)</span>
 | ||
|                                         <span class="text-caption">@item.Device?.IsLogOut</span>
 | ||
|                                     </MCol>
 | ||
|                                     @foreach (var property in item.Device?.DevicePropertys ?? new())
 | ||
|                                         {
 | ||
|                                             <MCol Md=6 Cols="12" Class="px-4 mt-1  d-flex align-center justify-space-between">
 | ||
|                                                 <span class="text-subtitle-2 grey--text">@property.Description</span>
 | ||
|                                                 <span class="text-caption ">@(property.PropertyName.Contains("Password") ? "******" : @property.Value)</span>
 | ||
|                                             </MCol>
 | ||
|                                         }
 | ||
| 
 | ||
|                                     </MRow>
 | ||
| 
 | ||
| 
 | ||
|                                 </MCard>
 | ||
| 
 | ||
|                             }
 | ||
| 
 | ||
|                             <MCard Flat Class="ml-4">
 | ||
|                                 @if (collectDeviceInfoItem != null && collectDeviceInfoItem?.Device != null)
 | ||
|                                 {
 | ||
|                                     <MCardActions>
 | ||
|                                         报文日志(共享链路的日志也会相同)
 | ||
|                                         <MSpacer></MSpacer>
 | ||
| 
 | ||
|                                         <MTooltip Bottom Context="tip">
 | ||
|                                             <ActivatorContent>
 | ||
|                                                 <MButton Disabled=@(!UserResoures.IsHasButtonWithRole("gatewaydevicepause")) Class="mx-2" @attributes="@tip.Attrs" Dark Fab Small
 | ||
|                                                          OnClick=@(()=>
 | ||
|                                                  {
 | ||
|                                                  pauseMessage=!pauseMessage;
 | ||
|                                                  if(pauseMessage)
 | ||
|                                                  CurMessages= collectDeviceInfoItem.Driver?.Messages.ToList();
 | ||
|                                                  }
 | ||
|                                                  )>
 | ||
|                                                     <MIcon>@((!pauseMessage) ? "mdi-pause" : "mdi-play")</MIcon>
 | ||
|                                                     </MButton>
 | ||
|                                                 </ActivatorContent>
 | ||
|                                                 <ChildContent>
 | ||
|                                                     <span>@((!pauseMessage) ? "暂停日志" : "运行日志")</span>
 | ||
|                                             </ChildContent>
 | ||
|                                         </MTooltip>
 | ||
| 
 | ||
|                                         <MTooltip Bottom Context="tip">
 | ||
|                                             <ActivatorContent>
 | ||
|                                                 <MButton Loading=isDownExport Disabled=@(!UserResoures.IsHasButtonWithRole("gatewaydevicepause")) Class="mx-2" @attributes="@tip.Attrs" Dark Fab Small
 | ||
|                                                          OnClick=@(async()=>
 | ||
|                                                  {
 | ||
|                                                  var curMessages= collectDeviceInfoItem.Driver?.Messages.ToList();
 | ||
|                                                  await DownDeviceMessageExportAsync(curMessages);
 | ||
|                                                  }
 | ||
|                                                  )>
 | ||
|                                                     <MIcon>mdi-export</MIcon>
 | ||
|                                                 </MButton>
 | ||
|                                             </ActivatorContent>
 | ||
|                                             <ChildContent>
 | ||
|                                                 <span>导出</span>
 | ||
|                                             </ChildContent>
 | ||
|                                         </MTooltip>
 | ||
| 
 | ||
|                                     </MCardActions>
 | ||
|                                     {
 | ||
|                                         ICollection<string> item = null;
 | ||
|                                         if (pauseMessage)
 | ||
|                                         {
 | ||
|                                             item = CurMessages;
 | ||
|                                         }
 | ||
|                                         else if (collectDeviceInfoItem.Driver != null)
 | ||
|                                         {
 | ||
|                                             item = collectDeviceInfoItem.Driver?.Messages;
 | ||
|                                         }
 | ||
|                                         if (item == null)
 | ||
|                                         {
 | ||
|                                             item = new List<string>();
 | ||
|                                         }
 | ||
|                                         <MRow Class="ml-2 mr-2 d-flex" NoGutters>
 | ||
|                                         <MVirtualScroll Context="itemMessage" TItem="string" Height=@($"calc(100vh - {BlazorResourceConst.DefaultHeight+480}px)") OverscanCount=2 ItemSize="100" Items="item">
 | ||
|                                             <ItemContent>
 | ||
|                                                 <div title=@itemMessage style="white-space: nowrap !important;overflow: hidden !important; text-overflow: ellipsis !important;">
 | ||
|                                                     @itemMessage
 | ||
|                                                 </div>
 | ||
|                                             </ItemContent>
 | ||
|                                         </MVirtualScroll>
 | ||
|                                     </MRow>
 | ||
|                                     }
 | ||
| 
 | ||
|                                 }
 | ||
|                             </MCard>
 | ||
| 
 | ||
|                         </MCard>
 | ||
|                     </MCol>
 | ||
|                 </MRow>
 | ||
|             }
 | ||
|         </MTabItem>
 | ||
|         <MTabItem Value="2">
 | ||
|             @if (tab == 2)
 | ||
|             {
 | ||
|                 <MRow>
 | ||
|                     <MCol Md=2 Cols="12">
 | ||
|                         <MCard Class="ma-2" Style=@($"height: calc(100vh - {BlazorResourceConst.DefaultHeight + 80}px); )")>
 | ||
|                             <MCardTitle>
 | ||
|                                 <MTextField Dense Style="max-width:200px;" HideDetails=@("auto") Class="mx-2 my-1" @bind-Value="_uploadDeviceGroupSearchName"
 | ||
|                                             Outlined Label=@typeof(UploadDevice).GetDescription(nameof(UploadDevice.DeviceGroup)) />
 | ||
|                             </MCardTitle>
 | ||
|                             <MTreeview Style=@($"height: calc(100vh - {BlazorResourceConst.DefaultHeight+240}px);overflow-y:auto") Dense TItem="string" TKey="string" ActiveChanged=@(async a=>
 | ||
|                                    {
 | ||
|                                    if(_uploadDeviceGroup!=a.FirstOrDefault())
 | ||
|                                    {
 | ||
|                                    _uploadDeviceGroup=a.FirstOrDefault(); UploadDeviceQuery();
 | ||
|                                    }
 | ||
|                                    } )
 | ||
|                                        Items="_uploadDeviceGroups" ItemText="r=>r" ItemChildren="r=>null"
 | ||
|                                        Search="@_uploadDeviceGroupSearchName"
 | ||
|                                       Activatable ItemKey=@(r=>r)>
 | ||
|                                 <LabelContent>
 | ||
|                                     <span title=@context.Item>
 | ||
|                                         @context.Item
 | ||
|                                     </span>
 | ||
|                                 </LabelContent>
 | ||
|                             </MTreeview>
 | ||
|                         </MCard>
 | ||
|                     </MCol>
 | ||
|                     <MCol Md=3 Cols="12">
 | ||
|                         <MCard Height=@($"calc(100vh - {BlazorResourceConst.DefaultHeight+80}px)") Style="overflow-y:auto;" Flat Class="ml-2 my-4">
 | ||
| 
 | ||
|                             <MVirtualScroll Context="item" Height=@($"calc(100vh - {BlazorResourceConst.DefaultHeight+100}px)") OverscanCount=2 ItemSize="60" Items="_uploadDeviceCores">
 | ||
| 
 | ||
|                                 <ItemContent>
 | ||
|                                     @if (item.Device != null)
 | ||
|                                     {
 | ||
| 
 | ||
|                                         <MListItem OnClick=@(()=>UploadDeviceInfo(item))>
 | ||
|                                             <MListItemContent>
 | ||
|                                                 <MListItemTitle>
 | ||
|                                                     <MLabel Class=@((item.Device?.DeviceStatus==DeviceStatusEnum.OnLine?"green--text":"red--text")+$" text-h6")>
 | ||
|                                                         <div class="mt-1  d-flex align-center justify-space-between" title=@item.Device?.Name>
 | ||
|                                                             <span>@item.Device?.Name</span>
 | ||
|                                                             <span style="white-space: nowrap !important;overflow: hidden !important; text-overflow: ellipsis !important;" class="text-caption">@(item.Device?.ActiveTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + "     " + typeof(DeviceStatusEnum).GetDescription(item.Device?.DeviceStatus.ToString()))</span>
 | ||
|                                                         </div>
 | ||
|                                                     </MLabel>
 | ||
|                                                 </MListItemTitle>
 | ||
|                                             </MListItemContent>
 | ||
| 
 | ||
|                                         </MListItem>
 | ||
| 
 | ||
|                                         <MDivider></MDivider>
 | ||
| 
 | ||
|                                     }
 | ||
| 
 | ||
|                                 </ItemContent>
 | ||
|                             </MVirtualScroll>
 | ||
| 
 | ||
| 
 | ||
|                         </MCard>
 | ||
| 
 | ||
|                     </MCol>
 | ||
|                     <MCol Md=7 Cols="12">
 | ||
|                         <MCard Style=@($"height: calc(100vh - {BlazorResourceConst.DefaultHeight + 80}px); overflow:auto)") Flat Elevation="0">
 | ||
|                             @if (uploadDeviceInfoItem != null && uploadDeviceInfoItem?.Device != null)
 | ||
|                             {
 | ||
|                                 var item = uploadDeviceInfoItem;
 | ||
|                                 <MCard Style="height:100px;overflow:auto;" Flat Class="ml-4 my-4 ma-2" Elevation="0">
 | ||
| 
 | ||
|                                     <MCardActions>
 | ||
|                                         <div class="mr-12"></div>
 | ||
| 
 | ||
|                                         <MLabel Class=@((item.Device?.DeviceStatus==DeviceStatusEnum.OnLine?"green--text":"red--text")+$" text-h6")>
 | ||
|                                             <div class="mt-1  d-flex align-center justify-space-between">
 | ||
|                                                 <span class="mx-3">@item.Device?.Name</span>
 | ||
|                                                 <span style="white-space: nowrap !important;overflow: hidden !important; text-overflow: ellipsis !important;" class="text-caption mx-3">@(item.Device?.ActiveTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + "     " + typeof(DeviceStatusEnum).GetDescription(item.Device?.DeviceStatus.ToString()))</span>
 | ||
|                                             </div>
 | ||
|                                         </MLabel>
 | ||
| 
 | ||
|                                         <MSpacer></MSpacer>
 | ||
|                                         <MTooltip Bottom Context="tip">
 | ||
|                                             <ActivatorContent>
 | ||
|                                                 <MButton Disabled=@(!UserResoures.IsHasPageWithRole("/gatewayruntime/devicevariable")) Class="mx-2" @attributes="@tip.Attrs" Dark Fab Small Loading=isRestart
 | ||
|                                                          OnClick=@(()=>NavigationManager.NavigateTo("/gatewayruntime/devicevariable?uploaddevicename="+item.Device?.Name))>
 | ||
|                                                     <MIcon>mdi-information-outline</MIcon>
 | ||
|                                                 </MButton>
 | ||
|                                             </ActivatorContent>
 | ||
|                                             <ChildContent>
 | ||
|                                                 <span>相关变量</span>
 | ||
|                                             </ChildContent>
 | ||
|                                         </MTooltip>
 | ||
| 
 | ||
| 
 | ||
|                                         <MTooltip Bottom Context="tip">
 | ||
|                                             <ActivatorContent>
 | ||
|                                                 <MButton Disabled=@(!UserResoures.IsHasButtonWithRole("gatewaydevicepause")) Class="mx-2" @attributes="@tip.Attrs" Dark Fab Small OnClick=@(()=>UpConfigAsync(item.DeviceId,!item.Device?.KeepRun))>
 | ||
|                                                     <MIcon>@(item.Device?.KeepRun == true ? "mdi-pause" : "mdi-play")</MIcon>
 | ||
|                                                     </MButton>
 | ||
|                                                 </ActivatorContent>
 | ||
|                                                 <ChildContent>
 | ||
|                                                     <span>@(item.Device?.KeepRun == true ? "暂停" : "运行")</span>
 | ||
|                                             </ChildContent>
 | ||
|                                         </MTooltip>
 | ||
|                                         <MTooltip Bottom Context="tip">
 | ||
|                                             <ActivatorContent>
 | ||
|                                                 <MButton Disabled=@(!UserResoures.IsHasButtonWithRole("gatewaydevicerestart")) Class="mx-2" @attributes="@tip.Attrs" Dark Fab Small Loading=isRestart OnClick=@(()=> UpRestartAsync(item.DeviceId))>
 | ||
|                                                     <MIcon>mdi-restart</MIcon>
 | ||
|                                                 </MButton>
 | ||
|                                             </ActivatorContent>
 | ||
|                                             <ChildContent>
 | ||
|                                                 <span>重启</span>
 | ||
|                                             </ChildContent>
 | ||
|                                         </MTooltip>
 | ||
| 
 | ||
|                                     </MCardActions>
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
|                                 </MCard>
 | ||
|                                 <MCard Style="height:200px;overflow:auto;" Flat Class="ml-4 my-4 ma-2" Elevation="0">
 | ||
| 
 | ||
| 
 | ||
|                                     <MSubheader>
 | ||
|                                         运行状态
 | ||
|                                     </MSubheader>
 | ||
|                                     <MRow Class="ml-2 mr-2 d-flex" NoGutters>
 | ||
|                                     <MCol Md=6 Cols="12" Class="px-4 mt-1  d-flex align-center justify-space-between">
 | ||
|                                         <span class="text-subtitle-2 grey--text">@item.Device?.Description(a=>a.ActiveTime)</span>
 | ||
|                                         <span class="text-caption">@item.Device?.ActiveTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset)</span>
 | ||
|                                     </MCol>
 | ||
|                                     <MCol Md=6 Cols="12" Class="px-4 mt-1  d-flex align-center justify-space-between">
 | ||
|                                         <span class="text-subtitle-2 grey--text">@item.Device?.Description(a=>a.UploadVariableCount)</span>
 | ||
|                                         <span class="text-caption">@item.Device?.UploadVariableCount</span>
 | ||
|                                     </MCol>
 | ||
|                                     <MCol Md=12 Cols="12" Class="px-4 mt-1  d-flex align-center justify-space-between">
 | ||
|                                         <span class="text-subtitle-2 grey--text">@item.Device?.Description(a=>a.LastErrorMessage)</span>
 | ||
|                                         <span class="text-caption red--text">@item.Device?.LastErrorMessage</span>
 | ||
|                                     </MCol>
 | ||
|                                 </MRow>
 | ||
| 
 | ||
|                                 <MSubheader>
 | ||
|                                     配置信息
 | ||
|                                 </MSubheader>
 | ||
|                                 <MRow Class="ml-2 mr-2 d-flex" NoGutters>
 | ||
|                                     <MCol Md=6 Cols="12" Class="px-4 mt-1  d-flex align-center justify-space-between">
 | ||
|                                         <span class="text-subtitle-2 grey--text">@item.Device?.Description(a=>a.PluginName)</span>
 | ||
|                                         <span class="text-caption">@item.Device?.PluginName</span>
 | ||
|                                     </MCol>
 | ||
|                                     <MCol Md=6 Cols="12" Class="px-4 mt-1  d-flex align-center justify-space-between">
 | ||
|                                         <span class="text-subtitle-2 grey--text">@item.Device?.Description(a=>a.IsLogOut)</span>
 | ||
|                                         <span class="text-caption">@item.Device?.IsLogOut</span>
 | ||
|                                     </MCol>
 | ||
|                                     @foreach (var property in item.Device?.DevicePropertys ?? new())
 | ||
|                                         {
 | ||
|                                             <MCol Md=6 Cols="12" Class="px-4 mt-1  d-flex align-center justify-space-between">
 | ||
|                                                 <span class="text-subtitle-2 grey--text">@property.Description</span>
 | ||
|                                                 <span class="text-caption ">@(property.PropertyName.Contains("Password") ? "******" : @property.Value)</span>
 | ||
|                                             </MCol>
 | ||
|                                         }
 | ||
| 
 | ||
|                                     </MRow>
 | ||
| 
 | ||
| 
 | ||
|                                 </MCard>
 | ||
|                             }
 | ||
| 
 | ||
|                             <MCard Flat Class="ml-4">
 | ||
|                                 @if (uploadDeviceInfoItem != null && uploadDeviceInfoItem?.Device != null)
 | ||
|                                 {
 | ||
|                                     <MCardActions>
 | ||
|                                         报文日志(共享链路的日志也会相同)
 | ||
|                                         <MSpacer></MSpacer>
 | ||
| 
 | ||
|                                         <MTooltip Bottom Context="tip">
 | ||
|                                             <ActivatorContent>
 | ||
|                                                 <MButton Disabled=@(!UserResoures.IsHasButtonWithRole("gatewaydevicepause")) Class="mx-2" @attributes="@tip.Attrs" Dark Fab Small
 | ||
|                                                          OnClick=@(()=>
 | ||
|                                                  {
 | ||
|                                                  pauseMessage=!pauseMessage;
 | ||
|                                                  if(pauseMessage)
 | ||
|                                                  CurMessages= uploadDeviceInfoItem.Driver?.Messages.ToList();
 | ||
|                                                  }
 | ||
|                                                  )>
 | ||
|                                                     <MIcon>@((!pauseMessage) ? "mdi-pause" : "mdi-play")</MIcon>
 | ||
|                                                     </MButton>
 | ||
|                                                 </ActivatorContent>
 | ||
|                                                 <ChildContent>
 | ||
|                                                     <span>@((!pauseMessage) ? "暂停日志" : "运行日志")</span>
 | ||
|                                             </ChildContent>
 | ||
|                                         </MTooltip>
 | ||
| 
 | ||
|                                         <MTooltip Bottom Context="tip">
 | ||
|                                             <ActivatorContent>
 | ||
|                                                 <MButton Loading=isDownExport Disabled=@(!UserResoures.IsHasButtonWithRole("gatewaydevicepause")) Class="mx-2" @attributes="@tip.Attrs" Dark Fab Small
 | ||
|                                                          OnClick=@(async()=>
 | ||
|                                                  {
 | ||
|                                                  var curMessages= uploadDeviceInfoItem.Driver?.Messages.ToList();
 | ||
|                                                  await DownDeviceMessageExportAsync(curMessages);
 | ||
|                                                  }
 | ||
|                                                  )>
 | ||
|                                                     <MIcon>mdi-export</MIcon>
 | ||
|                                                 </MButton>
 | ||
|                                             </ActivatorContent>
 | ||
|                                             <ChildContent>
 | ||
|                                                 <span>导出</span>
 | ||
|                                             </ChildContent>
 | ||
|                                         </MTooltip>
 | ||
| 
 | ||
|                                     </MCardActions>
 | ||
|                                     {
 | ||
|                                         ICollection<string> item = null;
 | ||
|                                         if (pauseMessage)
 | ||
|                                         {
 | ||
|                                             item = CurMessages;
 | ||
|                                         }
 | ||
|                                         else if (uploadDeviceInfoItem.Driver != null)
 | ||
|                                         {
 | ||
|                                             item = uploadDeviceInfoItem.Driver?.Messages ?? new();
 | ||
|                                         }
 | ||
|                                         if (item == null)
 | ||
|                                         {
 | ||
|                                             item = new List<string>();
 | ||
|                                         }
 | ||
|                                         <MRow Class="ml-2 mr-2 d-flex" NoGutters>
 | ||
|                                         <MVirtualScroll Context="itemMessage" TItem="string" Height=@($"calc(100vh - {BlazorResourceConst.DefaultHeight+480}px)") OverscanCount=2 ItemSize="100" Items="item">
 | ||
|                                             <ItemContent>
 | ||
|                                                 <div title=@itemMessage style="white-space: nowrap !important;overflow: hidden !important; text-overflow: ellipsis !important;">
 | ||
|                                                     @itemMessage
 | ||
|                                                 </div>
 | ||
|                                             </ItemContent>
 | ||
|                                         </MVirtualScroll>
 | ||
|                                     </MRow>
 | ||
|                                     }
 | ||
| 
 | ||
|                                 }
 | ||
|                             </MCard>
 | ||
| 
 | ||
|                         </MCard>
 | ||
|                     </MCol>
 | ||
|                 </MRow>
 | ||
|             }
 | ||
|         </MTabItem>
 | ||
| 
 | ||
|         <MTabItem Value="3">
 | ||
|             @if (tab == 3)
 | ||
|             {
 | ||
|                 <MRow NoGutters>
 | ||
|                 <MCard Class="ml-2 my-3" Style="width:100%" Elevation="1">
 | ||
|                     <MCardSubtitle Class=@((AlarmHostService.StatuString.IsSuccess?"green--text":"red--text")+$" text-subtitle-2")>
 | ||
|                         <div class="mt-1  d-flex align-center justify-space-between">
 | ||
|                             <span>历史报警服务状态</span>
 | ||
|                             <span class="text-caption">@AlarmHostService.StatuString.Message</span>
 | ||
|                         </div>
 | ||
|                     </MCardSubtitle>
 | ||
|                 </MCard>
 | ||
|             </MRow>
 | ||
|                 <MRow NoGutters>
 | ||
|                 <MCard Class="ml-2 my-3" Style="width:100%" Elevation="1">
 | ||
|                     <MCardSubtitle Class=@((HistoryValueHostService.StatuString.IsSuccess?"green--text":"red--text")+$" text-subtitle-2")>
 | ||
|                         <div class="mt-1  d-flex align-center justify-space-between">
 | ||
|                             <span>历史数据服务状态</span>
 | ||
|                             <span class="text-caption">@HistoryValueHostService.StatuString.Message</span>
 | ||
|                         </div>
 | ||
|                     </MCardSubtitle>
 | ||
|                 </MCard>
 | ||
|             </MRow>
 | ||
|                 <MRow NoGutters>
 | ||
|                 <MCard Class="ml-2 my-3" Style="width:100%" Elevation="1">
 | ||
|                     <MCardSubtitle Class=@((MemoryVariableWorker.StatuString.IsSuccess?"green--text":"red--text")+$" text-subtitle-2")>
 | ||
|                         <div class="mt-1  d-flex align-center justify-space-between">
 | ||
|                             <span>中间变量计算服务状态</span>
 | ||
|                             <span class="text-caption">@MemoryVariableWorker.StatuString.Message</span>
 | ||
|                         </div>
 | ||
|                     </MCardSubtitle>
 | ||
|                 </MCard>
 | ||
|             </MRow>
 | ||
| 
 | ||
|             }
 | ||
| 
 | ||
|         </MTabItem>
 | ||
|     </MTabsItems>
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
| </MSheet>
 | ||
| <style>
 | ||
|     .position-button {
 | ||
|         position: fixed !important;
 | ||
|         top: 10%;
 | ||
|         right: 0;
 | ||
|         box-shadow: 1px 1px 8px var(--mud-palette-primary);
 | ||
|         background-color: var(--mud-palette-primary);
 | ||
|         cursor: pointer
 | ||
|     }
 | ||
| 
 | ||
| </style>
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
| 
 | 
