完善日志管理列表

pull/65/head
TSQ 4 years ago
parent 928dad93b4
commit 306724a394

@ -15,7 +15,7 @@ import org.springframework.stereotype.Controller;
*/ */
@Controller @Controller
@Slf4j @Slf4j
@ApiResource(name = "操作日志管理相关的界面渲染", path = "log") @ApiResource(name = "操作日志管理相关的界面渲染", path = "/view/log")
public class LogViewController { public class LogViewController {
private String PREFIX = "/modular/system/log"; private String PREFIX = "/modular/system/log";

@ -1,31 +1,32 @@
layui.use(['layer', 'table', 'ax', 'laydate'], function () { layui.use(['HttpRequest', 'treeTable', 'laydate', 'func' ,'form'], function () {
var $ = layui.$; var $ = layui.$;
var $ax = layui.ax;
var layer = layui.layer;
var table = layui.table; var table = layui.table;
var HttpRequest = layui.HttpRequest;
var func = layui.func;
var form = layui.form;
var laydate = layui.laydate; var laydate = layui.laydate;
/** /**
* 系统管理--操作日志 * 系统管理--操作日志
*/ */
var LoginLog = { var Log = {
tableId: "logTable" //表格id tableId: "logTable" //表格id
}; };
/** /**
* 初始化表格的列 * 初始化表格的列
*/ */
LoginLog.initColumn = function () { Log.initColumn = function () {
return [[ return [[
{type: 'checkbox'}, {type: 'checkbox'},
{field: 'operationLogId', hide: true, sort: true, title: 'id'}, {field: 'logId', hide: true, sort: true, title: 'id'},
{field: 'logType', align: "center", sort: true, title: '日志类型'}, /*{field: 'logType', align: "center", sort: true, title: '日志类型'},*/
{field: 'logName', align: "center", sort: true, title: '日志名称'}, {field: 'logName', align: "center", sort: true, title: '日志名称'},
{field: 'userName', align: "center", sort: true, title: '用户名称'}, {field: 'createUser', align: "center", sort: true, title: '用户名称'},
{field: 'className', align: "center", sort: true, title: '名'}, {field: 'appName', align: "center", sort: true, title: '服务器名'},
{field: 'method', align: "center", sort: true, title: '方法名'}, {field: 'requestUrl', align: "center", sort: true, title: '方法名'},
{field: 'createTime', align: "center", sort: true, title: '时间'}, {field: 'createTime', align: "center", sort: true, title: '时间'},
{field: 'regularMessage', align: "center", sort: true, title: '具体消息'}, {field: 'logContent', align: "center", sort: true, title: '具体消息'},
{align: 'center', toolbar: '#tableBar', title: '操作', minWidth: 100} {align: 'center', toolbar: '#tableBar', title: '操作', minWidth: 100}
]]; ]];
}; };
@ -33,13 +34,13 @@ layui.use(['layer', 'table', 'ax', 'laydate'], function () {
/** /**
* 点击查询按钮 * 点击查询按钮
*/ */
LoginLog.search = function () { Log.search = function () {
var queryData = {}; var queryData = {};
queryData['beginTime'] = $("#beginTime").val(); queryData['beginDateTime'] = $("#beginTime").val();
queryData['endTime'] = $("#endTime").val(); queryData['endDateTime'] = $("#endTime").val();
queryData['logName'] = $("#logName").val(); queryData['logName'] = $("#logName").val();
queryData['logType'] = $("#logType").val(); // queryData['logType'] = $("#logType").val();
table.reload(LoginLog.tableId, { table.reload(Log.tableId, {
where: queryData, page: {curr: 1} where: queryData, page: {curr: 1}
}); });
}; };
@ -47,79 +48,81 @@ layui.use(['layer', 'table', 'ax', 'laydate'], function () {
/** /**
* 导出excel按钮 * 导出excel按钮
*/ */
LoginLog.exportExcel = function () { // Log.exportExcel = function () {
var checkRows = table.checkStatus(LoginLog.tableId); // var checkRows = table.checkStatus(Log.tableId);
if (checkRows.data.length === 0) { // if (checkRows.data.length === 0) {
Feng.error("请选择要导出的数据"); // Feng.error("请选择要导出的数据");
} else { // } else {
table.exportFile(tableResult.config.id, checkRows.data, 'xls'); // table.exportFile(tableResult.config.id, checkRows.data, 'xls');
} // }
}; // };
/** /**
* 日志详情 * 日志详情
*/ */
LoginLog.logDetail = function (param) { // Log.logDetail = function (param) {
var ajax = new $ax(Feng.ctxPath + "/log/detail/" + param.operationLogId, function (data) { // var ajax = new $ax(Feng.ctxPath + "/log/detail/" + param.operationLogId, function (data) {
Feng.infoDetail("日志详情", data.regularMessage); // Feng.infoDetail("日志详情", data.regularMessage);
}, function (data) { // }, function (data) {
Feng.error("获取详情失败!"); // Feng.error("获取详情失败!");
}); // });
ajax.start(); // ajax.start();
}; // };
/** /**
* 清空日志 * 清空日志
*/ */
LoginLog.cleanLog = function () { // Log.cleanLog = function () {
Feng.confirm("是否清空所有日志?", function () { // Feng.confirm("是否清空所有日志?", function () {
var ajax = new $ax(Feng.ctxPath + "/log/delLog", function (data) { // var ajax = new $ax(Feng.ctxPath + "/log/delLog", function (data) {
Feng.success("清空日志成功!"); // Feng.success("清空日志成功!");
LoginLog.search(); // Log.search();
}, function (data) { // }, function (data) {
Feng.error("清空日志失败!"); // Feng.error("清空日志失败!");
}); // });
ajax.start(); // ajax.start();
}); // });
}; // };
//渲染时间选择框 // 渲染时间选择框
laydate.render({ laydate.render({
elem: '#beginTime' elem: '#createTime'
}); });
//渲染时间选择框 // 渲染时间选择框
laydate.render({ // laydate.render({
elem: '#endTime' // elem: '#createTime'
}); // });
// 渲染表格 // 渲染表格
var tableResult = table.render({ var tableResult = table.render({
elem: '#' + LoginLog.tableId, elem: '#' + Log.tableId,
url: Feng.ctxPath + '/log/list', url: Feng.ctxPath + '/logManager/page',
page: true, page: true,
height: "full-98", height: "full-158",
cellMinWidth: 100, cellMinWidth: 100,
cols: LoginLog.initColumn() cols: Log.initColumn(),
request: {pageName: 'pageNo', limitName: 'pageSize'},
parseData: Feng.parseData
}); });
// 搜索按钮点击事件 // 搜索按钮点击事件
$('#btnSearch').click(function () { $('#btnSearch').click(function () {
LoginLog.search(); Log.search();
}); });
// 搜索按钮点击事件 // 搜索按钮点击事件
$('#btnClean').click(function () { // $('#btnClean').click(function () {
LoginLog.cleanLog(); // Log.cleanLog();
}); // });
// 工具条点击事件 // 工具条点击事件
table.on('tool(' + LoginLog.tableId + ')', function (obj) { // table.on('tool(' + Log.tableId + ')', function (obj) {
var data = obj.data; // var data = obj.data;
var layEvent = obj.event; // var layEvent = obj.event;
//
if (layEvent === 'detail') { // if (layEvent === 'detail') {
LoginLog.logDetail(data); // Log.logDetail(data);
} // }
}); // });
}); });

@ -20,19 +20,18 @@
<div class="layui-inline"> <div class="layui-inline">
<input id="logName" class="layui-input" type="text" placeholder="日志名称"/> <input id="logName" class="layui-input" type="text" placeholder="日志名称"/>
</div> </div>
<div class="layui-inline"> <!-- <div class="layui-inline">
<select id="logType"> <select id="logType">
<option value="">类型</option> <option value="">类型</option>
<option value="0">全部</option> <option value="0">全部</option>
<option value="1">业务日志</option> <option value="1">业务日志</option>
<option value="2">异常日志</option> <option value="2">异常日志</option>
</select> </select>
</div> </div>-->
<div class="layui-inline"> <div class="layui-inline">
<button id="btnSearch" class="layui-btn icon-btn"><i class="layui-icon">&#xe615;</i>搜索</button> <button id="btnSearch" class="layui-btn icon-btn"><i class="layui-icon">&#xe615;</i>搜索</button>
@if(shiro.hasPermission("/log/delLog")){
<button id="btnClean" class="layui-btn icon-btn layui-btn-danger"><i class="layui-icon">&#xe67d;</i>清空日志</button> <button id="btnClean" class="layui-btn icon-btn layui-btn-danger"><i class="layui-icon">&#xe67d;</i>清空日志</button>
@}
</div> </div>
</div> </div>
</div> </div>
@ -42,7 +41,9 @@
</div> </div>
</div> </div>
</div> </div>
<script type="text/html" id="tableBar"> <script type="text/html" id="tableBar">
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看详情</a> <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看详情</a>
</script> </script>
@} @}
Loading…
Cancel
Save