v4.5 考勤默认出勤/校历、作业按次登记与权限体系完善

1. 考勤默认出勤:按日期范围给缺失学生批量补"出勤"(跳过周末/法定节假日,调休补班与手动补课日照常,已有记录不覆盖)
2. 节假日/补课校历:法定节假日与调休补班来自在线接口(缓存+失败降级),支持手动添加放假/补课(存 system_settings,优先于接口)
3. 作业按次登记:一次登记覆盖多次作业,配置总提交次数,按每人缺交次数自动扣分(单次缺交扣分x次数),并写入作业提交数据供"数据报表-作业统计"使用
4. 权限体系:新增 homework_register/default_attendance/manage_calendar 权限项;数据报表/操作日志/系统设置拆分为 view_reports/view_logs/manage_settings,共20项功能权限可配置;预置组默认值与 init.sql 同步
5. 权限审计修复:学生端接口管理员越权修复(管理员查看需 view_all_records,学生仅本人);学生列表手机号仅向学生管理/导出名单权限下发;操行分管理页与导航补权限门控
6. v4.5.sql:为预置权限组补充新权限默认值(JSON_SET,幂等可重复执行)
This commit is contained in:
canglan committed 2026-10-10 15:22:47 +08:00
1 parent 4c57ba3a30
commit 4c1ca13a3f
34 files changed
+1438 -48

No files matched your search

