feat: 完成 issue #156 审计查询页补充时间范围筛选
This commit is contained in:
@@ -364,6 +364,9 @@ function transitionAlert(id, to) {
|
|||||||
function renderAudit() {
|
function renderAudit() {
|
||||||
var q = document.getElementById("audit-q").value.trim();
|
var q = document.getElementById("audit-q").value.trim();
|
||||||
var action = document.getElementById("audit-action").value;
|
var action = document.getElementById("audit-action").value;
|
||||||
|
// issue #156:时间范围筛选(起止日期,含当日全天)
|
||||||
|
var from = document.getElementById("audit-from").value;
|
||||||
|
var to = document.getElementById("audit-to").value;
|
||||||
var tbody = document.getElementById("audit-tbody");
|
var tbody = document.getElementById("audit-tbody");
|
||||||
tbody.innerHTML = "";
|
tbody.innerHTML = "";
|
||||||
var log = (typeof UserStore !== "undefined") ? UserStore.auditLog() : [];
|
var log = (typeof UserStore !== "undefined") ? UserStore.auditLog() : [];
|
||||||
@@ -371,6 +374,9 @@ function renderAudit() {
|
|||||||
.filter(function (e) {
|
.filter(function (e) {
|
||||||
if (action && e.action !== action) return false;
|
if (action && e.action !== action) return false;
|
||||||
if (q && (e.actor + e.resource + e.reason).indexOf(q) < 0) return false;
|
if (q && (e.actor + e.resource + e.reason).indexOf(q) < 0) return false;
|
||||||
|
var day = (e.time || "").slice(0, 10);
|
||||||
|
if (from && day < from) return false;
|
||||||
|
if (to && day > to) return false;
|
||||||
return true;
|
return true;
|
||||||
})
|
})
|
||||||
.forEach(function (e) {
|
.forEach(function (e) {
|
||||||
@@ -403,6 +409,8 @@ function renderAudit() {
|
|||||||
document.getElementById("btn-kb-upload").onclick = uploadKb;
|
document.getElementById("btn-kb-upload").onclick = uploadKb;
|
||||||
document.getElementById("alert-filter").onchange = renderAlerts;
|
document.getElementById("alert-filter").onchange = renderAlerts;
|
||||||
document.getElementById("btn-audit-filter").onclick = renderAudit;
|
document.getElementById("btn-audit-filter").onclick = renderAudit;
|
||||||
|
document.getElementById("audit-from").onchange = renderAudit;
|
||||||
|
document.getElementById("audit-to").onchange = renderAudit;
|
||||||
document.getElementById("btn-audit-export").onclick = function () {
|
document.getElementById("btn-audit-export").onclick = function () {
|
||||||
download("audit-export-" + Date.now() + ".json",
|
download("audit-export-" + Date.now() + ".json",
|
||||||
JSON.stringify(typeof UserStore !== "undefined" ? UserStore.auditLog() : [], null, 2));
|
JSON.stringify(typeof UserStore !== "undefined" ? UserStore.auditLog() : [], null, 2));
|
||||||
|
|||||||
@@ -92,6 +92,8 @@
|
|||||||
<h2>操作审计日志</h2>
|
<h2>操作审计日志</h2>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<input id="audit-q" placeholder="关键词(操作者/资源/原因)">
|
<input id="audit-q" placeholder="关键词(操作者/资源/原因)">
|
||||||
|
<input id="audit-from" type="date" title="起始日期">
|
||||||
|
<input id="audit-to" type="date" title="截止日期">
|
||||||
<select id="audit-action">
|
<select id="audit-action">
|
||||||
<option value="">全部动作</option>
|
<option value="">全部动作</option>
|
||||||
<option value="create">create</option>
|
<option value="create">create</option>
|
||||||
|
|||||||
Reference in New Issue
Block a user