v2.4更新
This commit is contained in:
@@ -31,7 +31,7 @@ async function loadHistory(page = 1) {
|
||||
const startDate = document.getElementById('historyStartDate').value;
|
||||
const endDate = document.getElementById('historyEndDate').value;
|
||||
const studentId = document.getElementById('historyStudentId').value;
|
||||
const relatedType = document.getElementById('historyRelatedType').value;
|
||||
const reasonFilter = document.getElementById('historyReasonFilter').value;
|
||||
const isGrouped = document.getElementById('historyGrouped').checked;
|
||||
|
||||
const params = {
|
||||
@@ -40,17 +40,18 @@ async function loadHistory(page = 1) {
|
||||
end_date: endDate
|
||||
};
|
||||
if (studentId) params.student_id = studentId;
|
||||
if (relatedType) params.related_type = relatedType;
|
||||
if (reasonFilter) params.reason_prefix = reasonFilter;
|
||||
if (isGrouped) params.grouped = true;
|
||||
|
||||
const res = await apiGet('/api/admin/conduct/history', params);
|
||||
|
||||
if (res && res.success) {
|
||||
const nowrapStyle = ' style="white-space: nowrap; min-width: 80px;"';
|
||||
let headHtml = '';
|
||||
if (isGrouped) {
|
||||
headHtml = '<th>时间</th><th>原因</th><th>分值</th><th>操作人</th><th>涉及学生</th>';
|
||||
headHtml = '<th>时间</th><th>原因</th><th>分值</th><th' + nowrapStyle + '>操作人</th><th>涉及学生</th>';
|
||||
} else {
|
||||
headHtml = '<th>时间</th><th>学生</th><th>分数变动</th><th>原因</th><th>操作人</th>';
|
||||
headHtml = '<th>时间</th><th>学生</th><th>分数变动</th><th>原因</th><th' + nowrapStyle + '>操作人</th>';
|
||||
if (role === '班主任' || role === '班长' || role === '考勤委员') {
|
||||
headHtml += '<th>操作</th>';
|
||||
}
|
||||
@@ -61,18 +62,13 @@ async function loadHistory(page = 1) {
|
||||
if (isGrouped) {
|
||||
res.data.records.forEach(record => {
|
||||
const pointsClass = record.points_change > 0 ? 'plus' : 'minus';
|
||||
const names = record.student_names ? record.student_names.split(', ') : [];
|
||||
let tagsHtml = '<div class="student-tags-container">';
|
||||
names.forEach(name => {
|
||||
tagsHtml += `<span class="student-tag">${escapeHtml(name)}</span>`;
|
||||
});
|
||||
tagsHtml += '</div>';
|
||||
const names = record.student_names || '';
|
||||
html += `<tr>
|
||||
<td>${formatDateTime(record.created_at)}</td>
|
||||
<td class="preserve-newlines">${escapeHtml(record.reason)}</td>
|
||||
<td class="${pointsClass}">${record.points_change > 0 ? '+' : ''}${record.points_change}×${record.student_count}</td>
|
||||
<td>${escapeHtml(record.recorder_name || '')}</td>
|
||||
<td>${tagsHtml}</td>
|
||||
<td style="white-space: nowrap;">${escapeHtml(names)}</td>
|
||||
</tr>`;
|
||||
});
|
||||
if (res.data.records.length === 0) {
|
||||
@@ -141,12 +137,12 @@ async function exportHistoryRecords() {
|
||||
showToast('正在导出历史记录...', 'info');
|
||||
|
||||
try {
|
||||
const relatedType = document.getElementById('historyRelatedType').value;
|
||||
const reasonFilter = document.getElementById('historyReasonFilter').value;
|
||||
const params = { page: 1, page_size: 1000 };
|
||||
if (startDate) params.start_date = startDate;
|
||||
if (endDate) params.end_date = endDate;
|
||||
if (studentId) params.student_id = studentId;
|
||||
if (relatedType) params.related_type = relatedType;
|
||||
if (reasonFilter) params.reason_prefix = reasonFilter;
|
||||
|
||||
const res = await apiGet('/api/admin/conduct/history', params);
|
||||
if (res && res.success && res.data.records) {
|
||||
|
||||
Reference in New Issue
Block a user