1
0
mirror of https://github.com/ZeroCatDev/Classworks.git synced 2025-12-07 21:13:11 +00:00

feat: 更新考勤管理逻辑,优化状态同步与自动保存功能

This commit is contained in:
Sunwuyuan 2025-11-29 15:18:21 +08:00
parent ca3d7c9dbf
commit 069f0a31c0
No known key found for this signature in database
GPG Key ID: A6A54CF66F56BB64

View File

@ -122,7 +122,7 @@
:attendance="state.boardData.attendance"
:date-string="state.dateString"
@save="saveAttendance"
@change="state.synced = false"
@change="handleAttendanceChange"
/>
<message-log ref="messageLog" />
@ -343,6 +343,7 @@ export default {
students: false,
},
debouncedUpload: null,
debouncedAttendanceSave: null,
throttledReflow: null,
sortedItemsCache: {
key: "",
@ -615,10 +616,20 @@ export default {
},
deep: true,
},
"state.attendanceDialog": {
handler(newValue) {
this.handleAttendanceDialogClose(newValue);
},
},
},
created() {
this.debouncedUpload = debounce(this.uploadData, 2000);
this.debouncedAttendanceSave = debounce(async () => {
if (this.autoSave) {
await this.trySave(true);
}
}, 2000);
this.throttledReflow = throttle(() => {
if (this.$refs.gridContainer) {
this.optimizeGridLayout(this.sortedItems);
@ -1400,6 +1411,11 @@ export default {
return this.trySave(false);
},
handleAttendanceChange() {
this.state.synced = false;
this.debouncedAttendanceSave();
},
async handleAttendanceDialogClose(newValue) {
if (!newValue && !this.state.synced) {
await this.trySave(true);