feat: 完成 issue #156 审计查询页补充时间范围筛选

This commit is contained in:
2026-08-05 10:47:31 +08:00
parent 04b5b33bb7
commit 3a6ef57592
2 changed files with 10 additions and 0 deletions
+8
View File
@@ -364,6 +364,9 @@ function transitionAlert(id, to) {
function renderAudit() {
var q = document.getElementById("audit-q").value.trim();
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");
tbody.innerHTML = "";
var log = (typeof UserStore !== "undefined") ? UserStore.auditLog() : [];
@@ -371,6 +374,9 @@ function renderAudit() {
.filter(function (e) {
if (action && e.action !== action) 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;
})
.forEach(function (e) {
@@ -403,6 +409,8 @@ function renderAudit() {
document.getElementById("btn-kb-upload").onclick = uploadKb;
document.getElementById("alert-filter").onchange = renderAlerts;
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 () {
download("audit-export-" + Date.now() + ".json",
JSON.stringify(typeof UserStore !== "undefined" ? UserStore.auditLog() : [], null, 2));
+2
View File
@@ -92,6 +92,8 @@
<h2>操作审计日志</h2>
<div class="row">
<input id="audit-q" placeholder="关键词(操作者/资源/原因)">
<input id="audit-from" type="date" title="起始日期">
<input id="audit-to" type="date" title="截止日期">
<select id="audit-action">
<option value="">全部动作</option>
<option value="create">create</option>