Files
HTCloud/HT.Cloud.Web/Areas/SystemSecurity/Views/Log/Index.cshtml
2023-03-27 13:54:04 +08:00

158 lines
7.1 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.

@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Index.cshtml";
}
<!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">
<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-removelog" authorize="yes" class="layui-btn layui-btn-sm layui-btn-danger" lay-event="removelog"><i class="layui-icon">&#xe640;</i>清空日志</button>*@
</div>
</script>
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
</div>
</div>
<script>
layui.use(['jquery', 'form', 'table', 'common', 'optimizeSelectOption', 'commonTable'], function () {
var $ = layui.jquery,
form = layui.form,
table = layui.table,
commonTable = layui.commonTable,
common = layui.common;
//加载数据
wcLoading.close();
//权限控制(js是值传递)
toolbarDemo.innerHTML = common.authorizeButtonNew(toolbarDemo.innerHTML);
commonTable.rendertable({
elem: '#currentTableId',
id: 'currentTableId',
url: '/SystemSecurity/Log/GetGridJson',
cols: [[
{ field: 'F_Account', title: '账户', width: 150, sort: true },
{ field: 'F_NickName', title: '姓名', width: 120, sort: true },
{ field: 'F_ModuleName', title: '操作菜单', width: 220, sort: true },
{
field: 'F_Type', title: '操作类型', width: 120, sort: true,
templet: function (d) {
return top.clients.dataItems["DbLogType"][d.F_Type] == undefined ? "" : top.clients.dataItems["DbLogType"][d.F_Type]
}
},
{
field: 'F_IPAddress', title: 'IP地址', width: 200,
templet: function (d) {
return d.F_IPAddress + ";" + d.F_IPAddressName;
}, sort: true
},
{ field: 'F_KeyValue', title: '操作对象', width: 300, hide: true },
{
field: 'F_CreatorTime', title: '创建时间', width: 180, sort: true,
templet: function (d) {
if (d.F_CreatorTime) {
return new Date(d.F_CreatorTime).Format("yyyy-MM-dd hh:mm:ss");
}
return '';
}
},
{ field: 'F_Description', title: '备注', minWidth: 250 },
]],
limit:17
});
//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) {
var queryJson = JSON.stringify(data.field);
//执行搜索重载
commonTable.reloadtable({
elem: 'currentTableId',
curr: 1,
where: { timetype: data.field.time_horizon, keyword: data.field.txt_keyword }
});
return false;
});
/**
* toolbar监听事件
*/
table.on('toolbar(currentTableFilter)', function (obj) {
if (obj.event === 'removelog') { // 监听删除操作
common.modalOpen({
title: "清空日志",
url: "/SystemSecurity/Log/RemoveLog",
width: "300px",
height: "200px",
});
}
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;
});
});
</script>
</body>
</html>