优化考勤记录
This commit is contained in:
@@ -41,9 +41,9 @@ include __DIR__ . '/../includes/header.php';
|
||||
<div class="form-group" style="margin:0">
|
||||
<label>时段</label>
|
||||
<select id="attendanceSlot">
|
||||
<option value="morning">早 8:15</option>
|
||||
<option value="afternoon">下午 14:00</option>
|
||||
<option value="evening">晚 19:30</option>
|
||||
<option value="morning">早上 7:15</option>
|
||||
<option value="afternoon">中午 14:00</option>
|
||||
<option value="evening">晚修 19:30</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="status-group">
|
||||
@@ -124,7 +124,7 @@ function renderStudentGrid() {
|
||||
const currentSlot = document.getElementById('attendanceSlot').value;
|
||||
let html = '';
|
||||
studentsData.forEach(student => {
|
||||
const hasRecord = existingRecords.some(r => r.student_id === student.student_id && (!r.slot || r.slot === currentSlot));
|
||||
const hasRecord = existingRecords.some(r => r.student_id === student.student_id && r.slot === currentSlot);
|
||||
html += `<div class="student-cell${hasRecord ? ' has-record' : ''}"
|
||||
data-id="${student.student_id}"
|
||||
data-name="${escapeHtml(student.name)}"
|
||||
@@ -178,17 +178,19 @@ async function submitAttendance() {
|
||||
}
|
||||
|
||||
const date = document.getElementById('attendanceDate').value;
|
||||
const slot = document.getElementById('attendanceSlot').value;
|
||||
const reason = document.getElementById('attendanceReason').value;
|
||||
const customDeduction = document.getElementById('customDeduction').value;
|
||||
const customDeductionValue = customDeduction ? parseInt(customDeduction) : null;
|
||||
|
||||
// 批量提交(不再检查已有记录,允许同一学生同一天多次考勤)
|
||||
// 批量提交
|
||||
const promises = [];
|
||||
selectedCells.forEach(cell => {
|
||||
const studentId = parseInt(cell.dataset.id);
|
||||
const payload = {
|
||||
student_id: studentId,
|
||||
date: date,
|
||||
slot: slot,
|
||||
status: currentStatus,
|
||||
reason: reason,
|
||||
apply_deduction: true
|
||||
|
||||
Reference in New Issue
Block a user