From 329afc5f456131509199b9c5a7c7a556cd669e9d Mon Sep 17 00:00:00 2001 From: TSQ <1970742763@qq.com> Date: Tue, 12 Jan 2021 13:47:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=97=A5=E5=BF=97=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=88=97=E8=A1=A8=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=AE=8C?= =?UTF-8?q?=E5=96=84=E6=9F=A5=E7=9C=8B=E8=AF=A6=E6=83=85=EF=BC=8C=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=97=A5=E5=BF=97=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../guns/modular/log/LogViewController.java | 11 ++ .../webapp/assets/modular/system/log/log.js | 80 +++++------ .../assets/modular/system/log/log_deatil.js | 19 +++ .../pages/modular/system/log/log_detail.html | 125 ++++++++++++++++++ 4 files changed, 195 insertions(+), 40 deletions(-) create mode 100644 src/main/webapp/assets/modular/system/log/log_deatil.js create mode 100644 src/main/webapp/pages/modular/system/log/log_detail.html diff --git a/src/main/java/cn/stylefeng/guns/modular/log/LogViewController.java b/src/main/java/cn/stylefeng/guns/modular/log/LogViewController.java index 957f770e..afb2ccd5 100644 --- a/src/main/java/cn/stylefeng/guns/modular/log/LogViewController.java +++ b/src/main/java/cn/stylefeng/guns/modular/log/LogViewController.java @@ -27,4 +27,15 @@ public class LogViewController { return "/modular/system/log/log.html"; } + /** + * 操作日志管理列表 + * + * @author TSQ + * @date 2021/1/5 15:18 + */ + @GetResource(name = "日志详情页", path = "/view/logDetail") + public String detailView() { + return "/modular/system/log/log_detail.html"; + } + } diff --git a/src/main/webapp/assets/modular/system/log/log.js b/src/main/webapp/assets/modular/system/log/log.js index 9de2c030..0e913bea 100644 --- a/src/main/webapp/assets/modular/system/log/log.js +++ b/src/main/webapp/assets/modular/system/log/log.js @@ -18,14 +18,14 @@ layui.use(['HttpRequest', 'treeTable', 'laydate', 'func' ,'form'], function () { */ Log.initColumn = function () { return [[ - {type: 'checkbox'}, + {type: 'numbers'}, {field: 'logId', hide: true, sort: true, title: 'id'}, - /*{field: 'logType', align: "center", sort: true, title: '日志类型'},*/ {field: 'logName', align: "center", sort: true, title: '日志名称'}, {field: 'createUser', align: "center", sort: true, title: '用户名称'}, {field: 'appName', align: "center", sort: true, title: '服务器名'}, - {field: 'requestUrl', align: "center", sort: true, title: '方法名'}, - {field: 'createTime', align: "center", sort: true, title: '时间'}, + {field: 'clientIp', align: "center", sort: true, title: 'IP'}, + {field: 'requestUrl', align: "center", sort: true, title: '请求地址'}, + {field: 'createTime', align: "center", sort: true, title: '创建时间'}, {field: 'logContent', align: "center", sort: true, title: '具体消息'}, {align: 'center', toolbar: '#tableBar', title: '操作', minWidth: 100} ]]; @@ -60,40 +60,40 @@ layui.use(['HttpRequest', 'treeTable', 'laydate', 'func' ,'form'], function () { /** * 日志详情 */ - // Log.logDetail = function (param) { - // var ajax = new $ax(Feng.ctxPath + "/log/detail/" + param.operationLogId, function (data) { - // Feng.infoDetail("日志详情", data.regularMessage); - // }, function (data) { - // Feng.error("获取详情失败!"); - // }); - // ajax.start(); - // }; + Log.logDetail = function (data) { + func.open({ + height: 800, + title: '查看日志详情', + content: Feng.ctxPath + '/view/logDetail?logId='+ data.logId, + tableId: Log.tableId + }); + }; /** * 清空日志 */ - // Log.cleanLog = function () { - // Feng.confirm("是否清空所有日志?", function () { - // var ajax = new $ax(Feng.ctxPath + "/log/delLog", function (data) { - // Feng.success("清空日志成功!"); - // Log.search(); - // }, function (data) { - // Feng.error("清空日志失败!"); - // }); - // ajax.start(); - // }); - // }; + Log.cleanLog = function (data) { + var deleteLog = function () { + var dataList = layui.table.cache["logTable"]; + var httpRequest = new HttpRequest(Feng.ctxPath + "/logManager/delete", 'post', function () { + Feng.success("清空日志成功!"); + table.reload(Log.tableId); + }, function (data) { + Feng.error("清空日志失败!" + data.responseJSON.message + "!"); + }); + httpRequest.set("appName",dataList[0].appName); + httpRequest.set("beginDateTime",dataList[dataList.length-1].createTime); + httpRequest.set("endDateTime",dataList[0].createTime); + httpRequest.start(true); + }; + Feng.confirm("是否删除?", deleteLog); + }; // 渲染时间选择框 laydate.render({ elem: '#createTime' }); - // 渲染时间选择框 - // laydate.render({ - // elem: '#createTime' - // }); - // 渲染表格 var tableResult = table.render({ elem: '#' + Log.tableId, @@ -111,18 +111,18 @@ layui.use(['HttpRequest', 'treeTable', 'laydate', 'func' ,'form'], function () { Log.search(); }); - // 搜索按钮点击事件 - // $('#btnClean').click(function () { - // Log.cleanLog(); - // }); + //点击清空日志事件 + $('#btnClean').click(function () { + Log.cleanLog(); + }); // 工具条点击事件 - // table.on('tool(' + Log.tableId + ')', function (obj) { - // var data = obj.data; - // var layEvent = obj.event; - // - // if (layEvent === 'detail') { - // Log.logDetail(data); - // } - // }); + table.on('tool(' + Log.tableId + ')', function (obj) { + var data = obj.data; + var layEvent = obj.event; + + if (layEvent === 'detail') { + Log.logDetail(data); + } + }); }); diff --git a/src/main/webapp/assets/modular/system/log/log_deatil.js b/src/main/webapp/assets/modular/system/log/log_deatil.js new file mode 100644 index 00000000..6766f711 --- /dev/null +++ b/src/main/webapp/assets/modular/system/log/log_deatil.js @@ -0,0 +1,19 @@ +/** + * 详情对话框 + */ +var SysLogInfoDlg = { + data: { + logId: "", + } +}; + +layui.use(['layer', 'form', 'admin', 'laydate', 'HttpRequest', 'iconPicker'], function () { + var $ = layui.jquery; + var HttpRequest = layui.HttpRequest; + var form = layui.form; + + //获取菜单信息 + var request = new HttpRequest(Feng.ctxPath + "/logManager/detail?logId=" + Feng.getUrlParam("logId"), 'get'); + var sysLogResult = request.start(); + form.val('sysLogForm', sysLogResult.data); +}); diff --git a/src/main/webapp/pages/modular/system/log/log_detail.html b/src/main/webapp/pages/modular/system/log/log_detail.html new file mode 100644 index 00000000..b00b7be2 --- /dev/null +++ b/src/main/webapp/pages/modular/system/log/log_detail.html @@ -0,0 +1,125 @@ +@layout("/layout/_container.html",{js:["/assets/modular/system/log/log_deatil.js"]}){ + +
+ 日志详情 +
+
+
+
+
+
+
+
+ + + +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ + +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+
+
+
+
+
+
+ +
+@}