Files
ThingsGateway/framework/demo/ThingsGateway.Foundation.Demo.Rcl/Pages/OPCDA/OPCDAClientDebugPage.razor
Kimdiego2098 e1c492f238 整理文件
2023-11-18 23:02:28 +08:00

135 lines
4.2 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@*
//------------------------------------------------------------------------------
// 此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
// 此代码版权除特别声明外的代码归作者本人Diego所有
// 源代码使用协议遵循本仓库的开源协议及附加协议
// Gitee源代码仓库https://gitee.com/diego2098/ThingsGateway
// Github源代码仓库https://github.com/kimdiego2098/ThingsGateway
// 使用文档https://diego2098.gitee.io/thingsgateway-docs/
// QQ群605534569
//------------------------------------------------------------------------------
*@
@page "/OPCDAClient"
@namespace ThingsGateway.Foundation.Demo
@using BlazorComponent;
@using Microsoft.AspNetCore.Components.Web;
@using Masa.Blazor.Presets;
@using Microsoft.JSInterop;
@inherits BaseComponentBase
@using ThingsGateway.Foundation.Core;
@using ThingsGateway.Foundation.Adapter.OPCDA.Da;
@using ThingsGateway.Foundation.Extension;
@using ThingsGateway.Foundation.Serial;
@using Masa.Blazor
<OPCDAClientPage @ref=opcDAClientPage></OPCDAClientPage>
<DriverDebugUIPage @ref=_driverDebugUIPage Sections="_sections" ShowDefaultOtherContent=false>
<ReadWriteContent>
<div class="my-1 py-1">
<MTextarea Class="mx-1 my-1" Label="变量地址" Dense Outlined HideDetails="@("auto")" @bind-Value=@_driverDebugUIPage.Address />
<MButton Class="mx-1 my-1" Color="primary" OnClick="Add">
添加
</MButton>
<MButton Class="mx-1 my-1" Color="primary" OnClick="Remove">
移除
</MButton>
<MButton Class="mx-1 my-1" Color="primary" OnClick="ReadAsync">
组读取
</MButton>
<MTextarea Class="mx-1 mt-3 my-1" Label="值" Dense Outlined HideDetails="@("auto")" @bind-Value=@_driverDebugUIPage.WriteValue />
<MButton Class="mx-1 my-1" Color="primary" OnClick="WriteAsync">
写入
</MButton>
<MButton Class="mx-1 my-3" Color="accent" OnClick="()=>IsShowImportVariableList=!IsShowImportVariableList">
<span>查看OPC节点空间</span>
</MButton>
</div>
<MCol Class="my-1 py-1">
<MRow NoGutters>
</MRow>
</MCol>
</ReadWriteContent>
</DriverDebugUIPage>
@{
#if Plugin
<PModal @bind-Value="IsShowImportVariableList" OnCancel="() => IsShowImportVariableList = false"
Title=导入OPC变量 Height=@("700") Persistent
MaxWidth="1500"
OnSave="DownDeviceExport">
<SaveContent Context="save">
<MMenu OffsetY Context="menu">
<ActivatorContent>
<MButton @attributes="@menu.Attrs" Color="primary" Class="my-1 mx-2 " Disabled="isDownLoading" Loading="isDownLoading">
导出
<AppChevronDown></AppChevronDown>
</MButton>
</ActivatorContent>
<ChildContent>
<MList>
<MListItem Color="primary" OnClick="DownDeviceExport" Disabled="isDownLoading" Loading="isDownLoading"> 导出到excel </MListItem>
<MListItem Color="primary" OnClick="DeviceImport" Disabled="isDownLoading" Loading="isDownLoading">导入到系统</MListItem>
</MList>
</ChildContent>
</MMenu>
</SaveContent>
<ChildContent>
@if (IsShowImportVariableList)
{
<OPCDAImportVariable @ref=ImportVariable PLC="_plc"></OPCDAImportVariable>
}
</ChildContent>
</PModal>
#else
<PModal @bind-Value="IsShowImportVariableList" OnCancel="() => IsShowImportVariableList = false"
Title=浏览OPC变量 Height=@("700") Persistent
MaxWidth="1500">
<ChildContent>
@if (IsShowImportVariableList)
{
<OPCDAImportVariable @ref=ImportVariable PLC="_plc"></OPCDAImportVariable>
}
</ChildContent>
</PModal>
#endif
}
@code {
private readonly List<(string Code, string Language)> _sections = new();
}