+74
View File
@@ -47,6 +47,12 @@ include __DIR__ . '/../includes/header.php';
<button class="status-btn" data-status="late" onclick="selectStatus(this)" id="btnLate">迟到</button>
<button class="status-btn" data-status="leave" onclick="selectStatus(this)" id="btnLeave">请假</button>
</div>
<?php if (has_perm('default_attendance')): ?>
<button class="btn btn-success" onclick="openDefaultAttendanceModal()">默认出勤</button>
<?php endif; ?>
<?php if (has_perm('manage_calendar')): ?>
<button class="btn btn-ghost" onclick="openCalendarModal()">节假日/补课</button>
<?php endif; ?>
<button class="btn btn-danger" onclick="submitAttendance()">提交考勤</button>
</div>
<div class="attendance-toolbar">
@@ -90,6 +96,74 @@ include __DIR__ . '/../includes/header.php';
.student-cell-name { font-size: 14px; font-weight: 500; }
.student-cell-no { font-size: 11px; color: #999; }
</style>
<!-- 默认出勤模态框 -->
<div id="defaultAttendanceModal" class="modal">
<div class="modal-content">
<div class="modal-header">
<h3>默认出勤(批量补全)</h3>
<button class="modal-close" onclick="closeModal('defaultAttendanceModal')">&times;</button>
</div>
<div class="form-group">
<label>日期范围</label>
<div style="display:flex; align-items:center; gap:8px; flex-wrap:wrap;">
<input type="date" id="defaultStartDate" style="width:auto;">
<span style="color:#999;">至</span>
<input type="date" id="defaultEndDate" style="width:auto;">
</div>
<small>跳过周末与法定节假日(在线接口获取),调休补班与手动补课日照常;已有的考勤记录(含异常)不会被覆盖</small>
</div>
<div class="form-group">
<label>时段</label>
<div class="check-grid" style="grid-template-columns: repeat(3, 1fr);">
<label class="check-item"><input type="checkbox" class="defaultSlot" value="morning" checked> 早上 7:15</label>
<label class="check-item"><input type="checkbox" class="defaultSlot" value="afternoon" checked> 中午 14:00</label>
<label class="check-item"><input type="checkbox" class="defaultSlot" value="evening" checked> 晚修 19:30</label>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" id="defaultAttendanceBtn" onclick="submitDefaultAttendance()">开始补全</button>
<button type="button" class="btn" onclick="closeModal('defaultAttendanceModal')">取消</button>
</div>
</div>
</div>
<!-- 节假日/补课模态框 -->
<div id="calendarModal" class="modal">
<div class="modal-content" style="width: 640px;">
<div class="modal-header">
<h3>节假日 / 补课设置</h3>
<button class="modal-close" onclick="closeModal('calendarModal')">&times;</button>
</div>
<div class="form-group">
<label>查询范围</label>
<div style="display:flex; align-items:center; gap:8px; flex-wrap:wrap;">
<input type="date" id="calendarStartDate" style="width:auto;">
<span style="color:#999;">至</span>
<input type="date" id="calendarEndDate" style="width:auto;">
<button type="button" class="btn btn-sm btn-secondary" onclick="loadCalendar()">查询</button>
</div>
<small>法定节假日与调休补班来自在线接口(只读);手动添加用于学校自己的安排,优先于接口</small>
</div>
<div class="form-group">
<label>手动添加</label>
<div style="display:flex; align-items:center; gap:8px; flex-wrap:wrap;">
<input type="date" id="calendarNewDate" style="width:auto;">
<select id="calendarNewType" style="width:auto;">
<option value="makeup">补课(按上课)</option>
<option value="holiday">放假(按休息)</option>
</select>
<input type="text" id="calendarNewNote" placeholder="备注(选填)" maxlength="100" style="flex:1; min-width:120px;">
<button type="button" class="btn btn-sm btn-primary" onclick="addCalendarDay()">添加</button>
</div>
</div>
<div id="calendarListArea" style="max-height:320px; overflow-y:auto; border:1px solid var(--color-border-light); border-radius:8px;"></div>
<div class="modal-footer">
<button type="button" class="btn" onclick="closeModal('calendarModal')">关闭</button>
</div>
</div>
</div>
<script src="/assets/js/modules/modal-utils.js"></script>
<script src="/assets/js/attendance-manage.js"></script>
+1
View File
@@ -19,6 +19,7 @@ if (!isset($_SESSION['user_id']) || $_SESSION['user_type'] !== 'admin') {
$page_title = '操行分管理';
$role = current_group_name();
require_perm('manage_conduct');
include __DIR__ . '/../includes/header.php';
?>
+2
View File
@@ -46,7 +46,9 @@ include __DIR__ . '/../includes/header.php';
<span class="ranking-tip">% 的学生</span>
<button class="btn btn-sm btn-primary" onclick="applyPercentileFilter()">筛选</button>
<button class="btn btn-sm btn-ghost" onclick="resetPercentileFilter()">显示全部</button>
<?php if (has_perm('export_data')): ?>
<button class="btn btn-sm btn-secondary" onclick="exportRanking()">导出</button>
<?php endif; ?>
</div>
<table class="table">
<thead>
+54
View File
@@ -47,6 +47,9 @@ include __DIR__ . '/../includes/header.php';
<div class="action-bar">
<div class="action-buttons">
<button class="btn btn-primary" onclick="showBatchPointsModal()">批量加减分</button>
<?php if (has_perm('homework_register')): ?>
<button class="btn btn-success" onclick="showHomeworkRegisterModal()">按次登记</button>
<?php endif; ?>
</div>
</div>
<div class="table-wrapper">
@@ -119,6 +122,57 @@ include __DIR__ . '/../includes/header.php';
</div>
</div>
<!-- 作业按次登记模态框 -->
<div id="homeworkRegisterModal" class="modal">
<div class="modal-content" style="width: 560px;">
<div class="modal-header">
<h3>作业按次登记</h3>
<button class="modal-close" onclick="closeModal('homeworkRegisterModal')">&times;</button>
</div>
<form onsubmit="event.preventDefault(); submitHomeworkRegister()">
<div class="form-group">
<label>科目 <span class="text-danger">*</span></label>
<select id="hwRegSubject" required>
<option value="">请选择科目</option>
</select>
</div>
<div class="form-group">
<label>作业名称</label>
<input type="text" id="hwRegTitle" maxlength="100" placeholder="选填,如:第5周数学作业">
</div>
<div class="form-group">
<label>缴交/截止日期</label>
<input type="date" id="hwRegDeadline">
<small>作业统计按该日期归属</small>
</div>
<div class="form-group" style="display:flex; gap:12px;">
<div style="flex:1;">
<label>总提交次数</label>
<input type="number" id="hwRegTotal" min="1" max="99" value="5" required>
</div>
<div style="flex:1;">
<label>单次缺交扣分</label>
<input type="number" id="hwRegPerDeduction" min="1" max="20">
<small>默认取系统配置</small>
</div>
</div>
<div class="form-group">
<label>缺交学生与次数</label>
<div id="hwRegStudentList" class="hw-reg-list"></div>
<small>缺交次数不超过总提交次数,其他学生自动记为已交</small>
</div>
<div class="form-group">
<label>备注</label>
<input type="text" id="hwRegNote" maxlength="100" placeholder="选填">
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary" id="hwRegisterSubmitBtn">确认登记</button>
<button type="button" class="btn" onclick="closeModal('homeworkRegisterModal')">取消</button>
</div>
</form>
</div>
</div>
<!-- 添加科目模态框 -->
<div id="addSubjectModal" class="modal">
<div class="modal-content">
+1 -1
View File
@@ -19,7 +19,7 @@ if (!isset($_SESSION['user_id']) || $_SESSION['user_type'] !== 'admin') {
$page_title = '操作日志';
$role = current_group_name();
require_perm('manage_admins');
require_perm('view_logs');
include __DIR__ . '/../includes/header.php';
?>
+1 -1
View File
@@ -19,7 +19,7 @@ if (!isset($_SESSION['user_id']) || $_SESSION['user_type'] !== 'admin') {
$page_title = '数据报表';
$role = current_group_name();
require_perm('view_all_records');
require_perm('view_reports');
include __DIR__ . '/../includes/header.php';
?>
+1 -1
View File
@@ -19,7 +19,7 @@ if (!isset($_SESSION['user_id']) || $_SESSION['user_type'] !== 'admin') {
$page_title = '系统设置';
$role = current_group_name();
require_perm('manage_admins');
require_perm('manage_settings');
include __DIR__ . '/../includes/header.php';
?>