添加项目文件。
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
/*******************************************************************************
|
||||
* Copyright © 2020 WaterCloud.Framework 版权所有
|
||||
* Author: WaterCloud
|
||||
* Description: WaterCloud快速开发平台
|
||||
* Website:
|
||||
*********************************************************************************/
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using WaterCloud.Code;
|
||||
using WaterCloud.Code.Model;
|
||||
|
||||
namespace WaterCloud.Web.Areas.SystemSecurity.Controllers
|
||||
{
|
||||
[Area("SystemSecurity")]
|
||||
public class AppLogController : BaseController
|
||||
{
|
||||
[HttpGet]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> GetGridJson(Pagination pagination, int timetype = 2)
|
||||
{
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
//导出全部页使用
|
||||
if (pagination.rows == 0 && pagination.page == 0)
|
||||
{
|
||||
pagination.rows = 99999999;
|
||||
pagination.page = 1;
|
||||
}
|
||||
List<AppLogEntity> list = new List<AppLogEntity>();
|
||||
string logPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "logs");
|
||||
getDirectory(list, logPath);
|
||||
DateTime startTime = DateTime.Now.ToString("yyyy-MM-dd").ToDate();
|
||||
DateTime endTime = DateTime.Now.ToString("yyyy-MM-dd").ToDate().AddDays(1);
|
||||
switch (timetype)
|
||||
{
|
||||
case 1:
|
||||
break;
|
||||
|
||||
case 2:
|
||||
startTime = startTime.AddDays(-7);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
startTime = startTime.AddMonths(-1);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
startTime = startTime.AddMonths(-3);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
list = list.Where(a => (a.FileName.Split('.')[0]).CompareTo(startTime.ToString("yyyy-MM-dd")) >= 0 && (a.FileName.Split('.')[0]).CompareTo(endTime.ToString("yyyy-MM-dd")) <= 0).ToList();
|
||||
pagination.records = list.Count();
|
||||
list = list.OrderBy(a => a.FileName).Skip((pagination.page - 1) * pagination.rows).Take(pagination.rows).ToList();
|
||||
return Success(pagination.records, list);
|
||||
});
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> GetFormJson(string keyValue)
|
||||
{
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
string content;
|
||||
string logPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "logs", keyValue.Split('.')[0].Substring(0, 7), keyValue);
|
||||
using (StreamReader sr = new StreamReader(logPath))
|
||||
{
|
||||
content = sr.ReadToEnd();
|
||||
}
|
||||
return Success("操作成功", HttpUtility.HtmlEncode(content));
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得指定路径下所有文件名
|
||||
/// </summary>
|
||||
/// <param name="sw">列表</param>
|
||||
/// <param name="path">文件夹路径</param>
|
||||
public static void getDirectory(List<AppLogEntity> sw, string path)
|
||||
{
|
||||
DirectoryInfo root = new DirectoryInfo(path);
|
||||
foreach (FileInfo f in root.GetFiles())
|
||||
{
|
||||
AppLogEntity app = new AppLogEntity();
|
||||
app.FileName = f.Name;
|
||||
sw.Add(app);
|
||||
}
|
||||
foreach (DirectoryInfo d in root.GetDirectories())
|
||||
{
|
||||
getDirectory(sw, d.FullName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*******************************************************************************
|
||||
* Copyright © 2020 WaterCloud.Framework 版权所有
|
||||
* Author: WaterCloud
|
||||
* Description: WaterCloud快速开发平台
|
||||
* Website:
|
||||
*********************************************************************************/
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using WaterCloud.Code;
|
||||
using WaterCloud.Domain.SystemSecurity;
|
||||
using WaterCloud.Service.SystemSecurity;
|
||||
|
||||
namespace WaterCloud.Web.Areas.SystemSecurity.Controllers
|
||||
{
|
||||
[Area("SystemSecurity")]
|
||||
public class FilterIPController : BaseController
|
||||
{
|
||||
public FilterIPService _service { get; set; }
|
||||
|
||||
[HttpGet]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> GetGridJson(string keyword)
|
||||
{
|
||||
var data = await _service.GetLookList(keyword);
|
||||
return Success(data.Count, data);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> GetFormJson(string keyValue)
|
||||
{
|
||||
var data = await _service.GetLookForm(keyValue);
|
||||
return Content(data.ToJson());
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> SubmitForm(FilterIPEntity filterIPEntity, string keyValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(keyValue))
|
||||
{
|
||||
filterIPEntity.F_DeleteMark = false;
|
||||
}
|
||||
await _service.SubmitForm(filterIPEntity, keyValue);
|
||||
return await Success("操作成功。", "", keyValue);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return await Error(ex.Message, "", keyValue);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[HandlerAjaxOnly]
|
||||
[HandlerAuthorize]
|
||||
public async Task<ActionResult> DeleteForm(string keyValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _service.DeleteForm(keyValue);
|
||||
return await Success("操作成功。", "", keyValue, DbLogType.Delete);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return await Error(ex.Message, "", keyValue, DbLogType.Delete);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*******************************************************************************
|
||||
* Copyright © 2020 WaterCloud.Framework 版权所有
|
||||
* Author: WaterCloud
|
||||
* Description: WaterCloud快速开发平台
|
||||
* Website:
|
||||
*********************************************************************************/
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Threading.Tasks;
|
||||
using WaterCloud.Code;
|
||||
|
||||
namespace WaterCloud.Web.Areas.SystemSecurity.Controllers
|
||||
{
|
||||
[Area("SystemSecurity")]
|
||||
public class LogController : BaseController
|
||||
{
|
||||
[HttpGet]
|
||||
[HandlerAuthorize]
|
||||
public ActionResult RemoveLog()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> GetGridJson(Pagination pagination, string keyword, int timetype = 2)
|
||||
{
|
||||
if (string.IsNullOrEmpty(pagination.field))
|
||||
{
|
||||
pagination.order = "desc";
|
||||
pagination.field = "F_CreatorTime";
|
||||
}
|
||||
//导出全部页使用
|
||||
if (pagination.rows == 0 && pagination.page == 0)
|
||||
{
|
||||
pagination.rows = 99999999;
|
||||
pagination.page = 1;
|
||||
}
|
||||
var data = await _logService.GetList(pagination, timetype, keyword);
|
||||
return Success(pagination.records, data);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> SubmitRemoveLog(string keepTime)
|
||||
{
|
||||
await _logService.RemoveLog(keepTime);
|
||||
return Success("清空成功。");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,196 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Quartz;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using WaterCloud.Code;
|
||||
using WaterCloud.Domain.SystemSecurity;
|
||||
using WaterCloud.Service;
|
||||
using WaterCloud.Service.SystemSecurity;
|
||||
|
||||
namespace WaterCloud.Web.Areas.SystemSecurity.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 定时任务
|
||||
/// </summary>
|
||||
[Area("SystemSecurity")]
|
||||
public class OpenJobsController : BaseController
|
||||
{
|
||||
public OpenJobsService _service { get; set; }
|
||||
|
||||
//获取详情
|
||||
[HttpGet]
|
||||
public async Task<ActionResult> GetFormJson(string keyValue)
|
||||
{
|
||||
var data = await _service.GetForm(keyValue);
|
||||
return Content(data.ToJson());
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> SubmitForm(OpenJobEntity entity, string keyValue)
|
||||
{
|
||||
if (string.IsNullOrEmpty(keyValue))
|
||||
{
|
||||
entity.F_EnabledMark = false;
|
||||
entity.F_DeleteMark = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
entity.F_EnabledMark = null;
|
||||
}
|
||||
try
|
||||
{
|
||||
await _service.SubmitForm(entity, keyValue);
|
||||
return await Success("操作成功。", "", keyValue);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return await Error(ex.Message, "", keyValue);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[HandlerAjaxOnly]
|
||||
[HandlerAuthorize]
|
||||
public async Task<ActionResult> DeleteForm(string keyValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _service.DeleteForm(keyValue);
|
||||
return await Success("操作成功。", "", keyValue, DbLogType.Delete);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return await Error(ex.Message, "", keyValue, DbLogType.Delete);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取本地可执行的任务列表
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
public async Task<ActionResult> QueryLocalHandlers()
|
||||
{
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
var data = _service.QueryLocalHandlers();
|
||||
return Content(data.ToJson());
|
||||
});
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> GetGridJson(Pagination pagination, string keyword)
|
||||
{
|
||||
pagination.order = "desc";
|
||||
pagination.field = "F_EnabledMark";
|
||||
//导出全部页使用
|
||||
if (pagination.rows == 0 && pagination.page == 0)
|
||||
{
|
||||
pagination.rows = 99999999;
|
||||
pagination.page = 1;
|
||||
}
|
||||
var data = await _service.GetLookList(pagination, keyword);
|
||||
foreach (var item in data)
|
||||
{
|
||||
if (item.F_EnabledMark == true)
|
||||
{
|
||||
CronExpression cronExpression = new CronExpression(item.F_CronExpress);
|
||||
item.NextValidTimeAfter = cronExpression.GetNextValidTimeAfter(DateTime.Now).Value.ToLocalTime().DateTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.NextValidTimeAfter = null;
|
||||
}
|
||||
}
|
||||
return Success(pagination.records, data);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> GetLogJson(string keyValue, string keyword)
|
||||
{
|
||||
var data = await _service.GetLogList(keyValue);
|
||||
if (!string.IsNullOrEmpty(keyword))
|
||||
{
|
||||
data = data.Where(a => a.F_Description.Contains(keyword)).ToList();
|
||||
}
|
||||
return Success(data.Count, data);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HandlerAjaxOnly]
|
||||
public ActionResult GetDBListJson()
|
||||
{
|
||||
var data = DBInitialize.GetConnectionConfigs(true);
|
||||
return Content(data.Select(a => a.ConfigId).ToJson());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 改变任务状态,启动/停止
|
||||
/// </summary>
|
||||
[HttpPost]
|
||||
public async Task<ActionResult> ChangeStatus(string keyValue, int status)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _service.ChangeJobStatus(keyValue, status);
|
||||
return await Success("操作成功。", "", keyValue);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return await Error(ex.Message, "", keyValue);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 立即执行任务
|
||||
/// </summary>
|
||||
[HttpPost]
|
||||
public async Task<ActionResult> DoNow(string keyValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _service.DoNow(keyValue);
|
||||
return await Success("操作成功。", "", keyValue);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return await Error(ex.Message, "", keyValue);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清除任务计划
|
||||
/// </summary>
|
||||
[HttpPost]
|
||||
public async Task<ActionResult> ClearScheduleJob()
|
||||
{
|
||||
try
|
||||
{
|
||||
await _service.ClearScheduleJob();
|
||||
return await Success("操作成功。", "", "");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return await Error(ex.Message, "", "");
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> DeleteLogForm(string keyValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _service.DeleteLogForm(keyValue);
|
||||
return await Success("操作成功。", "", keyValue, DbLogType.Delete);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return await Error(ex.Message, "", keyValue, DbLogType.Delete);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*******************************************************************************
|
||||
* Copyright © 2020 WaterCloud.Framework 版权所有
|
||||
* Author: WaterCloud
|
||||
* Description: WaterCloud快速开发平台
|
||||
* Website:
|
||||
*********************************************************************************/
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using WaterCloud.Code;
|
||||
using WaterCloud.Service.SystemSecurity;
|
||||
|
||||
namespace WaterCloud.Web.Areas.SystemSecurity.Controllers
|
||||
{
|
||||
[Area("SystemSecurity")]
|
||||
public class ServerMonitoringController : 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
198
WaterCloud.Web/Areas/SystemSecurity/Views/AppLog/Index.cshtml
Normal file
198
WaterCloud.Web/Areas/SystemSecurity/Views/AppLog/Index.cshtml
Normal file
@@ -0,0 +1,198 @@
|
||||
@{
|
||||
ViewBag.Title = "Index";
|
||||
Layout = "~/Views/Shared/_Index.cshtml";
|
||||
}
|
||||
<script src="~/lib/jquery.ui/1.12.1/jquery-ui.min.js" charset="utf-8"></script>
|
||||
<link href="~/lib/jquery.ui/1.12.1/jquery-ui.min.css" rel="stylesheet" />
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>layui</title>
|
||||
<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">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
|
||||
<fieldset class="table-search-fieldset layui-hide" id="searchField">
|
||||
@*<legend>搜索信息</legend>*@
|
||||
<div>
|
||||
<form class="layui-form layui-form-pane" action="">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label required">日期:</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="time_horizon" name="time_horizon" lay-verify="required">
|
||||
<option value="1">今天</option>
|
||||
<option value="2" selected>近7天</option>
|
||||
<option value="3">近1个月</option>
|
||||
<option value="4">近2个月</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container" id="toolbar">
|
||||
<button id="NF-details" name="NF-details" authorize="yes" class="layui-btn layui-btn-sm layui-btn-normal layui-hide" lay-event="details"> <i class="layui-icon"></i>查看</button>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="currentTableBar">
|
||||
<a id="NF-details" authorize class="layui-btn layui-btn-xs layui-btn-normal" lay-event="details">查看</a>
|
||||
</script>
|
||||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
layui.use(['jquery', 'form', 'table', 'common', 'layer', 'optimizeSelectOption', 'commonTable'], function () {
|
||||
var $ = layui.jquery,
|
||||
form = layui.form,
|
||||
table = layui.table,
|
||||
layer = layui.layer,
|
||||
commonTable = layui.commonTable,
|
||||
common = layui.common;
|
||||
//加载数据
|
||||
wcLoading.close();
|
||||
//权限控制(js是值传递)
|
||||
currentTableBar.innerHTML = common.authorizeButtonNew(currentTableBar.innerHTML);
|
||||
toolbarDemo.innerHTML = common.authorizeButtonNew(toolbarDemo.innerHTML);
|
||||
commonTable.rendertable({
|
||||
elem: '#currentTableId',
|
||||
id: 'currentTableId',
|
||||
url: '/SystemSecurity/AppLog/GetGridJson',
|
||||
autoSort:true,
|
||||
cols: [[
|
||||
{ type: "radio", width: 50, fixed: 'left'},
|
||||
{ field: 'FileName', title: '文件名称', minWidth: 100, sort: true },
|
||||
{ title: '操作', width: 80, toolbar: '#currentTableBar', align: "center", fixed: 'right' }
|
||||
]]
|
||||
});
|
||||
//select验证
|
||||
form.verify({
|
||||
required: function (value, item) {
|
||||
var msg = "必填项不能为空";
|
||||
value = $.trim(value);
|
||||
var isEmpty = !value || value.length < 1;
|
||||
// 当前验证元素是select且为空时,将页面定位至layui渲染的select处,或自定义想定位的位置
|
||||
if (item.tagName == 'SELECT' && isEmpty) {
|
||||
$("html").animate({
|
||||
scrollTop: $(item).siblings(".layui-form-select").offset().top - 74
|
||||
}, 50);
|
||||
}
|
||||
if (isEmpty) {
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
});
|
||||
// 监听搜索操作
|
||||
form.on('submit(data-search-btn)', function (data) {
|
||||
commonTable.reloadtable({
|
||||
elem: 'currentTableId',
|
||||
curr: 1,
|
||||
where: { timetype: data.field.time_horizon }
|
||||
});
|
||||
return false;
|
||||
});
|
||||
//行点击事件监听,控制按钮显示
|
||||
var oneList = ["NF-details"];//选择1条显示
|
||||
commonTable.tableRowClick("radio", "currentTableFilter", "currentTableId", oneList);
|
||||
/**
|
||||
* toolbar监听事件
|
||||
*/
|
||||
table.on('toolbar(currentTableFilter)', function (obj) {
|
||||
var data = table.checkStatus('currentTableId').data;
|
||||
if (obj.event === 'details') { // 监听删除操作
|
||||
if (data.length == 0) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
var html = "";
|
||||
//高度宽度超出就适应屏幕
|
||||
var _width = document.body.clientWidth > 500 ? '500px' : document.body.clientWidth - 20 + 'px';
|
||||
var _height = document.body.clientHeight > 500 ? '500px' : document.body.clientHeight - 20 + 'px';
|
||||
if (common.currentWindow()) {
|
||||
_width = common.currentWindow().document.body.clientWidth > 500 ? '500px' : common.currentWindow().document.body.clientWidth - 20 + 'px';
|
||||
_height = common.currentWindow().document.body.clientHeight > 500 ? '500px' : common.currentWindow().document.body.clientHeight - 20 + 'px';
|
||||
}
|
||||
common.ajax({
|
||||
url: "/SystemSecurity/AppLog/GetFormJson",
|
||||
dataType: "json",
|
||||
data: { keyValue: data[0].FileName },
|
||||
async: false,
|
||||
success: function (data) {
|
||||
html = "<pre class='no-padding no-margin no-top-border' style='padding: 15px'><code class='html'>" + data.data + "</code></pre>";
|
||||
layer.open({
|
||||
type: 1,
|
||||
shade: 0.3,
|
||||
title: '查看日志',
|
||||
isOutAnim: true,//关闭动画
|
||||
fix: false,
|
||||
area: [_width, _height],
|
||||
content: html,
|
||||
success: function (layero, index) {
|
||||
$(layero).addClass("scroll-wrapper");//苹果 iframe 滚动条失效解决方式
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'TABLE_SEARCH') {
|
||||
var _that = $("#searchField");
|
||||
if (_that.hasClass("layui-hide")) {
|
||||
_that.removeClass('layui-hide');
|
||||
} else {
|
||||
_that.addClass('layui-hide');
|
||||
}
|
||||
table.resize();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
//toolrow监听事件
|
||||
table.on('tool(currentTableFilter)', function (obj) {
|
||||
if (obj.event === 'details') {
|
||||
var html = "";
|
||||
//高度宽度超出就适应屏幕
|
||||
var _width = document.body.clientWidth > 500 ? '500px' : document.body.clientWidth - 20 + 'px';
|
||||
var _height = document.body.clientHeight > 500 ? '500px' : document.body.clientHeight - 20 + 'px';
|
||||
if (common.currentWindow()) {
|
||||
_width = common.currentWindow().document.body.clientWidth > 500 ? '500px' : common.currentWindow().document.body.clientWidth - 20 + 'px';
|
||||
_height = common.currentWindow().document.body.clientHeight > 500 ? '500px' : common.currentWindow().document.body.clientHeight - 20 + 'px';
|
||||
}
|
||||
common.ajax({
|
||||
url: "/SystemSecurity/AppLog/GetFormJson",
|
||||
dataType: "json",
|
||||
data: { keyValue: obj.data.FileName },
|
||||
async: false,
|
||||
success: function (data) {
|
||||
html = "<pre class='no-padding no-margin no-top-border' style='padding: 15px'><code class='html'>" + data.data + "</code></pre>";
|
||||
layer.open({
|
||||
type: 1,
|
||||
shade: 0.3,
|
||||
title: '查看日志',
|
||||
isOutAnim: true,//关闭动画
|
||||
fix: false,
|
||||
area: [_width, _height],
|
||||
content: html,
|
||||
success: function (layero, index) {
|
||||
$(layero).addClass("scroll-wrapper");//苹果 iframe 滚动条失效解决方式
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,80 @@
|
||||
@{
|
||||
ViewBag.Title = "Details";
|
||||
Layout = "~/Views/Shared/_Form.cshtml";
|
||||
}
|
||||
<body>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<blockquote class="layui-elem-quote layui-text">
|
||||
注意!IP地址格式:192.168.0.1;192.168.0.*
|
||||
</blockquote>
|
||||
<div class="layui-form layuimini-form" lay-filter="adminform" text-aglin:center>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">策略类型</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_Type" name="F_Type">
|
||||
<option value="false">拒绝访问</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">起始IP</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_StartIP" name="F_StartIP" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">结束IP</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_EndIP" name="F_EndIP" value="" class="layui-input ">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">到期时间</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_EndTime" name="F_EndTime" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">有效</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" checked="" id="F_EnabledMark" name="F_EnabledMark" lay-skin="switch" lay-filter="switchTest" lay-text="ON|OFF">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text layui-hide">
|
||||
<label class="layui-form-label">备注</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea id="F_Description" name="F_Description" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
layui.use(['jquery', 'form', 'laydate', 'common', 'optimizeSelectOption'], function () {
|
||||
|
||||
var form = layui.form,
|
||||
$ = layui.$,
|
||||
common = layui.common,
|
||||
laydate = layui.laydate;
|
||||
var keyValue = $.request("keyValue");
|
||||
//权限字段
|
||||
common.authorizeFields('adminform');
|
||||
$(function () {
|
||||
common.ajax({
|
||||
url: "/SystemSecurity/FilterIP/GetFormJson",
|
||||
dataType: "json",
|
||||
data: { keyValue: keyValue },
|
||||
async: false,
|
||||
success: function (data) {
|
||||
common.val('adminform', data);
|
||||
common.setReadOnly('adminform');
|
||||
form.render();
|
||||
}
|
||||
});
|
||||
});
|
||||
wcLoading.close();
|
||||
});
|
||||
</script>
|
||||
|
||||
146
WaterCloud.Web/Areas/SystemSecurity/Views/FilterIP/Form.cshtml
Normal file
146
WaterCloud.Web/Areas/SystemSecurity/Views/FilterIP/Form.cshtml
Normal file
@@ -0,0 +1,146 @@
|
||||
@{
|
||||
ViewBag.Title = "Form";
|
||||
Layout = "~/Views/Shared/_Form.cshtml";
|
||||
}
|
||||
<body>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<blockquote class="layui-elem-quote layui-text">
|
||||
注意!IP地址格式:192.168.0.1;192.168.0.*
|
||||
</blockquote>
|
||||
<div class="layui-form layuimini-form" lay-filter="adminform">
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label required">策略类型</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_Type" name="F_Type" lay-verify="required">
|
||||
<option value="false" selected>拒绝访问</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label required">起始IP</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_StartIP" name="F_StartIP" maxlength="50" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">结束IP</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_EndIP" name="F_EndIP" maxlength="50" value="" class="layui-input ">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">到期时间</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_EndTime" name="F_EndTime" lay-verify="required" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">有效</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" checked="" id="F_EnabledMark" name="F_EnabledMark" lay-skin="switch" lay-filter="switchTest" value="true" lay-text="ON|OFF">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text layui-hide">
|
||||
<label class="layui-form-label">备注</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea id="F_Description" name="F_Description" class="layui-textarea" placeholder="请输入备注"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<button class="layui-btn site-demo-active" lay-submit id="submit" lay-filter="saveBtn">确认保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
layui.use(['jquery', 'form', 'laydate', 'common', 'optimizeSelectOption'], function () {
|
||||
var form = layui.form,
|
||||
$ = layui.$,
|
||||
common = layui.common,
|
||||
laydate = layui.laydate;
|
||||
var keyValue = $.request("keyValue");
|
||||
//执行一个laydate实例
|
||||
laydate.render({
|
||||
elem: '#F_EndTime'
|
||||
, trigger: 'click'
|
||||
, type: 'datetime'
|
||||
, format: 'yyyy/MM/dd HH:mm:ss',
|
||||
});
|
||||
//权限字段
|
||||
common.authorizeFields('adminform');
|
||||
$(function () {
|
||||
if (!!keyValue) {
|
||||
common.ajax({
|
||||
url: "/SystemSecurity/FilterIP/GetFormJson",
|
||||
dataType: "json",
|
||||
data: { keyValue: keyValue },
|
||||
async: false,
|
||||
success: function (data) {
|
||||
common.val('adminform', data);
|
||||
form.render();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
wcLoading.close();
|
||||
//select验证
|
||||
form.verify({
|
||||
required: function (value, item) {
|
||||
var msg = "必填项不能为空";
|
||||
value = $.trim(value);
|
||||
var isEmpty = !value || value.length < 1;
|
||||
// 当前验证元素是select且为空时,将页面定位至layui渲染的select处,或自定义想定位的位置
|
||||
if (item.tagName == 'SELECT' && isEmpty) {
|
||||
$("html").animate({
|
||||
scrollTop: $(item).siblings(".layui-form-select").offset().top - 74
|
||||
}, 50);
|
||||
}
|
||||
if (isEmpty) {
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
});
|
||||
function compareIP(ipBegin, ipEnd) {
|
||||
var temp1 = ipBegin.split(".");
|
||||
var temp2 = ipEnd.split(".");
|
||||
if ((temp1[0] + temp1[1] + temp1[2]) == (temp2[0] + temp2[1] + temp2[2])) {
|
||||
if (temp2[3] >= temp1[3]) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
return -1;//不在同一个网段内
|
||||
}
|
||||
}
|
||||
//监听提交
|
||||
form.on('submit(saveBtn)', function (data) {
|
||||
var postData = data.field;
|
||||
var StartIP = data.field.F_StartIP;
|
||||
var EndIP = data.field.F_EndIP;
|
||||
if (!postData["F_EnabledMark"]) postData["F_EnabledMark"] = false;
|
||||
if (!!EndIP) {
|
||||
|
||||
if (compareIP(StartIP, EndIP) == -1) {
|
||||
common.modalMsg("不在同一个网段内");
|
||||
return false;
|
||||
}
|
||||
if (compareIP(StartIP, EndIP) == 0) {
|
||||
common.modalMsg("结束IP不能大于开始IP");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
common.submitForm({
|
||||
url: "/SystemSecurity/FilterIP/SubmitForm?keyValue=" + keyValue,
|
||||
param: postData,
|
||||
success: function () {
|
||||
common.parentreload("data-search-btn");
|
||||
}
|
||||
})
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
214
WaterCloud.Web/Areas/SystemSecurity/Views/FilterIP/Index.cshtml
Normal file
214
WaterCloud.Web/Areas/SystemSecurity/Views/FilterIP/Index.cshtml
Normal file
@@ -0,0 +1,214 @@
|
||||
@{
|
||||
ViewBag.Title = "Index";
|
||||
Layout = "~/Views/Shared/_Index.cshtml";
|
||||
}
|
||||
<script>
|
||||
layui.use(['form', 'table', 'common', 'commonTable', 'optimizeSelectOption'], function () {
|
||||
var form = layui.form,
|
||||
table = layui.table,
|
||||
commonTable = layui.commonTable,
|
||||
common = layui.common;
|
||||
//加载数据
|
||||
wcLoading.close();
|
||||
//权限控制(js是值传递)
|
||||
currentTableBar.innerHTML = common.authorizeButtonNew(currentTableBar.innerHTML);
|
||||
toolbarDemo.innerHTML = common.authorizeButtonNew(toolbarDemo.innerHTML);
|
||||
commonTable.rendertable({
|
||||
elem: '#currentTableId',
|
||||
id: 'currentTableId',
|
||||
url: '/SystemSecurity/FilterIP/GetGridJson',
|
||||
page: false,
|
||||
cols: [[
|
||||
{ type: "checkbox", width: 50, fixed: 'left' },
|
||||
{
|
||||
field: 'F_Type', title: '策略类型', width: 120, sort: true,
|
||||
templet: function (d) {
|
||||
if (d.F_Type == true) {
|
||||
return "<span class='layui-badge layui-bg-blue'>允许访问</span>";
|
||||
} else {
|
||||
return "<span class='layui-badge layui-btn-warm'>禁止访问</span>";
|
||||
}
|
||||
}
|
||||
},
|
||||
{ field: 'F_StartIP', title: '起始IP', width: 150, sort: true},
|
||||
{ field: 'F_EndIP', title: '结束IP', width: 150, sort: true },
|
||||
{
|
||||
field: 'F_EndTime', title: '到期时间', width: 160, sort: true
|
||||
},
|
||||
{
|
||||
field: 'F_CreatorTime', title: '创建时间', width: 160, sort: true
|
||||
},
|
||||
{
|
||||
field: 'F_EnabledMark', title: '状态', width: 80, sort: true,
|
||||
templet: function (d) {
|
||||
if (d.F_EnabledMark == true) {
|
||||
return "<span class='layui-btn layui-btn-normal layui-btn-xs'>有效</span>";
|
||||
} else {
|
||||
return "<span class='layui-btn layui-btn-warm layui-btn-xs'>无效</span>";
|
||||
}
|
||||
}
|
||||
},
|
||||
{ field: 'F_Description', title: '备注', minWidth: 150 },
|
||||
{ title: '操作', width: 160, toolbar: '#currentTableBar', align: "center", fixed: 'right' }
|
||||
]]
|
||||
});
|
||||
// 监听搜索操作
|
||||
form.on('submit(data-search-btn)', function (data) {
|
||||
//执行搜索重载
|
||||
commonTable.reloadtable({
|
||||
elem: 'currentTableId',
|
||||
page: false,
|
||||
curr: 1,
|
||||
where: { keyword: data.field.txt_keyword }
|
||||
});
|
||||
return false;
|
||||
});
|
||||
//行点击事件监听,控制按钮显示
|
||||
var oneList = ["NF-edit", "NF-details"];//选择1条显示
|
||||
var morerList = ["NF-delete"];//选中1条以上显示
|
||||
commonTable.tableRowClick("checkbox", "currentTableFilter", "currentTableId", oneList, morerList);
|
||||
/**
|
||||
* toolbar监听事件
|
||||
*/
|
||||
table.on('toolbar(currentTableFilter)', function (obj) {
|
||||
var data = table.checkStatus('currentTableId').data;
|
||||
if (obj.event === 'add') { // 监听删除操作
|
||||
common.modalOpen({
|
||||
title: "添加策略",
|
||||
url: "/SystemSecurity/FilterIP/Form",
|
||||
width: "450px",
|
||||
height: "480px",
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'delete') {
|
||||
if (data.length == 0) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
var ids = [];
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
ids.push(data[i].F_Id);
|
||||
}
|
||||
common.deleteForm({
|
||||
url: "/SystemSecurity/FilterIP/DeleteForm",
|
||||
param: { keyValue: ids.join(',') },
|
||||
success: function () {
|
||||
common.reload('data-search-btn');
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
if (data.length == 0) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.modalOpen({
|
||||
title: "编辑策略",
|
||||
url: "/SystemSecurity/FilterIP/Form?keyValue=" + data[0].F_Id,
|
||||
width: "450px",
|
||||
height: "480px",
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'details') {
|
||||
if (data.length == 0) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.modalOpen({
|
||||
title: "查看策略",
|
||||
url: "/SystemSecurity/FilterIP/Details?keyValue=" + data[0].F_Id,
|
||||
width: "450px",
|
||||
height: "450px",
|
||||
btn: []
|
||||
//callBack: function (index) {
|
||||
// var iframe = "layui-layer-iframe" + index;
|
||||
// window.frames[iframe].submitForm();
|
||||
//}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'TABLE_SEARCH') {
|
||||
var _that = $("#searchField");
|
||||
if (_that.hasClass("layui-hide")) {
|
||||
_that.removeClass('layui-hide');
|
||||
} else {
|
||||
_that.addClass('layui-hide');
|
||||
}
|
||||
table.resize();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
//toolrow监听事件
|
||||
table.on('tool(currentTableFilter)', function (obj) {
|
||||
if (obj.event === 'delete') {
|
||||
common.deleteForm({
|
||||
url: "/SystemSecurity/FilterIP/DeleteForm",
|
||||
param: { keyValue: obj.data.F_Id },
|
||||
success: function () {
|
||||
obj.del();
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
common.modalOpen({
|
||||
title: "编辑策略",
|
||||
url: "/SystemSecurity/FilterIP/Form?keyValue=" + obj.data.F_Id,
|
||||
width: "450px",
|
||||
height: "480px",
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'details') {
|
||||
common.modalOpen({
|
||||
title: "查看策略",
|
||||
url: "/SystemSecurity/FilterIP/Details?keyValue=" + obj.data.F_Id,
|
||||
width: "450px",
|
||||
height: "450px",
|
||||
btn: []
|
||||
//callBack: function (index) {
|
||||
// var iframe = "layui-layer-iframe" + index;
|
||||
// window.frames[iframe].submitForm();
|
||||
//}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
|
||||
<fieldset class="table-search-fieldset layui-hide" id="searchField">
|
||||
@*<legend>搜索信息</legend>*@
|
||||
<div>
|
||||
<form class="layui-form layui-form-pane" action="">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">关键字:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="txt_keyword" name="txt_keyword" autocomplete="off" class="layui-input" placeholder="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container" id="toolbar">
|
||||
<button id="NF-add" name="NF-add" authorize class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon"></i>新增</button>
|
||||
<button id="NF-edit" name="NF-edit" authorize class="layui-btn layui-btn-sm layui-btn-warm layui-hide" lay-event="edit"><i class="layui-icon"></i>修改</button>
|
||||
<button id="NF-delete" name="NF-delete" authorize class="layui-btn layui-btn-sm layui-btn-danger layui-hide" lay-event="delete"> <i class="layui-icon"></i>删除</button>
|
||||
<button id="NF-details" name="NF-details" authorize class="layui-btn layui-btn-sm layui-btn-normal layui-hide" lay-event="details"> <i class="layui-icon"></i>查看</button>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="currentTableBar">
|
||||
<a id="NF-edit" authorize class="layui-btn layui-btn-xs layui-btn-warm" lay-event="edit">修改</a>
|
||||
<a id="NF-delete" authorize class="layui-btn layui-btn-xs layui-btn-danger" lay-event="delete">删除</a>
|
||||
<a id="NF-details" authorize class="layui-btn layui-btn-xs layui-btn-normal" lay-event="details">查看</a>
|
||||
</script>
|
||||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,93 @@
|
||||
@{
|
||||
ViewBag.Title = "Index";
|
||||
Layout = "~/Views/Shared/_Index.cshtml";
|
||||
}
|
||||
<script>
|
||||
layui.use(['jquery', 'form', 'common', 'commonTable', 'optimizeSelectOption'], function () {
|
||||
var $ = layui.jquery,
|
||||
form = layui.form,
|
||||
common = layui.common,
|
||||
commonTable = layui.commonTable;
|
||||
var keyValue = $.request("keyValue");
|
||||
wcLoading.close();
|
||||
commonTable.rendertable({
|
||||
elem: '#currentTableId',
|
||||
url: '/SystemSecurity/OpenJobs/GetLogJson?keyValue=' + keyValue,
|
||||
toolbar: false,
|
||||
search: false,
|
||||
page: false,
|
||||
height: 'full-110',
|
||||
cols: [[
|
||||
{ field: 'F_JobName', title: '任务名称', width: 150, sort: true },
|
||||
{ field: 'F_Description', title: '任务说明', minWwidth: 120, sort: true },
|
||||
{
|
||||
field: 'F_EnabledMark', title: '执行结果', width: 120, sort: true,
|
||||
templet: function (d) {
|
||||
if (d.F_EnabledMark == true) {
|
||||
return "<span class='layui-btn layui-btn-normal layui-btn-xs'>成功</span>";
|
||||
} else {
|
||||
return "<span class='layui-btn layui-btn-warm layui-btn-xs'>失败</span>";
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'F_CreatorTime', title: '执行时间', width: 160, sort: true,
|
||||
templet: function (d) {
|
||||
if (d.F_CreatorTime) {
|
||||
var time = new Date(d.F_CreatorTime);
|
||||
return time.Format("yyyy-MM-dd hh:mm:ss");
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
]],
|
||||
});
|
||||
// 监听搜索操作
|
||||
form.on('submit(data-search-btn)', function (data) {
|
||||
//执行搜索重载
|
||||
commonTable.reloadtable({
|
||||
elem: 'currentTableId',
|
||||
page: false,
|
||||
curr: 1,
|
||||
where: { keyword: data.field.txt_keyword }
|
||||
});
|
||||
return false;
|
||||
});
|
||||
form.on('submit(data-delete-btn)', function (data) {
|
||||
//执行搜索重载
|
||||
common.deleteForm({
|
||||
url: "/SystemSecurity/OpenJobs/DeleteLogForm",
|
||||
param: { keyValue: keyValue },
|
||||
success: function () {
|
||||
common.reload('data-search-btn');
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<fieldset class="table-search-fieldset">
|
||||
@*<legend>搜索信息</legend>*@
|
||||
<div>
|
||||
<form class="layui-form layui-form-pane" action="">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">关键字:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="txt_keyword" name="txt_keyword" autocomplete="off" class="layui-input" placeholder="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
|
||||
<button type="submit" class="layui-btn layui-btn-danger" lay-submit lay-filter="data-delete-btn"><i class="layui-icon"></i> 清 除</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</fieldset>
|
||||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
257
WaterCloud.Web/Areas/SystemSecurity/Views/OpenJobs/Form.cshtml
Normal file
257
WaterCloud.Web/Areas/SystemSecurity/Views/OpenJobs/Form.cshtml
Normal file
@@ -0,0 +1,257 @@
|
||||
@{
|
||||
ViewBag.Title = "Form";
|
||||
Layout = "~/Views/Shared/_Form.cshtml";
|
||||
}
|
||||
<body>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<div class="layui-form layuimini-form" lay-filter="adminform">
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label required">任务组名</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_JobGroup" name="F_JobGroup" maxlength="50" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label required">任务名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_JobName" name="F_JobName" maxlength="50" value="" lay-verify="required" class="layui-input ">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">任务类型</label>
|
||||
<div class="layui-input-block" id="F_JobType">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label required">文件名称</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_FileName" name="F_FileName" lay-verify="required">
|
||||
<option value="">==请选择==</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label required">请求地址</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_RequestUrl" name="F_RequestUrl" value="" lay-verify="required" class="layui-input ">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">请求头</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea id="F_RequestHeaders" name="F_RequestHeaders" autocomplete="off" class="layui-textarea" placeholder="JSON格式"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">请求参数</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea id="F_RequestString" name="F_RequestString" autocomplete="off" class="layui-textarea" placeholder="JSON格式"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label required">执行数据库</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_JobDBProvider" name="F_JobDBProvider">
|
||||
<option value="">==请选择==</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label required">执行SQL</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea id="F_JobSql" name="F_JobSql" value="" lay-verify="required" autocomplete="off" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">Sql参数</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea id="F_JobSqlParm" name="F_JobSqlParm" class="layui-textarea" autocomplete="off" placeholder="JSON格式"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label required">Cron表达式</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_CronExpress" name="F_CronExpress" maxlength="50" lay-verify="required" value="" class="layui-input ">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">选项</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="F_DoItNow" id="F_DoItNow" checked="" value="true" title="立即执行">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">是否记录日志</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="F_IsLog" id="F_IsLog" checked="" value="是" title="是">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text layui-hide">
|
||||
<label class="layui-form-label">备注</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea id="F_Description" name="F_Description" class="layui-textarea" placeholder="请输入备注"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<button class="layui-btn site-demo-active" lay-submit id="submit" lay-filter="saveBtn">确认保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
layui.use(['jquery', 'form', 'laydate', 'common', 'optimizeSelectOption', 'cron'], function () {
|
||||
var form = layui.form,
|
||||
$ = layui.$,
|
||||
common = layui.common,
|
||||
cron = layui.cron,
|
||||
laydate = layui.laydate;
|
||||
var keyValue = $.request("keyValue");
|
||||
//权限字段
|
||||
common.authorizeFields('adminform');
|
||||
$(function () {
|
||||
initControl();
|
||||
if (!!keyValue) {
|
||||
common.ajax({
|
||||
url: "/SystemSecurity/OpenJobs/GetFormJson",
|
||||
dataType: "json",
|
||||
data: { keyValue: keyValue },
|
||||
async: false,
|
||||
success: function (data) {
|
||||
common.val('adminform', data);
|
||||
if(data.F_IsLog=='是')
|
||||
{
|
||||
$('#F_IsLog').attr("checked", 'checked');
|
||||
}
|
||||
changeJobType(data.F_JobType);
|
||||
cron.render({
|
||||
elem: "#F_CronExpress", // 绑定元素
|
||||
value: data.F_CronExpress, // 默认值
|
||||
done: function (cronStr) { // 点击确定,或运行时,触发,参数为 cron 表达式字符串
|
||||
$("#F_CronExpress").val(cronStr);
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
changeJobType(0);
|
||||
cron.render({
|
||||
elem: "#F_CronExpress", // 绑定元素
|
||||
value: "0/20 * * * * ?", // 默认值
|
||||
done: function (cronStr) { // 点击确定,或运行时,触发,参数为 cron 表达式字符串
|
||||
$("#F_CronExpress").val(cronStr);
|
||||
},
|
||||
});
|
||||
}
|
||||
form.render();
|
||||
});
|
||||
wcLoading.close();
|
||||
function initControl() {
|
||||
$("#F_FileName").bindSelect({
|
||||
url: "/SystemSecurity/OpenJobs/QueryLocalHandlers",
|
||||
id: "Key",
|
||||
text:"Description"
|
||||
});
|
||||
$("#F_JobDBProvider").bindSelect({
|
||||
url: "/SystemSecurity/OpenJobs/GetDBListJson",
|
||||
id:""
|
||||
});
|
||||
$("#F_JobType").bindRadio({
|
||||
data: top.clients.dataItems["JobType"],
|
||||
id: ""
|
||||
});
|
||||
}
|
||||
form.on('radio(F_JobType)', function (data) {
|
||||
changeJobType(data.value);
|
||||
});
|
||||
function changeJobType(value) {
|
||||
if (value == "0") {
|
||||
$('#F_FileName').parent().parent().removeClass('layui-hide');
|
||||
$('#F_FileName').attr('lay-verify', 'required');
|
||||
$('#F_RequestUrl').parent().parent().addClass('layui-hide');
|
||||
$('#F_RequestUrl').removeAttr('lay-verify', 'required');
|
||||
$('#F_RequestHeaders').parent().parent().addClass('layui-hide');
|
||||
$('#F_RequestString').parent().parent().addClass('layui-hide');
|
||||
$('#F_RequestUrl').val("");
|
||||
$('#F_RequestHeaders').val("");
|
||||
$('#F_RequestString').val("");
|
||||
$('#F_JobDBProvider').parent().parent().addClass('layui-hide');
|
||||
$('#F_JobDBProvider').removeAttr('lay-verify', 'required');
|
||||
$('#F_JobSql').parent().parent().addClass('layui-hide');
|
||||
$('#F_JobSql').removeAttr('lay-verify', 'required');
|
||||
$('#F_JobSqlParm').parent().parent().addClass('layui-hide');
|
||||
$('#F_JobDBProvider').val("");
|
||||
$('#F_JobSql').val("");
|
||||
$('#F_JobSqlParm').val("");
|
||||
}
|
||||
else if(value == "5")
|
||||
{
|
||||
$('#F_RequestUrl').parent().parent().addClass('layui-hide');
|
||||
$('#F_RequestUrl').removeAttr('lay-verify', 'required');
|
||||
$('#F_RequestHeaders').parent().parent().addClass('layui-hide');
|
||||
$('#F_RequestString').parent().parent().addClass('layui-hide');
|
||||
$('#F_RequestUrl').val("");
|
||||
$('#F_RequestHeaders').val("");
|
||||
$('#F_RequestString').val("");
|
||||
$('#F_FileName').parent().parent().addClass('layui-hide');
|
||||
$('#F_FileName').removeAttr('lay-verify');
|
||||
$('#F_JobDBProvider').parent().parent().removeClass('layui-hide');
|
||||
$('#F_JobDBProvider').attr('lay-verify', 'required');
|
||||
$('#F_JobSql').parent().parent().removeClass('layui-hide');
|
||||
$('#F_JobSql').attr('lay-verify', 'required');
|
||||
$('#F_JobSqlParm').parent().parent().removeClass('layui-hide');
|
||||
}
|
||||
else {
|
||||
$('#F_FileName').parent().parent().addClass('layui-hide');
|
||||
$('#F_FileName').removeAttr('lay-verify');
|
||||
$('#F_RequestUrl').parent().parent().removeClass('layui-hide');
|
||||
$('#F_RequestUrl').attr('lay-verify', 'required');
|
||||
$('#F_RequestHeaders').parent().parent().removeClass('layui-hide');
|
||||
$('#F_RequestString').parent().parent().removeClass('layui-hide');
|
||||
$('#F_FileName').val("");
|
||||
$('#F_JobDBProvider').parent().parent().addClass('layui-hide');
|
||||
$('#F_JobDBProvider').removeAttr('lay-verify', 'required');
|
||||
$('#F_JobSql').parent().parent().addClass('layui-hide');
|
||||
$('#F_JobSql').removeAttr('lay-verify', 'required');
|
||||
$('#F_JobSqlParm').parent().parent().addClass('layui-hide');
|
||||
$('#F_JobDBProvider').val("");
|
||||
$('#F_JobSql').val("");
|
||||
$('#F_JobSqlParm').val("");
|
||||
}
|
||||
form.render();
|
||||
}
|
||||
//select验证
|
||||
form.verify({
|
||||
required: function (value, item) {
|
||||
var msg = "必填项不能为空";
|
||||
value = $.trim(value);
|
||||
var isEmpty = !value || value.length < 1;
|
||||
// 当前验证元素是select且为空时,将页面定位至layui渲染的select处,或自定义想定位的位置
|
||||
if (item.tagName == 'SELECT' && isEmpty) {
|
||||
$("html").animate({
|
||||
scrollTop: $(item).siblings(".layui-form-select").offset().top - 74
|
||||
}, 50);
|
||||
}
|
||||
if (isEmpty) {
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
});
|
||||
//监听提交
|
||||
form.on('submit(saveBtn)', function (data) {
|
||||
var postData = data.field;
|
||||
if (!postData["F_EnabledMark"]) postData["F_EnabledMark"] = false;
|
||||
if (!postData["F_IsLog"]) postData["F_IsLog"] = "否";
|
||||
common.submitForm({
|
||||
url: "/SystemSecurity/OpenJobs/SubmitForm?keyValue=" + keyValue,
|
||||
param: postData,
|
||||
success: function () {
|
||||
common.parentreload("data-search-btn");
|
||||
}
|
||||
})
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
320
WaterCloud.Web/Areas/SystemSecurity/Views/OpenJobs/Index.cshtml
Normal file
320
WaterCloud.Web/Areas/SystemSecurity/Views/OpenJobs/Index.cshtml
Normal file
@@ -0,0 +1,320 @@
|
||||
@{
|
||||
ViewBag.Title = "Index";
|
||||
Layout = "~/Views/Shared/_Index.cshtml";
|
||||
}
|
||||
<script>
|
||||
layui.use(['commonTable', 'form', 'table', 'common', 'optimizeSelectOption'], function () {
|
||||
var commonTable = layui.commonTable,
|
||||
form = layui.form,
|
||||
table = layui.table,
|
||||
common = layui.common;
|
||||
wcLoading.close();
|
||||
//权限控制(js是值传递)
|
||||
currentTableBar.innerHTML = common.authorizeButtonNew(currentTableBar.innerHTML);
|
||||
toolbarDemo.innerHTML = common.authorizeButtonNew(toolbarDemo.innerHTML);
|
||||
commonTable.rendertable({
|
||||
elem: '#currentTableId',
|
||||
id: 'currentTableId',
|
||||
url: '/SystemSecurity/OpenJobs/GetGridJson',
|
||||
page: false,
|
||||
cols: [[
|
||||
{ type: "radio", width: 50, fixed: 'left' },
|
||||
{ field: 'F_JobName', title: '名称', minWidth: 230, sort: true },
|
||||
{ field: 'F_JobGroup', title: '组名', minWidth: 180, sort: true },
|
||||
{ field: 'F_IsLog', title: '是否记录日志', width: 130, sort: true },
|
||||
{
|
||||
field: 'F_JobType', title: '类型', width: 100, sort: true,
|
||||
templet: function (d) {
|
||||
return top.clients.dataItems["JobType"][d.F_JobType] == undefined ? "" : top.clients.dataItems["JobType"][d.F_JobType];
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'F_EnabledMark', title: '任务状态', width: 110, sort: true,
|
||||
templet: function (d) {
|
||||
if (d.F_EnabledMark == true) {
|
||||
return "<span class='layui-btn layui-btn-normal layui-btn-xs'>有效</span>";
|
||||
} else {
|
||||
return "<span class='layui-btn layui-btn-warm layui-btn-xs'>无效</span>";
|
||||
}
|
||||
}
|
||||
},
|
||||
{ field: 'F_LastRunTime', title: '最近执行时间', width: 160, sort: true },
|
||||
{ field: 'NextValidTimeAfter', title: '下次执行时间', width: 160 },
|
||||
{
|
||||
field: 'F_LastRunMark', title: '最近执行状态', width: 130, sort: true,
|
||||
templet: function (d) {
|
||||
if (d.F_LastRunMark == true) {
|
||||
return "<span class='layui-btn layui-btn-normal layui-btn-xs'>成功</span>";
|
||||
} else {
|
||||
return "<span class='layui-btn layui-btn-warm layui-btn-xs'>失败</span>";
|
||||
}
|
||||
}
|
||||
},
|
||||
{ field: 'F_LastRunErrTime', title: '上次发生错误时间', width: 160, sort: true },
|
||||
{ field: 'F_LastRunErrMsg', title: '上次发生错误信息', width: 180, sort: true },
|
||||
{ field: 'F_StarRunTime', title: '最近启动时间', width: 170, sort: true },
|
||||
{ field: 'F_EndRunTime', title: '最近关闭时间', width: 170, sort: true },
|
||||
{ field: 'F_FileName', title: '文件名', width: 180, sort: true ,hide:true},
|
||||
{ field: 'F_RequestUrl', title: '请求地址', width: 180, sort: true ,hide:true},
|
||||
{ field: 'F_RequestHeaders', title: '请求头', width: 180, sort: true ,hide:true },
|
||||
{ field: 'F_RequestString', title: '请求参数', width: 180, sort: true ,hide:true},
|
||||
{ field: 'F_JobDBProvider', title: '执行数据库', width: 180, sort: true ,hide:true},
|
||||
{ field: 'F_JobSql', title: '执行SQL', width: 180, sort: true ,hide:true},
|
||||
{ field: 'F_JobSqlParm', title: 'Sql参数', width: 180, sort: true ,hide:true },
|
||||
{ field: 'F_CronExpress', title: 'CRON', width: 150 },
|
||||
{ field: 'F_Description', title: '备注', width: 150, sort: true },
|
||||
{ title: '操作', width: 300, toolbar: '#currentTableBar', align: "center", fixed: 'right' }
|
||||
|
||||
]]
|
||||
});
|
||||
// 监听搜索操作
|
||||
form.on('submit(data-search-btn)', function (data) {
|
||||
//执行搜索重载
|
||||
commonTable.reloadtable({
|
||||
elem: 'currentTableId',
|
||||
page: false,
|
||||
curr: 1,
|
||||
where: { keyword: data.field.txt_keyword }
|
||||
});
|
||||
return false;
|
||||
});
|
||||
//行点击事件监听,控制按钮显示
|
||||
var oneList = ["NF-edit", "NF-delete", "NF-disabled", "NF-enabled", "NF-edit", "NF-log", "NF-doNow"];//选择1条显示
|
||||
commonTable.tableRowClick("radio", "currentTableFilter", "currentTableId", oneList);
|
||||
/**
|
||||
* toolbar监听事件
|
||||
*/
|
||||
table.on('toolbar(currentTableFilter)', function (obj) {
|
||||
var data = table.checkStatus('currentTableId').data;
|
||||
if (obj.event === 'add') { // 监听删除操作
|
||||
common.modalOpen({
|
||||
title: "添加任务",
|
||||
url: "/SystemSecurity/OpenJobs/Form",
|
||||
width: "750px",
|
||||
height: "650px",
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'delete') {
|
||||
if (data.length == 0) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.deleteForm({
|
||||
url: "/SystemSecurity/OpenJobs/DeleteForm",
|
||||
param: { keyValue: data[0].F_Id },
|
||||
success: function () {
|
||||
common.reload('data-search-btn');
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
if (data.length == 0) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.modalOpen({
|
||||
title: "修改任务",
|
||||
url: "/SystemSecurity/OpenJobs/Form?keyValue=" + data[0].F_Id,
|
||||
width: "750px",
|
||||
height: "650px",
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'clear') {
|
||||
common.submitPost({
|
||||
prompt: "注:您确定要【清除所有任务计划】吗?",
|
||||
url: "/SystemSecurity/OpenJobs/ClearScheduleJob",
|
||||
success: function () {
|
||||
common.reload('data-search-btn');
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'doNow') {
|
||||
if (data.length == 0) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.submitPost({
|
||||
prompt: "注:您确定要【执行】该项任务吗?",
|
||||
url: "/SystemSecurity/OpenJobs/DoNow",
|
||||
param: { keyValue: data[0].F_Id },
|
||||
success: function () {
|
||||
common.reload('data-search-btn');
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'disabled') {
|
||||
if (data.length == 0) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
if (data[0].F_EnabledMark != true) {
|
||||
common.modalMsg("任务未启动,无法关闭!", "warning");
|
||||
return false;
|
||||
}
|
||||
common.submitPost({
|
||||
prompt: "注:您确定要【关闭】该项任务吗?",
|
||||
url: "/SystemSecurity/OpenJobs/ChangeStatus",
|
||||
param: { keyValue: data[0].F_Id, status: 0 },
|
||||
success: function () {
|
||||
common.reload('data-search-btn');
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'enabled') {
|
||||
if (data.length == 0) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
if (data[0].F_EnabledMark == true) {
|
||||
common.modalMsg("任务已启动,无法启动!", "warning");
|
||||
return false;
|
||||
}
|
||||
common.submitPost({
|
||||
prompt: "注:您确定要【启动】该项任务吗?",
|
||||
url: "/SystemSecurity/OpenJobs/ChangeStatus",
|
||||
param: { keyValue: data[0].F_Id, status: 1 },
|
||||
success: function () {
|
||||
common.reload('data-search-btn');
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'log') {
|
||||
if (data.length == 0) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.modalOpen({
|
||||
title: "任务日志",
|
||||
url: "/SystemSecurity/OpenJobs/Details?keyValue=" + data[0].F_Id,
|
||||
width: "700px",
|
||||
height: "600px",
|
||||
btn: []
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'TABLE_SEARCH') {
|
||||
var _that = $("#searchField");
|
||||
if (_that.hasClass("layui-hide")) {
|
||||
_that.removeClass('layui-hide');
|
||||
} else {
|
||||
_that.addClass('layui-hide');
|
||||
}
|
||||
table.resize();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
//toolrow监听事件
|
||||
table.on('tool(currentTableFilter)', function (obj) {
|
||||
if (obj.event === 'delete') {
|
||||
common.deleteForm({
|
||||
url: "/SystemSecurity/OpenJobs/DeleteForm",
|
||||
param: { keyValue: obj.data.F_Id },
|
||||
success: function () {
|
||||
obj.del();
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
common.modalOpen({
|
||||
title: "修改任务",
|
||||
url: "/SystemSecurity/OpenJobs/Form?keyValue=" + obj.data.F_Id,
|
||||
width: "750px",
|
||||
height: "650px",
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'doNow') {
|
||||
common.submitPost({
|
||||
prompt: "注:您确定要【执行】该项任务吗?",
|
||||
url: "/SystemSecurity/OpenJobs/DoNow",
|
||||
param: { keyValue: obj.data.F_Id },
|
||||
success: function () {
|
||||
common.reload('data-search-btn');
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'disabled') {
|
||||
if (obj.data.F_EnabledMark != true) {
|
||||
common.modalMsg("任务未启动,无法关闭!", "warning");
|
||||
return false;
|
||||
}
|
||||
common.submitPost({
|
||||
prompt: "注:您确定要【关闭】该项任务吗?",
|
||||
url: "/SystemSecurity/OpenJobs/ChangeStatus",
|
||||
param: { keyValue: obj.data.F_Id, status: 0 },
|
||||
success: function () {
|
||||
common.reload('data-search-btn');
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'enabled') {
|
||||
if (obj.data.F_EnabledMark == true) {
|
||||
common.modalMsg("任务已启动,无法启动!", "warning");
|
||||
return false;
|
||||
}
|
||||
common.submitPost({
|
||||
prompt: "注:您确定要【启动】该项任务吗?",
|
||||
url: "/SystemSecurity/OpenJobs/ChangeStatus",
|
||||
param: { keyValue: obj.data.F_Id, status: 1 },
|
||||
success: function () {
|
||||
common.reload('data-search-btn');
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'log') {
|
||||
common.modalOpen({
|
||||
title: "任务日志",
|
||||
url: "/SystemSecurity/OpenJobs/Details?keyValue=" + obj.data.F_Id,
|
||||
width: "700px",
|
||||
height: "600px",
|
||||
btn: []
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
|
||||
<fieldset class="table-search-fieldset layui-hide" id="searchField">
|
||||
@*<legend>搜索信息</legend>*@
|
||||
<div>
|
||||
<form class="layui-form layui-form-pane" action="">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">关键字:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="txt_keyword" name="txt_keyword" autocomplete="off" class="layui-input" placeholder="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container" id="toolbar">
|
||||
<button id="NF-clear" name="NF-clear" authorize class="layui-btn layui-btn-sm" lay-event="clear"><i class="layui-icon"></i>清除任务计划</button>
|
||||
<button id="NF-add" name="NF-add" authorize class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon"></i>新增</button>
|
||||
<button id="NF-edit" name="NF-edit" authorize class="layui-btn layui-btn-sm layui-btn-warm layui-hide" lay-event="edit"><i class="layui-icon"></i>修改</button>
|
||||
<button id="NF-delete" name="NF-delete" authorize class="layui-btn layui-btn-sm layui-btn-danger layui-hide" lay-event="delete"> <i class="layui-icon"></i>删除</button>
|
||||
<button id="NF-doNow" name="NF-doNow" authorize class="layui-btn layui-btn-sm layui-btn-normal layui-hide" lay-event="doNow"><i class="layui-icon"></i>执行</button>
|
||||
<button id="NF-enabled" name="NF-enabled" authorize class="layui-btn layui-btn-sm layui-hide" lay-event="enabled"> <i class="fa fa-play-circle"></i>启动</button>
|
||||
<button id="NF-disabled" name="NF-disabled" authorize class="layui-btn layui-btn-sm layui-btn-danger layui-hide" lay-event="disabled"><i class="fa fa-stop-circle"></i>关闭</button>
|
||||
<button id="NF-log" name="NF-log" authorize class="layui-btn layui-btn-sm layui-btn-normal layui-hide" lay-event="log"><i class="layui-icon"></i>日志</button>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="currentTableBar">
|
||||
<a id="NF-edit" authorize class="layui-btn layui-btn-xs layui-btn-warm" lay-event="edit">修改</a>
|
||||
<a id="NF-delete" authorize class="layui-btn layui-btn-xs layui-btn-danger" lay-event="delete">删除</a>
|
||||
<a id="NF-doNow" authorize class="layui-btn layui-btn-xs layui-btn-normal" lay-event="doNow">执行</a>
|
||||
<a id="NF-enabled" authorize class="layui-btn layui-btn-xs" lay-event="enabled">启用</a>
|
||||
<a id="NF-disabled" authorize class="layui-btn layui-btn-danger layui-btn-xs" lay-event="disabled">禁用</a>
|
||||
<a id="NF-log" authorize class="layui-btn layui-btn-xs layui-btn-normal" lay-event="log">日志</a>
|
||||
</script>
|
||||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,403 @@
|
||||
@{
|
||||
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 class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header"><i class="fa fa-warning icon"></i>状态信息</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="welcome-module">
|
||||
<div class="layui-row layui-col-space10">
|
||||
<div class="layui-col-xs6">
|
||||
<div class="panel layui-bg-number" style="height:200px">
|
||||
<div class="panel-body">
|
||||
<div class="panel-title">
|
||||
<span class="label pull-right layui-bg-blue">实时</span>
|
||||
<h5>CPU使用率</h5>
|
||||
</div>
|
||||
<div class="panel-content">
|
||||
<h1 class="no-margins" id="cpucout"></h1>
|
||||
<small>当前记录</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-xs6">
|
||||
<div class="panel layui-bg-number" style="height:200px">
|
||||
<div class="panel-body">
|
||||
<div class="panel-title">
|
||||
<span class="label pull-right layui-bg-cyan">实时</span>
|
||||
<h5>ARM使用率</h5>
|
||||
</div>
|
||||
<div class="panel-content">
|
||||
<h1 class="no-margins" id="armcout"></h1>
|
||||
<small>当前记录</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header"><i class="fa fa-line-chart icon"></i>报表统计</div>
|
||||
<div class="layui-card-body">
|
||||
<div id="echarts-records" style="width: 100%;min-height:220px"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header"><i class="fa fa-fire icon"></i>服务器信息</div>
|
||||
<div class="layui-card-body layui-text">
|
||||
<table class="layui-table">
|
||||
<colgroup>
|
||||
<col width="100">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>服务器名称</td>
|
||||
<td>
|
||||
@Environment.MachineName
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>总内存</td>
|
||||
<td><span id="TotalRAM"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>操作系统</td>
|
||||
<td>@System.Runtime.InteropServices.RuntimeInformation.OSDescription</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>系统架构</td>
|
||||
<td>@System.Runtime.InteropServices.RuntimeInformation.OSArchitecture</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>外网IP</td>
|
||||
<td>
|
||||
<span id="OutIP"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header"><i class="fa fa-fire icon"></i>.NET信息</div>
|
||||
<div class="layui-card-body layui-text">
|
||||
<table class="layui-table">
|
||||
<colgroup>
|
||||
<col width="100">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>环境变量</td>
|
||||
<td>@Html.Raw(env.EnvironmentName)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ContentRootPath</td>
|
||||
<td>
|
||||
@Html.Raw(env.ContentRootPath)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>WebRootPath</td>
|
||||
<td>@Html.Raw(env.WebRootPath)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>.NET版本</td>
|
||||
<td>
|
||||
@Html.Raw(System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>启动时间</td>
|
||||
<td>
|
||||
@System.Diagnostics.Process.GetCurrentProcess().StartTime.ToString("yyyy-MM-dd HH:mm:ss")
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user