1. 考勤记录查询关联 users 表返回记录人姓名(修复记录人为空) 2. 默认出勤生成的记录原因写为"默认出勤";整天请假未填原因时默认"请假(整天)" 3. "假前下午上课"属于偶发情况,默认不做:移除 pre_holiday 校历类型,需要时按正常考勤流程单独补录下午记录 4. 已确认:默认出勤记录可被异常考勤覆盖(覆盖时按异常状态正常扣分)
172 lines
8.1 KiB
PHP
172 lines
8.1 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 = current_group_name();
|
|
require_perm('manage_attendance');
|
|
|
|
include __DIR__ . '/../includes/header.php';
|
|
?>
|
|
|
|
<?php include __DIR__ . '/../includes/nav.php'; ?>
|
|
|
|
<div class="container">
|
|
<!-- 考勤操作工具栏 -->
|
|
<div class="card">
|
|
<div class="attendance-toolbar">
|
|
<div class="toolbar-field">
|
|
<label class="toolbar-label">日期</label>
|
|
<input type="date" id="attendanceDate" value="<?php echo date('Y-m-d'); ?>">
|
|
</div>
|
|
<div class="toolbar-field">
|
|
<label class="toolbar-label">时段</label>
|
|
<select id="attendanceSlot">
|
|
<option value="morning">早上 7:15</option>
|
|
<option value="afternoon">中午 14:00</option>
|
|
<option value="evening">晚修 19:30</option>
|
|
</select>
|
|
</div>
|
|
<div class="status-group" style="margin-left:auto;">
|
|
<button class="status-btn active" data-status="absent" onclick="selectStatus(this)" id="btnAbsent">缺勤</button>
|
|
<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-secondary" onclick="submitFullDayLeave()">请假(整天)</button>
|
|
<button class="btn btn-danger" onclick="submitAttendance()">提交考勤</button>
|
|
</div>
|
|
<div class="attendance-toolbar">
|
|
<div class="toolbar-field">
|
|
<label class="toolbar-label">扣分</label>
|
|
<input type="number" id="customDeduction" placeholder="默认值" min="0" max="20" style="width:80px;" title="留空或0使用默认值">
|
|
</div>
|
|
<div class="toolbar-field" style="flex:1;min-width:180px;">
|
|
<label class="toolbar-label">原因</label>
|
|
<input type="text" id="attendanceReason" placeholder="选填">
|
|
</div>
|
|
<button class="btn btn-primary" style="margin-left:auto;" onclick="selectAllStudents()">全选</button>
|
|
<button class="btn" onclick="deselectAllStudents()">取消全选</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 学生方格网格 -->
|
|
<div class="card">
|
|
<div class="card-title">点击选择有考勤异常的学生(默认出勤记录也可选中覆盖为异常)</div>
|
|
<div class="student-grid" id="studentGrid">
|
|
<!-- JS 动态生成 -->
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 历史考勤记录 -->
|
|
<div class="card">
|
|
<div class="card-title">考勤记录</div>
|
|
<div class="table-wrapper">
|
|
<table class="table">
|
|
<thead>
|
|
<tr><th>学号</th><th>姓名</th><th>状态</th><th>原因</th><th>记录人</th><th>扣分</th></tr>
|
|
</thead>
|
|
<tbody id="attendanceList"></tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<style>
|
|
.student-cell { display: flex; flex-direction: column; align-items: center; }
|
|
.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')">×</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')">×</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="<?php echo asset_url('/assets/js/modules/modal-utils.js'); ?>"></script>
|
|
<script src="<?php echo asset_url('/assets/js/attendance-manage.js'); ?>"></script>
|
|
|
|
<?php include __DIR__ . '/../includes/footer.php'; ?>
|