提交 | 用户 | 时间
|
8286c6
|
1 |
layui.use(['layer', 'table', 'ax', 'laydate'], function () { |
懒 |
2 |
var $ = layui.$; |
|
3 |
var $ax = layui.ax; |
|
4 |
var layer = layui.layer; |
|
5 |
var table = layui.table; |
|
6 |
var laydate = layui.laydate; |
|
7 |
|
|
8 |
/** |
|
9 |
* 系统管理--操作日志 |
|
10 |
*/ |
|
11 |
var LoginLog = { |
|
12 |
tableId: "logTable" //表格id |
|
13 |
}; |
|
14 |
|
|
15 |
/** |
|
16 |
* 初始化表格的列 |
|
17 |
*/ |
|
18 |
LoginLog.initColumn = function () { |
|
19 |
return [[ |
|
20 |
{type: 'checkbox'}, |
|
21 |
{field: 'operationLogId', hide: true, sort: true, title: 'id'}, |
|
22 |
{field: 'logType', align: "center", sort: true, title: '日志类型'}, |
|
23 |
{field: 'logName', align: "center", sort: true, title: '日志名称'}, |
|
24 |
{field: 'userName', align: "center", sort: true, title: '用户名称'}, |
|
25 |
{field: 'className', align: "center", sort: true, title: '类名'}, |
|
26 |
{field: 'method', align: "center", sort: true, title: '方法名'}, |
|
27 |
{field: 'createTime', align: "center", sort: true, title: '时间'}, |
|
28 |
{field: 'regularMessage', align: "center", sort: true, title: '具体消息'}, |
|
29 |
{align: 'center', toolbar: '#tableBar', title: '操作', minWidth: 100} |
|
30 |
]]; |
|
31 |
}; |
|
32 |
|
|
33 |
/** |
|
34 |
* 点击查询按钮 |
|
35 |
*/ |
|
36 |
LoginLog.search = function () { |
|
37 |
var queryData = {}; |
|
38 |
queryData['beginTime'] = $("#beginTime").val(); |
|
39 |
queryData['endTime'] = $("#endTime").val(); |
|
40 |
queryData['logName'] = $("#logName").val(); |
|
41 |
queryData['logType'] = $("#logType").val(); |
|
42 |
table.reload(LoginLog.tableId, { |
|
43 |
where: queryData, page: {curr: 1} |
|
44 |
}); |
|
45 |
}; |
|
46 |
|
|
47 |
/** |
|
48 |
* 导出excel按钮 |
|
49 |
*/ |
|
50 |
LoginLog.exportExcel = function () { |
|
51 |
var checkRows = table.checkStatus(LoginLog.tableId); |
|
52 |
if (checkRows.data.length === 0) { |
|
53 |
Feng.error("请选择要导出的数据"); |
|
54 |
} else { |
|
55 |
table.exportFile(tableResult.config.id, checkRows.data, 'xls'); |
|
56 |
} |
|
57 |
}; |
|
58 |
|
|
59 |
/** |
|
60 |
* 日志详情 |
|
61 |
*/ |
|
62 |
LoginLog.logDetail = function (param) { |
|
63 |
var ajax = new $ax(Feng.ctxPath + "/log/detail/" + param.operationLogId, function (data) { |
|
64 |
Feng.infoDetail("日志详情", data.regularMessage); |
|
65 |
}, function (data) { |
|
66 |
Feng.error("获取详情失败!"); |
|
67 |
}); |
|
68 |
ajax.start(); |
|
69 |
}; |
|
70 |
|
|
71 |
/** |
|
72 |
* 清空日志 |
|
73 |
*/ |
|
74 |
LoginLog.cleanLog = function () { |
|
75 |
Feng.confirm("是否清空所有日志?", function () { |
|
76 |
var ajax = new $ax(Feng.ctxPath + "/log/delLog", function (data) { |
|
77 |
Feng.success("清空日志成功!"); |
|
78 |
LoginLog.search(); |
|
79 |
}, function (data) { |
|
80 |
Feng.error("清空日志失败!"); |
|
81 |
}); |
|
82 |
ajax.start(); |
|
83 |
}); |
|
84 |
}; |
|
85 |
|
|
86 |
//渲染时间选择框 |
|
87 |
laydate.render({ |
|
88 |
elem: '#beginTime' |
|
89 |
}); |
|
90 |
|
|
91 |
//渲染时间选择框 |
|
92 |
laydate.render({ |
|
93 |
elem: '#endTime' |
|
94 |
}); |
|
95 |
|
|
96 |
// 渲染表格 |
|
97 |
var tableResult = table.render({ |
|
98 |
elem: '#' + LoginLog.tableId, |
|
99 |
url: Feng.ctxPath + '/log/list', |
|
100 |
page: true, |
|
101 |
height: "full-98", |
|
102 |
cellMinWidth: 100, |
|
103 |
cols: LoginLog.initColumn() |
|
104 |
}); |
|
105 |
|
|
106 |
// 搜索按钮点击事件 |
|
107 |
$('#btnSearch').click(function () { |
|
108 |
LoginLog.search(); |
|
109 |
}); |
|
110 |
|
|
111 |
// 搜索按钮点击事件 |
|
112 |
$('#btnClean').click(function () { |
|
113 |
LoginLog.cleanLog(); |
|
114 |
}); |
|
115 |
|
|
116 |
// 工具条点击事件 |
|
117 |
table.on('tool(' + LoginLog.tableId + ')', function (obj) { |
|
118 |
var data = obj.data; |
|
119 |
var layEvent = obj.event; |
|
120 |
|
|
121 |
if (layEvent === 'detail') { |
|
122 |
LoginLog.logDetail(data); |
|
123 |
} |
|
124 |
}); |
|
125 |
}); |