高校显示 班级名称 班级年级 班主任名称 模糊查询

This commit is contained in:
2026-08-21 10:24:50 +08:00
parent 8a7118d278
commit e4014873bb
7 changed files with 76 additions and 15 deletions
+46 -5
View File
@@ -251,6 +251,17 @@
.modal .kv .k { color: var(--muted); font-size: 12px; }
.modal .kv .v { font-family: var(--mono); font-size: 12.5px; word-break: break-all; white-space: pre-wrap; }
.modal .kv .v.scroll { max-height: 160px; overflow-y: auto; padding: 6px 8px; background: #f8f8f9; border: 1px solid #e8eaec; border-radius: 4px; }
/* 返回值伸缩框:默认收起,展开后大文本滚动查看 */
.modal .resp-details summary {
cursor: pointer; color: var(--accent); font-size: 12px; user-select: none; outline: none;
display: inline-block; padding: 2px 0;
}
.modal .resp-details summary:hover { color: var(--accent-hover); }
.modal .resp-pre {
margin: 8px 0 0; padding: 10px; background: #f8f8f9; border: 1px solid #e8eaec;
border-radius: 4px; max-height: 40vh; overflow: auto; font-family: var(--mono);
font-size: 12px; line-height: 1.5; word-break: break-all; white-space: pre-wrap;
}
.modal .modal-actions { display: none; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid #e8eaec; flex: 0 0 auto; }
/* 确认弹窗(View UI Modal.confirm 风格:居中 + 警示图标) */
@@ -704,10 +715,20 @@
// ==================== 详情弹窗 ====================
function openModal(title, rows, actionsHtml, retryHandler) {
$('modalTitle').textContent = title;
$('modalKv').innerHTML = rows.map(r =>
'<div class="k">' + escHtml(r[0]) + '</div>' +
'<div class="v' + (r[2] ? ' scroll' : '') + '">' + escHtml(r[1] == null || r[1] === '' ? '-' : r[1]) + '</div>'
).join('');
$('modalKv').innerHTML = rows.map(r => {
const opt = r[2];
// 伸缩框选项:{ collapsible: id } —— 默认收起,首次展开时异步加载返回值
if (opt && opt.collapsible) {
return '<div class="k">' + escHtml(r[0]) + '</div>' +
'<div class="v">' +
'<details class="resp-details" data-id="' + opt.collapsible + '">' +
'<summary>点击展开 / 收起返回值</summary>' +
'<pre class="resp-pre">加载中…</pre>' +
'</details></div>';
}
return '<div class="k">' + escHtml(r[0]) + '</div>' +
'<div class="v' + (r[2] ? ' scroll' : '') + '">' + escHtml(r[1] == null || r[1] === '' ? '-' : r[1]) + '</div>';
}).join('');
const act = $('modalActions');
act.innerHTML = actionsHtml || '';
act.style.display = actionsHtml ? 'flex' : 'none';
@@ -716,6 +737,25 @@
if (b.dataset.a === 'retry') (retryHandler || doSyncRetry)(Number(b.dataset.id));
};
});
// 返回值伸缩框:首次展开时才异步拉取(GZIP 解压由后端完成)
$('modalKv').querySelectorAll('details.resp-details').forEach(d => {
d.addEventListener('toggle', async () => {
if (!d.open || d.dataset.loaded) return;
d.dataset.loaded = '1';
const pre = d.querySelector('.resp-pre');
try {
const res = await fetch(API + '/syslog/response/' + d.dataset.id, { credentials: 'include', headers: authHeaders() });
const j = await res.json();
let payload = j;
if (j && typeof j === 'object' && 'code' in j && 'data' in j) payload = j.data; // 解统一包装 {code,msg,data}
const txt = (payload && payload.data != null) ? payload.data
: (typeof payload === 'string' ? payload : '(空)');
pre.textContent = txt;
} catch (e) {
pre.textContent = '加载失败:' + e.message;
}
});
});
$('modalMask').classList.add('show');
}
$('modalClose').onclick = () => $('modalMask').classList.remove('show');
@@ -835,7 +875,8 @@
['时间', fmtTime(r.createTime)],
['重试次数', (r.retryCount == null ? 0 : r.retryCount) + ' 次'],
['上次重试状态', lrStatus],
['上次重试时间', r.lastRetryTime ? fmtTime(r.lastRetryTime) : '-']
['上次重试时间', r.lastRetryTime ? fmtTime(r.lastRetryTime) : '-'],
['返回值', null, { collapsible: id }]
]);
} else if (action === 'download') {
downloadFile('/syslog/download/' + id, 'audit-' + id + '.txt');