diff --git a/app/app/static/app.js b/app/app/static/app.js index 7bd6101..fb9020e 100644 --- a/app/app/static/app.js +++ b/app/app/static/app.js @@ -123,6 +123,13 @@ function groupRecordsByTeacher(records) { }); } +function initializeTeacherGroupCollapse(records) { + const groups = groupRecordsByTeacher(records); + collapsedTeacherGroups = groups.length > 1 + ? new Set(groups.map((group) => group.teacher)) + : new Set(); +} + function getDisplayRecord(row) { return correctedRecords.get(row._recordKey) || row; } @@ -811,6 +818,9 @@ async function queryRecords(query, options = {}) { _recordIndex: currentRecordPage.offset + index, _recordKey: makeRecordKey(row, currentRecordPage.offset + index), })); + if (options.reset !== false) { + initializeTeacherGroupCollapse(currentRecords); + } recordRows.innerHTML = renderGroupedRecords(currentRecords); } catch (error) { recordRows.innerHTML = `查询失败:${escapeHtml(error.message)}`;