From 17046362ab95b09b659c03892990d8c2b0f862d1 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期一, 02 九月 2024 10:54:23 +0800
Subject: [PATCH] fix bug 入座 离座

---
 src/views/ecg/room/RoomLoginSelect.vue |   17 +++++------------
 src/views/ecg/doctor/index.vue         |    2 --
 src/store/modules/user.ts              |   19 +++++++++++++------
 3 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts
index 60867c8..a611f6c 100644
--- a/src/store/modules/user.ts
+++ b/src/store/modules/user.ts
@@ -23,7 +23,7 @@
 
   // 鍖荤敓璇婂閫夋嫨
   isSetRoom: boolean
-  room: RoomVO | null
+  room: RoomVO
 }
 
 export const useUserStore = defineStore('admin-user', {
@@ -40,10 +40,10 @@
     // 鍖荤敓璇婂閫夋嫨
     isSetRoom: false,
     room: {
-      id: 0,
-      roomId: 0,
-      roomName: "",
-      bedNo: "",
+      id: null,
+      roomId: null,
+      roomName: null,
+      bedNo: null,
       status: null,
       docId: null,
       docName: null
@@ -110,7 +110,14 @@
     // 鍖荤敓绂诲骇
     async clearRoomInfoAction() {
       // 娓� store
-      this.room = null
+      this.room.id = null
+      this.room.roomId = null
+      this.room.roomName = null
+      this.room.bedNo = null
+      this.room.status = null
+      this.room.docId = null
+      this.room.docName = null
+
       this.isSetRoom = false
 
       // 鏇存柊 cache
diff --git a/src/views/ecg/doctor/index.vue b/src/views/ecg/doctor/index.vue
index a9454cc..1aeba57 100644
--- a/src/views/ecg/doctor/index.vue
+++ b/src/views/ecg/doctor/index.vue
@@ -93,7 +93,6 @@
 
 /** 鍒濆鍖� **/
 onMounted(() => {
-  console.info("onMounted - doctor " + userStore.isSetRoom + " " + userStore.room.roomId)
   timerRunFlag = false
   bedControlFlag.value = true
   finishFlag.value = true
@@ -117,7 +116,6 @@
 })
 
 onUnmounted( () =>{
-  console.info("onUnmounted - doctor " + userStore.isSetRoom + " " + userStore.room.roomId)
   timerRunFlag = false
 })
 
diff --git a/src/views/ecg/room/RoomLoginSelect.vue b/src/views/ecg/room/RoomLoginSelect.vue
index 75bb07c..9e5c25a 100644
--- a/src/views/ecg/room/RoomLoginSelect.vue
+++ b/src/views/ecg/room/RoomLoginSelect.vue
@@ -68,8 +68,9 @@
       const roomVOArray = data[key] as RoomVO[];
       roomVOArray.forEach((roomVO) => {
           if (roomVO.docId === curUser.id) {
-              curSel.value = roomVO
-              return
+            curSel.value = roomVO
+            userStore.setRoomInfoAction(curSel.value)
+            return
           }
       } )
   }
@@ -89,8 +90,6 @@
         return
       }
     }
-    curSel.value.docId = null
-    curSel.value.docName = null
 
     const tempRoomVO = cloneDeep(newRoomVO)
     tempRoomVO.docId = curUser.id
@@ -105,10 +104,7 @@
       return
     }
 
-    newRoomVO.docId = curUser.id
-    newRoomVO.docName = curUser.nickname
-    curSel.value = newRoomVO
-    userStore.setRoomInfoAction(curSel.value)
+    getList()
   }
 
   if (isStringEmpty(route.redirectedFrom?.fullPath))
@@ -130,12 +126,10 @@
           });
           return
       }
-
-    curSel.value.docId = null
-    curSel.value.docName = null
   }
 
   userStore.clearRoomInfoAction()
+  getList()
 }
 
 const haveSeat = async (newRoomVO: RoomVO) => {
@@ -182,7 +176,6 @@
     return
   }
 
-  userStore.setRoomInfoAction(curSel.value)
   if (isStringEmpty(route.redirectedFrom?.fullPath))
     push({ path: "/"})
   else if(route.redirectedFrom?.fullPath === "/roomselect" )

--
Gitblit v1.9.3