增加2d组态

This commit is contained in:
dell
2023-04-25 10:27:55 +08:00
parent a66412700b
commit 13b0556370
8 changed files with 662 additions and 6 deletions

View File

@ -84,10 +84,14 @@ namespace HT.Cloud.Service.ReportManage
srcTagRtValues.Add(new SrcTagRtValue() {TagName = TagName, Description = Description, Value = Value });
}
var dt = new Dictionary<string, string>();
foreach (var src in srcTagRtValues)
try
{
dt.Add(src.TagName, src.Value);
foreach (var src in srcTagRtValues)
{
dt.Add(src.TagName, src.Value);
}
}
catch(Exception ex) { Console.Write(ex.ToString()); }
dt.Add("RtTime",DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
return dt.ToJson();

View File

@ -0,0 +1,46 @@
/*******************************************************************************
* Copyright © 2020 HT.Cloud.Framework 版权所有
* Author: HT.Cloud
* Description: WaterCloud快速开发平台
* Website
*********************************************************************************/
using Microsoft.AspNetCore.Mvc;
using System.Linq;
using System.Threading.Tasks;
using HT.Cloud.Code;
using HT.Cloud.Service.SystemSecurity;
namespace HT.Cloud.Web.Areas.SystemSecurity.Controllers
{
[Area("SystemSecurity")]
public class DeviceIOEditorController : BaseController
{
public ServerStateService _serverStateService { get; set; }
[HttpGet]
public async Task<ActionResult> GetServerDataJson()
{
return await Task.Run(() =>
{
//windows环境
var computer = ComputerHelper.GetComputerInfo();
var arm = computer.RAMRate;
var cpu = computer.CPURate;
var iis = computer.RunTime;
var TotalRAM = computer.TotalRAM;
string ip = WebHelper.GetWanIp();
string ipLocation = WebHelper.GetIpLocation(ip);
var IP = string.Format("{0} ({1})", ip, ipLocation);
return Content(new { ARM = arm, CPU = cpu, IIS = iis, TotalRAM = TotalRAM, IP = IP }.ToJson());
});
}
[HttpGet]
public async Task<ActionResult> GetServerData()
{
var data = (await _serverStateService.GetList(2)).OrderBy(a => a.F_Date).ToList();
return Content(data.ToJson());
}
}
}

View File

@ -0,0 +1,46 @@
/*******************************************************************************
* Copyright © 2020 HT.Cloud.Framework 版权所有
* Author: HT.Cloud
* Description: WaterCloud快速开发平台
* Website
*********************************************************************************/
using Microsoft.AspNetCore.Mvc;
using System.Linq;
using System.Threading.Tasks;
using HT.Cloud.Code;
using HT.Cloud.Service.SystemSecurity;
namespace HT.Cloud.Web.Areas.SystemSecurity.Controllers
{
[Area("SystemSecurity")]
public class DeviceIOStatusController : BaseController
{
public ServerStateService _serverStateService { get; set; }
[HttpGet]
public async Task<ActionResult> GetServerDataJson()
{
return await Task.Run(() =>
{
//windows环境
var computer = ComputerHelper.GetComputerInfo();
var arm = computer.RAMRate;
var cpu = computer.CPURate;
var iis = computer.RunTime;
var TotalRAM = computer.TotalRAM;
string ip = WebHelper.GetWanIp();
string ipLocation = WebHelper.GetIpLocation(ip);
var IP = string.Format("{0} ({1})", ip, ipLocation);
return Content(new { ARM = arm, CPU = cpu, IIS = iis, TotalRAM = TotalRAM, IP = IP }.ToJson());
});
}
[HttpGet]
public async Task<ActionResult> GetServerData()
{
var data = (await _serverStateService.GetList(2)).OrderBy(a => a.F_Date).ToList();
return Content(data.ToJson());
}
}
}

View File

@ -0,0 +1,280 @@
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Index.cshtml";
}
@inject Microsoft.AspNetCore.Hosting.IWebHostEnvironment env
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<style>
.layui-card {
border: 1px solid #f2f2f2;
border-radius: 5px;
}
.icon {
margin-right: 10px;
color: #1aa094;
}
.icon-cray {
color: #ffb800 !important;
}
.icon-blue {
color: #1e9fff !important;
}
.icon-tip {
color: #ff5722 !important;
}
.layuimini-qiuck-module {
text-align: center;
margin-top: 10px
}
.layuimini-qiuck-module a i {
display: inline-block;
width: 100%;
height: 60px;
line-height: 60px;
text-align: center;
border-radius: 2px;
font-size: 30px;
background-color: #F8F8F8;
color: #333;
transition: all .3s;
-webkit-transition: all .3s;
}
.layuimini-qiuck-module a cite {
position: relative;
top: 2px;
display: block;
color: #666;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
font-size: 14px;
}
.welcome-module {
width: 100%;
height: 210px;
}
.panel {
background-color: #fff;
border: 1px solid transparent;
border-radius: 3px;
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05);
box-shadow: 0 1px 1px rgba(0,0,0,.05)
}
.panel-body {
padding: 10px
}
.panel-title {
margin-top: 0;
margin-bottom: 0;
font-size: 12px;
color: inherit
}
.label {
display: inline;
padding: .2em .6em .3em;
font-size: 75%;
font-weight: 700;
line-height: 1;
color: #fff;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: .25em;
margin-top: .3em;
}
.label {
display: inline;
padding: .2em .6em .3em;
font-size: 75%;
font-weight: 700;
line-height: 1;
color: #fff;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: .25em;
margin-top: .3em;
}
.layui-red {
color: red
}
.main_btn > p {
height: 40px;
}
.layui-bg-number {
background-color: #F8F8F8;
}
.layuimini-notice:hover {
background: #f6f6f6;
}
.layuimini-notice {
padding: 7px 16px;
clear: both;
font-size: 12px !important;
cursor: pointer;
position: relative;
transition: background 0.2s ease-in-out;
}
.layuimini-notice-title, .layuimini-notice-label {
padding-right: 70px !important;
text-overflow: ellipsis !important;
overflow: hidden !important;
white-space: nowrap !important;
}
.layuimini-notice-title {
line-height: 28px;
font-size: 14px;
}
.layuimini-notice-extra {
position: absolute;
top: 50%;
margin-top: -8px;
right: 16px;
display: inline-block;
height: 16px;
color: #999;
}
</style>
<script>
layui.use(['layer', 'echarts', 'common'], function () {
var $ = layui.jquery,
layer = layui.layer,
common = layui.common,
echarts = layui.echarts;
common = layui.common;
common.iframeInterval(function () {
loadInfo();
}, 10000); //指定10秒刷新一次
$(function () {
loadInfo();
loadChart();
});
wcLoading.close();
function loadInfo() {
$.ajax({
url: "/SystemSecurity/ServerMonitoring/GetServerDataJson?v=" + new Date().Format("yyyy-MM-dd hh:mm:ss"),
dataType: "json",
success: function (data) {
$('#cpucout').html(data.CPU + "%");
$('#armcout').html(data.ARM + "%");
$('#TotalRAM').html(data.TotalRAM);
$('#OutIP').html(data.IP);
}
});
}
function loadChart() {
var myChart = echarts.init(document.getElementById('echarts-records'), 'walden');
var xData = [];
var armData = [];
var cpuData = [];
common.ajax({
url: "/SystemSecurity/ServerMonitoring/GetServerData",
dataType: "json",
async: false,
success: function (data) {
var length = data.length;
for (var i = 0; i < length; i++) {
if (data[i]['F_Date'] !== null) {
xData.push(new Date(data[i]['F_Date']).Format("yyyy-MM-dd"));
}
if (data[i]['F_ARM'] !== null) {
armData.push(data[i]['F_ARM']);
}
if (data[i]['F_CPU'] !== null) {
cpuData.push(data[i]['F_CPU']);
}
}
}
});
option = {
tooltip: {
trigger: 'axis'
},
legend: {
data: ['CPU使用率', 'ARM使用率']
},
xAxis: {
type: 'category',
boundaryGap: false,
data: xData
},
yAxis: {
type: 'value'
},
series: [
{
name: 'CPU使用率', type: 'line',
data: cpuData,
lineStyle: {
normal: {
width: 2
}
},
smooth: true,
symbol: 'circle',
symbolSize: 10,
showAllSymbol: true,
color: '#2499F8',
},
{
name: 'ARM使用率', type: 'line',
data: armData,
lineStyle: {
normal: {
width: 2
}
},
smooth: true,
symbol: 'circle',
symbolSize: 10,
showAllSymbol: true,
color: '#F90',
}
]
};
myChart.setOption(option);
// echarts 窗口缩放自适应
window.onresize = function () {
myChart.resize();
}
};
})
</script>
<div style ="width:100%;height:100%;">
<div class="layuimini-container" style="width:100%;height:100%;">
<div class="layuimini-main">
<div class="layui-row layui-col-space15">
<div class="layui-col-md15">
<iframe style="width:100%;height:95vh" src="http://192.168.110.249:1881/editor/"></iframe>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,280 @@
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Index.cshtml";
}
@inject Microsoft.AspNetCore.Hosting.IWebHostEnvironment env
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<style>
.layui-card {
border: 1px solid #f2f2f2;
border-radius: 5px;
}
.icon {
margin-right: 10px;
color: #1aa094;
}
.icon-cray {
color: #ffb800 !important;
}
.icon-blue {
color: #1e9fff !important;
}
.icon-tip {
color: #ff5722 !important;
}
.layuimini-qiuck-module {
text-align: center;
margin-top: 10px
}
.layuimini-qiuck-module a i {
display: inline-block;
width: 100%;
height: 60px;
line-height: 60px;
text-align: center;
border-radius: 2px;
font-size: 30px;
background-color: #F8F8F8;
color: #333;
transition: all .3s;
-webkit-transition: all .3s;
}
.layuimini-qiuck-module a cite {
position: relative;
top: 2px;
display: block;
color: #666;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
font-size: 14px;
}
.welcome-module {
width: 100%;
height: 210px;
}
.panel {
background-color: #fff;
border: 1px solid transparent;
border-radius: 3px;
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05);
box-shadow: 0 1px 1px rgba(0,0,0,.05)
}
.panel-body {
padding: 10px
}
.panel-title {
margin-top: 0;
margin-bottom: 0;
font-size: 12px;
color: inherit
}
.label {
display: inline;
padding: .2em .6em .3em;
font-size: 75%;
font-weight: 700;
line-height: 1;
color: #fff;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: .25em;
margin-top: .3em;
}
.label {
display: inline;
padding: .2em .6em .3em;
font-size: 75%;
font-weight: 700;
line-height: 1;
color: #fff;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: .25em;
margin-top: .3em;
}
.layui-red {
color: red
}
.main_btn > p {
height: 40px;
}
.layui-bg-number {
background-color: #F8F8F8;
}
.layuimini-notice:hover {
background: #f6f6f6;
}
.layuimini-notice {
padding: 7px 16px;
clear: both;
font-size: 12px !important;
cursor: pointer;
position: relative;
transition: background 0.2s ease-in-out;
}
.layuimini-notice-title, .layuimini-notice-label {
padding-right: 70px !important;
text-overflow: ellipsis !important;
overflow: hidden !important;
white-space: nowrap !important;
}
.layuimini-notice-title {
line-height: 28px;
font-size: 14px;
}
.layuimini-notice-extra {
position: absolute;
top: 50%;
margin-top: -8px;
right: 16px;
display: inline-block;
height: 16px;
color: #999;
}
</style>
<script>
layui.use(['layer', 'echarts', 'common'], function () {
var $ = layui.jquery,
layer = layui.layer,
common = layui.common,
echarts = layui.echarts;
common = layui.common;
common.iframeInterval(function () {
loadInfo();
}, 10000); //指定10秒刷新一次
$(function () {
loadInfo();
loadChart();
});
wcLoading.close();
function loadInfo() {
$.ajax({
url: "/SystemSecurity/ServerMonitoring/GetServerDataJson?v=" + new Date().Format("yyyy-MM-dd hh:mm:ss"),
dataType: "json",
success: function (data) {
$('#cpucout').html(data.CPU + "%");
$('#armcout').html(data.ARM + "%");
$('#TotalRAM').html(data.TotalRAM);
$('#OutIP').html(data.IP);
}
});
}
function loadChart() {
var myChart = echarts.init(document.getElementById('echarts-records'), 'walden');
var xData = [];
var armData = [];
var cpuData = [];
common.ajax({
url: "/SystemSecurity/ServerMonitoring/GetServerData",
dataType: "json",
async: false,
success: function (data) {
var length = data.length;
for (var i = 0; i < length; i++) {
if (data[i]['F_Date'] !== null) {
xData.push(new Date(data[i]['F_Date']).Format("yyyy-MM-dd"));
}
if (data[i]['F_ARM'] !== null) {
armData.push(data[i]['F_ARM']);
}
if (data[i]['F_CPU'] !== null) {
cpuData.push(data[i]['F_CPU']);
}
}
}
});
option = {
tooltip: {
trigger: 'axis'
},
legend: {
data: ['CPU使用率', 'ARM使用率']
},
xAxis: {
type: 'category',
boundaryGap: false,
data: xData
},
yAxis: {
type: 'value'
},
series: [
{
name: 'CPU使用率', type: 'line',
data: cpuData,
lineStyle: {
normal: {
width: 2
}
},
smooth: true,
symbol: 'circle',
symbolSize: 10,
showAllSymbol: true,
color: '#2499F8',
},
{
name: 'ARM使用率', type: 'line',
data: armData,
lineStyle: {
normal: {
width: 2
}
},
smooth: true,
symbol: 'circle',
symbolSize: 10,
showAllSymbol: true,
color: '#F90',
}
]
};
myChart.setOption(option);
// echarts 窗口缩放自适应
window.onresize = function () {
myChart.resize();
}
};
})
</script>
<div style ="width:100%;height:100%;">
<div class="layuimini-container" style="width:100%;height:100%;">
<div class="layuimini-main">
<div class="layui-row layui-col-space15">
<div class="layui-col-md15">
<iframe style="width:100%;height:95vh" src="http://192.168.110.249:1881/"></iframe>
</div>
</div>
</div>
</div>
</div>

