fix(dorm): 点名提交后房间卡片立即展示本次统计人数

提交结果里已有在寝、请假、不在人数,卡片原先只标记已点名,人数仍停在加载时的 0。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
“wuzhen”andCursor committed 2026-10-19 08:43:52 +08:00
1 parent a0bb39d069
commit b098b9ec44
1 file changed
+14 -9
+14 -9
View File
@@ -303,19 +303,24 @@ export default {
this.showRoomPopup = true;
},
handleRollCallSubmit() {
if (this.currentRoom) {
// 标记为已完成
if (!this.completedRooms.includes(this.currentRoom.roomId)) {
this.completedRooms.push(this.currentRoom.roomId);
handleRollCallSubmit(submitData) {
const room = this.currentRoom;
if (room) {
if (!this.completedRooms.includes(room.roomId)) {
this.completedRooms.push(room.roomId);
}
// 更新房间的统计信息
const idx = this.rooms.findIndex((r) => r.roomId === this.currentRoom.roomId);
const idx = this.rooms.findIndex((r) => r.roomId === room.roomId);
if (idx >= 0) {
this.rooms[idx].isCompleted = true;
const counts = submitData || {};
const countOf = (value) => (value === undefined || value === null ? 0 : value);
this.$set(this.rooms[idx], 'isCompleted', true);
this.$set(this.rooms[idx], 'presentCount', countOf(counts.presentCount));
this.$set(this.rooms[idx], 'leaveCount', countOf(counts.leaveCount));
this.$set(this.rooms[idx], 'absentCount', countOf(counts.absentCount));
this.$set(this.rooms[idx], 'emptyCount', countOf(counts.emptyCount));
}
}
uni.showToast({ title: `${this.currentRoom?.roomName || ''} 点名完成`, icon: 'success' });
uni.showToast({ title: `${room?.roomName || ''} 点名完成`, icon: 'success' });
this.showRoomPopup = false;
this.currentRoom = null;
},