Files
ClassManager/frontend/admin/history.php
T
canglan dbf70f602e 静态资源加修改时间版本号,修复部署后浏览器缓存旧 JS 的问题
页面 JS/CSS 引用统一改为 asset_url()(附加 ?v=filemtime):
部署更新文件后浏览器自动拉取新版本,避免出现"新按钮点击无反应"等旧缓存现象。
2026-10-10 16:13:22 +08:00

152 lines
6.7 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="<?php echo asset_url('/assets/js/modules/modal-utils.js'); ?>"></script>
<script src="<?php echo asset_url('/assets/js/modules/points-mgmt.js'); ?>"></script>
<script src="<?php echo asset_url('/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'; ?>