using System.Text; using CncSimulator.Core; namespace CncSimulator.Admin { /// /// 管理页面HTML生成器。 /// 生成总管理页面和单地址管理页面的完整HTML+CSS+JS。 /// public class AdminHandler { /// 生成总管理页面(网关页面) public string BuildGatewayPage(SimulatorEngine engine) { var sb = new StringBuilder(); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine("CNC 模拟采集服务 - 总管理"); sb.AppendLine(""); sb.AppendLine("
"); sb.AppendLine("

CNC 模拟采集服务

"); sb.AppendLine("
"); sb.AppendLine(" "); sb.AppendLine(" "); sb.AppendLine("
"); sb.AppendLine("
"); sb.AppendLine("
"); sb.AppendLine("

地址列表

"); sb.AppendLine(" "); sb.AppendLine("
名称端口状态设备数数据频率请求次数操作
"); sb.AppendLine("
"); sb.AppendLine("

控制台日志

"); sb.AppendLine("
加载中...
"); sb.AppendLine("
"); sb.AppendLine("
"); sb.AppendLine(""); return sb.ToString(); } /// 生成单地址管理页面 public string BuildSingleAddressPage(SimulatorServer server) { var sb = new StringBuilder(); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine("" + server.Name + " - 模拟管理"); sb.AppendLine(""); sb.AppendLine("
"); sb.AppendLine("

" + server.Name + " (端口 " + server.Port + ")

"); sb.AppendLine("
"); sb.AppendLine(" 数据接口"); sb.AppendLine(" "); sb.AppendLine(" "); sb.AppendLine("
"); sb.AppendLine("
"); sb.AppendLine("
"); // 全局设置 sb.AppendLine("

全局设置

"); sb.AppendLine("
"); sb.AppendLine(" "); sb.AppendLine(" 秒"); sb.AppendLine(" "); sb.AppendLine("
"); sb.AppendLine("
"); sb.AppendLine(" "); sb.AppendLine(" "); sb.AppendLine(" "); sb.AppendLine("
"); sb.AppendLine("
"); sb.AppendLine(" "); sb.AppendLine(" "); sb.AppendLine("
"); sb.AppendLine("
"); // 设备状态卡片 sb.AppendLine("

设备状态卡片

"); sb.AppendLine("
加载中...
"); sb.AppendLine("
"); // JSON预览 sb.AppendLine("

当前返回JSON预览

"); sb.AppendLine(" "); sb.AppendLine("
加载中...
"); sb.AppendLine("
"); // 日志 sb.AppendLine("

返回数据日志(最近100条)

"); sb.AppendLine(" "); sb.AppendLine(" "); sb.AppendLine(" "); sb.AppendLine("
#时间设备数关键数据耗时操作
"); sb.AppendLine("
"); // 统计 sb.AppendLine("

统计

"); sb.AppendLine("
加载中...
"); sb.AppendLine("
"); sb.AppendLine("
"); // JavaScript sb.AppendLine(""); return sb.ToString(); } } }