v2.4更新

This commit is contained in:
2026-05-29 11:12:13 +08:00
parent 122ffb4e0d
commit 6c0d8f0e94
12 changed files with 73 additions and 33 deletions

View File

@@ -78,10 +78,14 @@ include __DIR__ . '/../includes/header.php';
</div>
<div class="form-group">
<label>扣分类型</label>
<div class="deduction-types">
<div class="deduction-types" style="display: flex; flex-wrap: wrap; gap: 6px;">
<button type="button" class="btn btn-sm" onclick="selectDeductionType(null, '卫生')">卫生</button>
<button type="button" class="btn btn-sm" onclick="selectDeductionType(null, '课堂')">课堂</button>
<button type="button" class="btn btn-sm" onclick="selectDeductionType(null, '纪律')">纪律</button>
<button type="button" class="btn btn-sm" onclick="selectDeductionType(null, '作业')">作业</button>
<button type="button" class="btn btn-sm" onclick="selectDeductionType(null, '考勤')">考勤</button>
<button type="button" class="btn btn-sm" onclick="selectDeductionType(null, '劳动')">劳动</button>
<button type="button" class="btn btn-sm" onclick="selectDeductionType(null, '志愿')">志愿</button>
<button type="button" class="btn btn-sm" onclick="selectDeductionType(0, '')">自定义</button>
</div>
</div>

View File

@@ -43,11 +43,15 @@ include __DIR__ . '/../includes/header.php';
</div>
<div class="filter-group">
<label>扣分类型</label>
<select id="historyRelatedType">
<select id="historyReasonFilter">
<option value="">全部类型</option>
<option value="manual">手动加减分</option>
<option value="homework">作业扣分</option>
<option value="attendance">考勤扣分</option>
<option value="卫生">卫生</option>
<option value="课堂">课堂</option>
<option value="纪律">纪律</option>
<option value="作业">作业</option>
<option value="考勤">考勤</option>
<option value="劳动">劳动</option>
<option value="志愿">志愿</option>
</select>
</div>
<button class="btn btn-primary" onclick="loadHistory(1)">查询</button>
@@ -70,7 +74,7 @@ include __DIR__ . '/../includes/header.php';
<th>学生</th>
<th>分数变动</th>
<th>原因</th>
<th>操作人</th>
<th style="white-space: nowrap; min-width: 80px;">操作人</th>
<?php if ($role === '班主任' || $role === '班长' || $role === '考勤委员'): ?>
<th>操作</th>
<?php endif; ?>

View File

@@ -34,7 +34,7 @@ include __DIR__ . '/../includes/header.php';
<!-- 科目管理折叠面板 -->
<div class="card collapsible-card" style="margin-bottom: 20px;">
<div class="collapsible-header" id="subjectPanelHeader">
<h3 style="margin: 0; font-size: 16px;">📚 科目管理</h3>
<h3 style="margin: 0; font-size: 16px;">科目管理</h3>
<span id="subjectPanelToggle" class="toggle-icon">▶ 展开</span>
</div>
<div id="subjectPanelContent" class="collapsible-content">
@@ -89,9 +89,12 @@ include __DIR__ . '/../includes/header.php';
<?php endif; ?>
<div class="form-group">
<label>扣分类型</label>
<div class="deduction-types">
<div class="deduction-types" style="display: flex; flex-wrap: wrap; gap: 6px;">
<button type="button" class="btn btn-sm" onclick="selectDeductionType(-window.DEDUCTION_HOMEWORK_NOT_SUBMIT, '未交作业')">未交作业(-<span class="hw-not-submit"></span>分)</button>
<button type="button" class="btn btn-sm" onclick="selectDeductionType(-window.DEDUCTION_HOMEWORK_LATE, '迟交作业')">迟交作业(-<span class="hw-late"></span>分)</button>
<button type="button" class="btn btn-sm" onclick="selectDeductionType(null, '作业未完成')">作业未完成</button>
<button type="button" class="btn btn-sm" onclick="selectDeductionType(null, '作业抄袭')">作业抄袭</button>
<button type="button" class="btn btn-sm" onclick="selectDeductionType(null, '作业态度')">作业态度</button>
<button type="button" class="btn btn-sm" onclick="selectDeductionType(0, '')">自定义</button>
</div>
</div>

View File

@@ -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) {