|
|
@@ -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;
|
|
|
},
|