Files
ClassManager/frontend/admin/history.php
T
canglan 768ea281e0 v4.4 数据报表/操作日志/系统设置与月度分排行
1. 月度分排行:管理端首页支持总分/月度分切换与月份选择,新增排行榜导出CSV
2. 数据报表:新增考勤/作业统计页(日期范围、汇总与每人明细、CSV导出)
3. 操作日志:新增查看页(操作类型/操作人/日期筛选,分页)
4. 系统设置:密码策略可配置(长度/字符种类),全站改密与重置统一校验、前端提示同步;策略通过公开配置下发
5. 学期归档对比:查看归档时展示与上一学期的分数变化与名次升降
6. 历史记录导出支持按学生分表(每人一段,便于发家长)
7. 移动端适配:导航横向滚动、表格触控滚动、字号与弹窗优化
8. 版本升级至4.4(无数据库结构变更)
2026-10-09 15:00:32 +08:00

152 lines
6.6 KiB
PHP

<?php
/**
* 班级操行分管理系统 - 管理端历史记录
*
* 开发者: Canglan
* 联系方式: admin@sea-studio.top
* 版权归属: Sea Network Technology Studio
* 许可证: MIT License
*
* 版权所有 © Sea Network Technology Studio
*/
require_once __DIR__ . '/../config.php';
if (!isset($_SESSION['user_id']) || $_SESSION['user_type'] !== 'admin') {
header('Location: /index.php');
exit();
}
$page_title = '历史记录';
$role = $_SESSION['role'] ?? '';
include __DIR__ . '/../includes/header.php';
?>
<?php include __DIR__ . '/../includes/nav.php'; ?>
<div class="container">
<div class="card">
<div class="filter-bar" id="historyFilterBar">
<button class="btn btn-primary" onclick="loadHistory(1)">查询</button>
<button class="btn btn-ghost" id="filterToggleBtn" onclick="toggleFilterPanel()">展开筛选 ▼</button>
<label class="history-grouped-label">
<input type="checkbox" id="historyGrouped" checked onchange="loadHistory(1)"> 批次合并
</label>
<label class="history-grouped-label" style="display:flex; align-items:center; gap:6px;">
学期
<select id="historySemesterFilter" onchange="loadHistory(1)" style="padding:4px 8px; border:1px solid var(--color-border); border-radius:4px;">
<option value="">全部学期</option>
</select>
</label>
<?php if (has_perm('export_data')): ?>
<button class="btn btn-secondary" onclick="showExportHistoryModal()">导出</button>
<?php endif; ?>
</div>
<!-- 高级筛选面板(默认折叠) -->
<div id="advancedFilters" style="display:none; padding: 0 16px 16px; border-top: 1px solid var(--color-border-light);">
<div style="display:flex; flex-wrap:wrap; gap:16px; padding-top:16px;">
<div class="filter-group">
<label>学生</label>
<select id="historyStudentId" onchange="onStudentFilterChange()">
<option value="">全部</option>
</select>
</div>
<div class="filter-group">
<label>科目</label>
<select id="historySubjectFilter" onchange="onSubjectFilterChange()">
<option value="">全部科目</option>
</select>
</div>
<div class="filter-group">
<label>搜索原因</label>
<input type="text" id="historyReasonSearch" placeholder="输入关键词..." style="min-width:150px;">
</div>
<div class="filter-group">
<label>开始日期</label>
<input type="date" id="historyStartDate">
</div>
<div class="filter-group">
<label>结束日期</label>
<input type="date" id="historyEndDate">
</div>
<div class="filter-group">
<label>扣分类型</label>
<select id="historyReasonFilter">
<option value="">全部类型</option>
<option value="卫生">卫生</option>
<option value="课堂">课堂</option>
<option value="纪律">纪律</option>
<option value="作业">作业</option>
<option value="考勤">考勤</option>
<option value="劳动">劳动</option>
<option value="志愿">志愿</option>
</select>
</div>
<?php if (has_perm('revoke_any') || has_perm('restore_records')): ?>
<div class="filter-group">
<label>状态</label>
<select id="historyStatusFilter">
<option value="">全部</option>
<option value="0">正常</option>
<option value="1">已撤销</option>
</select>
</div>
<?php endif; ?>
</div>
</div>
<div class="table-wrapper">
<table class="table">
<thead>
<tr id="historyTableHead">
<th>类型</th>
<th>分值</th>
<th>原因</th>
<th>学生</th>
<th style="white-space: nowrap; min-width: 80px;">操作人</th>
<th>时间</th>
<?php if (has_perm('revoke_any') || has_perm('revoke_own')): ?>
<th>操作</th>
<?php endif; ?>
</tr>
</thead>
<tbody id="historyList"></tbody>
</table>
</div>
<div class="pagination" id="historyPagination"></div>
</div>
</div>
<script>window.PAGE_CONFIG = { role: '<?php echo htmlspecialchars($role, ENT_QUOTES, 'UTF-8'); ?>', userId: <?php echo intval($_SESSION['user_id']); ?> };</script>
<script src="/assets/js/modules/modal-utils.js"></script>
<script src="/assets/js/modules/points-mgmt.js"></script>
<script src="/assets/js/history.js"></script>
<!-- 导出历史记录模态框 -->
<div id="exportHistoryModal" class="modal">
<div class="modal-content">
<div class="modal-header">
<h3>导出历史记录</h3>
<button class="modal-close" onclick="closeModal('exportHistoryModal')">&times;</button>
</div>
<div class="form-group">
<label>导出方式</label>
<div class="check-grid" style="grid-template-columns: 1fr;">
<label class="check-item">
<input type="radio" name="historyExportMode" value="detail" checked> 明细记录(每行一条记录)
</label>
<label class="check-item">
<input type="radio" name="historyExportMode" value="per_student"> 按学生分表(每人一段,便于发给家长)
</label>
</div>
<small>导出内容跟随当前筛选条件;已撤销记录不导出</small>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" onclick="exportHistoryRecords()">开始导出</button>
<button type="button" class="btn" onclick="closeModal('exportHistoryModal')">取消</button>
</div>
</div>
</div>
<?php include __DIR__ . '/../includes/footer.php'; ?>