feat: 增加学生信息管理功能,优化操行分历史记录展示并更新使用文档
This commit is contained in:
@@ -53,6 +53,7 @@ include __DIR__ . '/../includes/header.php';
|
||||
<tr>
|
||||
<th>时间</th>
|
||||
<th>学生</th>
|
||||
<th>人数</th>
|
||||
<th>分数变动</th>
|
||||
<th>原因</th>
|
||||
<th>操作人</th>
|
||||
@@ -82,7 +83,6 @@ async function loadStudentsForSelect() {
|
||||
document.getElementById('historyStudentId').innerHTML = html;
|
||||
}
|
||||
}
|
||||
|
||||
async function loadHistory(page = 1) {
|
||||
currentHistoryPage = page;
|
||||
const startDate = document.getElementById('historyStartDate').value;
|
||||
@@ -92,7 +92,8 @@ async function loadHistory(page = 1) {
|
||||
const params = {
|
||||
page, page_size: 20,
|
||||
start_date: startDate,
|
||||
end_date: endDate
|
||||
end_date: endDate,
|
||||
grouped: true
|
||||
};
|
||||
if (studentId) params.student_id = studentId;
|
||||
|
||||
@@ -104,18 +105,19 @@ async function loadHistory(page = 1) {
|
||||
const pointsClass = record.points_change > 0 ? 'plus' : 'minus';
|
||||
html += `<tr>
|
||||
<td>${formatDateTime(record.created_at)}</td>
|
||||
<td>${escapeHtml(record.student_name)}</td>
|
||||
<td>${escapeHtml(record.student_names)}</td>
|
||||
<td>${record.student_count || 1}</td>
|
||||
<td class="${pointsClass}">${record.points_change > 0 ? '+' : ''}${record.points_change}</td>
|
||||
<td>${escapeHtml(record.reason)}</td>
|
||||
<td>${escapeHtml(record.recorder_name)}</td>`;
|
||||
<?php if ($role === '班主任' || $role === '班长'): ?>
|
||||
html += `<td><button class="btn btn-sm btn-danger" onclick="revokeRecord(${record.record_id})">撤销</button></td>`;
|
||||
html += `<td>-</td>`;
|
||||
<?php endif; ?>
|
||||
html += `</tr>`;
|
||||
});
|
||||
|
||||
if (res.data.records.length === 0) {
|
||||
const colSpan = <?php echo ($role === '班主任' || $role === '班长') ? '6' : '5'; ?>;
|
||||
const colSpan = <?php echo ($role === '班主任' || $role === '班长') ? '7' : '6'; ?>;
|
||||
html = `<tr><td colspan="${colSpan}" style="text-align:center;">暂无记录</td></tr>`;
|
||||
}
|
||||
|
||||
@@ -125,6 +127,7 @@ async function loadHistory(page = 1) {
|
||||
renderHistoryPagination();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function renderHistoryPagination() {
|
||||
const container = document.getElementById('historyPagination');
|
||||
@@ -194,8 +197,16 @@ async function exportHistoryRecords() {
|
||||
}
|
||||
}
|
||||
|
||||
loadStudentsForSelect();
|
||||
loadHistory();
|
||||
loadStudentsForSelect().then(() => {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const preStudentId = urlParams.get('student_id');
|
||||
if (preStudentId) {
|
||||
document.getElementById('historyStudentId').value = preStudentId;
|
||||
loadHistory();
|
||||
} else {
|
||||
loadHistory();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script src="/assets/js/admin.js"></script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user