From 936c01060eea0924b88ca5c35d221a972a6aba7d Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期一, 05 十月 2026 10:47:22 +0800
Subject: [PATCH] 检查单列表调整

---
 src/store/modules/user.ts |   73 ++++--------------------------------
 1 files changed, 8 insertions(+), 65 deletions(-)

diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts
index 53f2d69..7cbb93c 100644
--- a/src/store/modules/user.ts
+++ b/src/store/modules/user.ts
@@ -3,11 +3,11 @@
 import { getAccessToken, removeToken } from '@/utils/auth'
 import { CACHE_KEY, useCache, deleteUserCache } from '@/hooks/web/useCache'
 import { getInfo, loginOut } from '@/api/login'
-import {RoomVO} from "@/api/ecg/room";
+import { releaseBedOnExit } from '@/utils/releaseBed'
 
 const { wsCache } = useCache()
 
-interface UserVO {
+export interface UserVO {
   id: number
   avatar: string
   nickname: string
@@ -20,10 +20,6 @@
   roles: string[]
   isSetUser: boolean
   user: UserVO
-
-  // 鍖荤敓璇婂閫夋嫨
-  isSetRoom: boolean
-  room: RoomVO | null
 }
 
 export const useUserStore = defineStore('admin-user', {
@@ -35,19 +31,8 @@
       id: 0,
       avatar: '',
       nickname: '',
-      deptId: 0
+      deptId: 0,
     },
-    // 鍖荤敓璇婂閫夋嫨
-    isSetRoom: false,
-    room: {
-      id: 0,
-      roomId: 0,
-      roomName: "",
-      bedNo: "",
-      status: null,
-      docId: null,
-      docName: null
-    }
   }),
   getters: {
     getPermissions(): string[] {
@@ -62,13 +47,6 @@
     getUser(): UserVO {
       return this.user
     },
-    // 鍖荤敓璇婂閫夋嫨
-    getIsSetRoom(): boolean {
-      return this.isSetRoom
-    },
-    getRoom(): RoomVO | null {
-      return this.room
-    }
   },
   actions: {
     async setUserInfoAction() {
@@ -87,35 +65,6 @@
       wsCache.set(CACHE_KEY.USER, userInfo)
       wsCache.set(CACHE_KEY.ROLE_ROUTERS, userInfo.menus)
     },
-    // 鍖荤敓鍏ュ骇
-    async setRoomInfoAction(room: RoomVO) {
-      // 鏇存柊 store
-      this.room = room
-      this.isSetRoom = true
-
-      // 鏇存柊 cache
-      const userInfo2 = wsCache.get(CACHE_KEY.USER)
-      if (userInfo2) {
-        userInfo2.room = room
-        userInfo2.isSetRoom = true
-        wsCache.set(CACHE_KEY.USER, userInfo2)
-      }
-    },
-    // 鍖荤敓绂诲骇
-    async clearRoomInfoAction() {
-      // 娓� store
-      this.room = null
-      this.isSetRoom = false
-
-      // 鏇存柊 cache
-      const userInfo2 = wsCache.get(CACHE_KEY.USER)
-      if (userInfo2) {
-        userInfo2.room = null
-        userInfo2.isSetRoom = false
-        wsCache.set(CACHE_KEY.USER, userInfo2)
-      }
-    },
-
     async setUserAvatarAction(avatar: string) {
       const userInfo = wsCache.get(CACHE_KEY.USER)
       // NOTE: 鏄惁闇�瑕佸儚`setUserInfoAction`涓�鏍峰垽鏂璥userInfo != null`
@@ -131,6 +80,11 @@
       wsCache.set(CACHE_KEY.USER, userInfo)
     },
     async loginOut() {
+      // 鍏堥噴鏀捐瘖鐤楀簥浣嶏紙鍖荤敓甯稿湪銆岃瘖瀹ら�夋嫨銆嶉〉鍗犱簡搴婁綅灏辩洿鎺ラ��鍑虹郴缁燂級銆�
+      // 鍚庣 `/system/auth/logout` 鍐呴儴铏界劧涔熶細绂诲骇锛屼絾锛�
+      //   鈶� 鑻ヨ璇锋眰澶辫触/缃戠粶涓柇锛屽簥浣嶅氨鐣欏湪鍗犵敤鐘舵�侊紱
+      //   鈶� 鏈帴鍙eけ璐ヤ篃涓嶄細闃绘柇閫�鍑烘祦绋嬶紙releaseBedOnExit 鍐呴儴宸插厹搴曪級銆�
+      await releaseBedOnExit('manual-logout')
       await loginOut()
       removeToken()
       deleteUserCache() // 鍒犻櫎鐢ㄦ埛缂撳瓨
@@ -145,17 +99,6 @@
         avatar: '',
         nickname: '',
         deptId: 0
-      }
-      // 鍖荤敓璇婂閫夋嫨
-      this.isSetRoom = false
-      this.room = {
-        id: 0,
-        roomId: 0,
-        roomName: "",
-        bedNo: "",
-        status: null,
-        docId: null,
-        docName: null
       }
     }
   }

--
Gitblit v1.9.3