View File

@ -14,7 +14,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
</PropertyGroup>
<ItemGroup>
<None Include="wwwroot\lib\layui\font\iconfont.svg" />
<None Include="wwwroot\lib\layui\font\iconfont.woff2" />

View File

@ -1,5 +1,5 @@
{
"urls": "http://*:5000",
"urls": "http://*:8058",
"Logging": {
"LogLevel": {
"Default": "Information",
@ -10,9 +10,9 @@
"SystemConfig": {
"Demo": false, // 是否是演示模式 账号admin 密码0000
"LoginMultiple": false, // 是否允许一个账户在多处登录
"AllowCorsSite": "http://localhost:5000", // 允许的其他站点访问Api
"AllowCorsSite": "http://localhost:8058", // 允许的其他站点访问Api
"DBProvider": "SqlServer", //SqlServer //Oracle
"DBConnectionString": "Data Source=192.168.110.32;Initial Catalog=SCADA;User Id= sa;Password= Sa1qaz;Integrated Security=False;Encrypt=True;TrustServerCertificate=True;",
"DBConnectionString": "Data Source=192.168.110.36;Initial Catalog=HTSCADA;User Id= sa;Password= Sa1qaz;Integrated Security=False;Encrypt=True;TrustServerCertificate=True;",
"DBCommandTimeout": 180, // 数据库超时时间,单位秒
"CacheProvider": "Memory", // 缓存使用方式 Redis/Memory
"RedisConnectionString": "127.0.0.1:6379", //docker部署 172.17.0.1