修复学期功能
This commit is contained in:
@@ -64,16 +64,20 @@ include __DIR__ . '/../includes/header.php';
|
||||
<label>学期名称 <span style="color:red;">*</span></label>
|
||||
<input type="text" id="semesterName" required placeholder="如:2025春季学期" maxlength="100">
|
||||
</div>
|
||||
<div style="margin-bottom: 8px;">
|
||||
<button type="button" class="btn btn-sm" style="border: 1px solid #667eea; color: #667eea; margin-right: 6px;" onclick="fillSemesterDates('upper')">上学期(9月-次年2月)</button>
|
||||
<button type="button" class="btn btn-sm" style="border: 1px solid #667eea; color: #667eea;" onclick="fillSemesterDates('lower')">下学期(3月-7月)</button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>开始日期</label>
|
||||
<input type="date" id="semesterStartDate">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>结束日期</label>
|
||||
<input type="date" id="semesterEndDate">
|
||||
<label>结束日期 <small style="color: #999;">(可选)</small></label>
|
||||
<input type="date" id="semesterEndDate" placeholder="可选,不确定可不填">
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">创建并激活</button>
|
||||
<button type="submit" class="btn btn-primary">创建学期</button>
|
||||
<button type="button" class="btn" onclick="closeModal('createSemesterModal')">取消</button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -89,7 +93,7 @@ include __DIR__ . '/../includes/header.php';
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<p id="archiveConfirmText" style="margin: 10px 0;"></p>
|
||||
<p style="color: #e74c3c; font-size: 14px;">注意:归档后该学期的操行分记录将不可修改或撤销,但可以查看归档数据。</p>
|
||||
<p style="color: #e74c3c; font-size: 14px;">注意:归档前需确保学期已设置开始日期,否则无法归档。归档后该学期的操行分记录将不可修改或撤销,但可以查看归档数据。</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" onclick="confirmArchive()">确认归档</button>
|
||||
@@ -108,11 +112,23 @@ include __DIR__ . '/../includes/header.php';
|
||||
<div class="table-wrapper">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2" style="text-align:center; border-bottom: none;">基本信息</th>
|
||||
<th rowspan="2" style="vertical-align: middle;">姓名</th>
|
||||
<th rowspan="2" style="vertical-align: middle;">操行分</th>
|
||||
<th colspan="4" style="text-align:center; border-bottom: none;">考勤统计</th>
|
||||
<th colspan="3" style="text-align:center; border-bottom: none;">作业统计</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>排名</th>
|
||||
<th>学号</th>
|
||||
<th>姓名</th>
|
||||
<th>最终操行分</th>
|
||||
<th>出勤</th>
|
||||
<th>缺勤</th>
|
||||
<th>迟到</th>
|
||||
<th>请假</th>
|
||||
<th>已交</th>
|
||||
<th>未交</th>
|
||||
<th>迟交</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="archiveDataList"></tbody>
|
||||
@@ -130,6 +146,28 @@ var archiveSemesterId = null;
|
||||
var archivePage = 1;
|
||||
var archiveTotalPages = 1;
|
||||
|
||||
function fillSemesterDates(type) {
|
||||
var now = new Date();
|
||||
var currentYear = now.getFullYear();
|
||||
var currentMonth = now.getMonth() + 1;
|
||||
var startDateInput = document.getElementById('semesterStartDate');
|
||||
var endDateInput = document.getElementById('semesterEndDate');
|
||||
|
||||
if (type === 'upper') {
|
||||
var year = currentMonth >= 6 ? currentYear : currentYear - 1;
|
||||
var endYear = year + 1;
|
||||
var febDay = 28;
|
||||
if ((endYear % 4 === 0 && endYear % 100 !== 0) || endYear % 400 === 0) {
|
||||
febDay = 29;
|
||||
}
|
||||
startDateInput.value = year + '-09-01';
|
||||
endDateInput.value = endYear + '-02-' + febDay;
|
||||
} else if (type === 'lower') {
|
||||
startDateInput.value = currentYear + '-03-01';
|
||||
endDateInput.value = currentYear + '-07-15';
|
||||
}
|
||||
}
|
||||
|
||||
async function loadSemesters() {
|
||||
const res = await apiGet('/api/semester/list');
|
||||
if (res && res.success) {
|
||||
@@ -200,7 +238,7 @@ async function submitCreateSemester() {
|
||||
});
|
||||
|
||||
if (res && res.success) {
|
||||
showToast('学期创建成功并已激活');
|
||||
showToast(res.message || '学期创建成功');
|
||||
closeModal('createSemesterModal');
|
||||
loadSemesters();
|
||||
} else {
|
||||
@@ -262,10 +300,17 @@ async function viewArchiveData(semesterId, semesterName, page) {
|
||||
<td>${escapeHtml(a.student_no)}</td>
|
||||
<td>${escapeHtml(a.student_name)}</td>
|
||||
<td>${a.final_points}</td>
|
||||
<td>${a.attendance_present || 0}</td>
|
||||
<td>${a.attendance_absent || 0}</td>
|
||||
<td>${a.attendance_late || 0}</td>
|
||||
<td>${a.attendance_leave || 0}</td>
|
||||
<td>${a.homework_submitted || 0}</td>
|
||||
<td>${a.homework_not_submitted || 0}</td>
|
||||
<td>${a.homework_late || 0}</td>
|
||||
</tr>`;
|
||||
});
|
||||
if (archives.length === 0) {
|
||||
html = '<tr><td colspan="4" style="text-align:center;">暂无归档数据</td></tr>';
|
||||
html = '<tr><td colspan="11" style="text-align:center;">暂无归档数据</td></tr>';
|
||||
}
|
||||
document.getElementById('archiveDataList').innerHTML = html;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user