room store 改为 sessionStorage
| | |
| | | // ç¨æ·ç¸å
³ |
| | | ROLE_ROUTERS: 'roleRouters', |
| | | USER: 'user', |
| | | ROOM: 'room', |
| | | // ç³»ç»è®¾ç½® |
| | | IS_DARK: 'isDark', |
| | | LANG: 'lang', |
| | |
| | | import { useCheckTypeStoreWithOut } from '@/store/modules/checkType' |
| | | import { useUserStoreWithOut } from '@/store/modules/user' |
| | | import { usePermissionStoreWithOut } from '@/store/modules/permission' |
| | | import { useRoomStoreWithOut } from "@/store/modules/room"; |
| | | |
| | | const { start, done } = useNProgress() |
| | | |
| | |
| | | // è·åææåå
¸ |
| | | const dictStore = useDictStoreWithOut() |
| | | const userStore = useUserStoreWithOut() |
| | | const roomStore = useRoomStoreWithOut() |
| | | const checkTypeStore = useCheckTypeStoreWithOut() |
| | | const permissionStore = usePermissionStoreWithOut() |
| | | if (!dictStore.getIsSetDict) { |
| | |
| | | // <<<ãè¯å®¤éæ©ã<<< |
| | | if ( to.path !== '/roomselect' && |
| | | userStore.getRoles.includes("doctor") && !userStore.getRoles.includes("super_admin") |
| | | && !userStore.getIsSetRoom ) { |
| | | && !roomStore.getIsSetRoom ) { |
| | | next({path: `/roomselect?redirect=${to.fullPath}`}) |
| | | return |
| | | } |
| | |
| | | // <<<ãè¯å®¤éæ©ã<<< |
| | | if ( to.path !== '/roomselect' && |
| | | userStore.getRoles.includes("doctor") && !userStore.getRoles.includes("super_admin") |
| | | && !userStore.getIsSetRoom ) { |
| | | && !roomStore.getIsSetRoom ) { |
| | | next({path: `/roomselect?redirect=${to.fullPath}`}) |
| | | return |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { store } from '@/store' |
| | | import { defineStore } from 'pinia' |
| | | import { CACHE_KEY, useCache } from '@/hooks/web/useCache' |
| | | import {RoomVO} from "@/api/ecg/room"; |
| | | |
| | | const { wsCache } = useCache("sessionStorage") |
| | | |
| | | interface RoomInfoVO { |
| | | // å»çè¯å®¤éæ© |
| | | isSetRoom: boolean |
| | | room: RoomVO |
| | | } |
| | | |
| | | export const useRoomStore = defineStore('current-room', { |
| | | state: (): RoomInfoVO => ({ |
| | | // å»çè¯å®¤éæ© |
| | | isSetRoom: false, |
| | | room: { |
| | | id: null, |
| | | roomId: null, |
| | | roomName: null, |
| | | bedNo: null, |
| | | ip: null, |
| | | status: null, |
| | | docId: null, |
| | | docName: null, |
| | | checkTypes: null, |
| | | opType: null |
| | | } |
| | | }), |
| | | getters: { |
| | | // å»çè¯å®¤éæ© |
| | | getIsSetRoom(): boolean { |
| | | return this.isSetRoom |
| | | }, |
| | | getRoom(): RoomVO | null { |
| | | return this.room |
| | | } |
| | | }, |
| | | actions: { |
| | | // å»çå
¥åº§ |
| | | async setRoomInfoAction(room: RoomVO) { |
| | | // æ´æ° store |
| | | this.room!.id = room.id |
| | | this.room!.roomId = room.roomId |
| | | this.room!.roomName = room.roomName |
| | | this.room!.bedNo = room.bedNo |
| | | this.room!.status = room.status |
| | | this.room!.docId = room.docId |
| | | this.room!.docName = room.docName |
| | | this.room!.checkTypes = room.checkTypes |
| | | this.room!.opType = room.opType |
| | | this.isSetRoom = true |
| | | |
| | | // æ´æ° cache |
| | | const bedInfo = wsCache.get(CACHE_KEY.ROOM) |
| | | if (bedInfo) { |
| | | bedInfo.room = room |
| | | bedInfo.isSetRoom = true |
| | | wsCache.set(CACHE_KEY.ROOM, bedInfo) |
| | | } |
| | | }, |
| | | // å»ç离座 |
| | | async clearRoomInfoAction() { |
| | | // æ¸
store |
| | | 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 |
| | | const roomInfo = wsCache.get(CACHE_KEY.ROOM) |
| | | if (roomInfo) { |
| | | roomInfo.room = null |
| | | roomInfo.isSetRoom = false |
| | | wsCache.set(CACHE_KEY.ROOM, roomInfo) |
| | | } |
| | | }, |
| | | } |
| | | }) |
| | | |
| | | export const useRoomStoreWithOut = () => { |
| | | return useRoomStore(store) |
| | | } |
| | |
| | | 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"; |
| | | |
| | | const { wsCache } = useCache() |
| | | |
| | |
| | | roles: string[] |
| | | isSetUser: boolean |
| | | user: UserVO |
| | | |
| | | // å»çè¯å®¤éæ© |
| | | isSetRoom: boolean |
| | | room: RoomVO |
| | | } |
| | | |
| | | export const useUserStore = defineStore('admin-user', { |
| | |
| | | nickname: '', |
| | | deptId: 0 |
| | | }, |
| | | // å»çè¯å®¤éæ© |
| | | isSetRoom: false, |
| | | room: { |
| | | id: null, |
| | | roomId: null, |
| | | roomName: null, |
| | | bedNo: null, |
| | | ip: null, |
| | | status: null, |
| | | docId: null, |
| | | docName: null, |
| | | checkTypes: null, |
| | | opType: null |
| | | } |
| | | }), |
| | | getters: { |
| | | getPermissions(): string[] { |
| | |
| | | getUser(): UserVO { |
| | | return this.user |
| | | }, |
| | | // å»çè¯å®¤éæ© |
| | | getIsSetRoom(): boolean { |
| | | return this.isSetRoom |
| | | }, |
| | | getRoom(): RoomVO | null { |
| | | return this.room |
| | | } |
| | | }, |
| | | actions: { |
| | | async setUserInfoAction() { |
| | |
| | | wsCache.set(CACHE_KEY.USER, userInfo) |
| | | wsCache.set(CACHE_KEY.ROLE_ROUTERS, userInfo.menus) |
| | | }, |
| | | // å»çå
¥åº§ |
| | | async setRoomInfoAction(room: RoomVO) { |
| | | // æ´æ° store |
| | | this.room!.id = room.id |
| | | this.room!.roomId = room.roomId |
| | | this.room!.roomName = room.roomName |
| | | this.room!.bedNo = room.bedNo |
| | | this.room!.status = room.status |
| | | this.room!.docId = room.docId |
| | | this.room!.docName = room.docName |
| | | this.room!.checkTypes = room.checkTypes |
| | | this.room!.opType = room.opType |
| | | 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.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 |
| | | 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` |
| | |
| | | avatar: '', |
| | | nickname: '', |
| | | deptId: 0 |
| | | } |
| | | // å»çè¯å®¤éæ© |
| | | this.isSetRoom = false |
| | | this.room = { |
| | | id: 0, |
| | | roomId: 0, |
| | | roomName: "", |
| | | bedNo: "", |
| | | ip: "", |
| | | status: null, |
| | | docId: null, |
| | | docName: null, |
| | | checkTypes: null, |
| | | opType: null |
| | | } |
| | | } |
| | | } |
| | |
| | | import TitlePanel from "@/views/ecg/doctor/components/TitlePanel.vue"; |
| | | import QueuePanel from "@/views/ecg/doctor/components/QueuePanel.vue"; |
| | | import {DoctorApi, PatientStatisticVO, RoomBedVO} from '@/api/ecg/doctor'; |
| | | import {useUserStore} from "@/store/modules/user"; |
| | | import {QueueVO} from "@/api/ecg/queue"; |
| | | import {ElNotification} from "element-plus"; |
| | | import DevReadyPanel from "@/views/ecg/doctor/components/DevReadyPanel.vue"; |
| | | import RoutinePanel from "@/views/ecg/doctor/components/RoutinePanel.vue"; |
| | | import {useRoomStore} from "@/store/modules/room"; |
| | | |
| | | const userStore = useUserStore(); |
| | | const roomStore = useRoomStore(); |
| | | |
| | | const roomBedVO: RoomBedVO = { |
| | | roomId: null, |
| | |
| | | } |
| | | |
| | | const onStagePatient = ref<QueueVO>({ |
| | | bedNo: "", bookCheckType: 0, bookTimeslot: 0, expired: 0, id: 0, jumpFlag: 0, passed: 0, |
| | | patGender: 0, patId: "", patName: "", roomId: 0, roomName: "", seqNum: 0, status: 0 |
| | | id: 0, patId: "", patName: "", patGender: 0, |
| | | bookTimeslot: 0, bookCheckType: 0, isVip: 0, seqNum: 0, bookSeqNum: 0, |
| | | passed: 0, expired: 0, jumpFlag: 0, |
| | | roomId: 0, roomName: "", bedNo: "", status: 0 |
| | | }) |
| | | |
| | | const patientStat = ref<PatientStatisticVO>({ |
| | | finishedNum: 0, |
| | | readyNum: 0, |
| | | receivedNum: 0, |
| | | passedNum: 0, |
| | | queuingNum: 0 |
| | | }) |
| | |
| | | finishFlag.value = true |
| | | passFlag.value = true |
| | | |
| | | if (userStore.isSetRoom) { |
| | | roomBedVO.roomId = userStore.room!.roomId |
| | | roomBedVO.roomName = userStore.room!.roomName |
| | | roomBedVO.bedNo = userStore.room!.bedNo |
| | | roomBedVO.checkTypes = userStore.room!.checkTypes |
| | | roomBedVO.opType = userStore.room!.opType |
| | | if (roomStore.isSetRoom) { |
| | | roomBedVO.roomId = roomStore.room!.roomId |
| | | roomBedVO.roomName = roomStore.room!.roomName |
| | | roomBedVO.bedNo = roomStore.room!.bedNo |
| | | roomBedVO.checkTypes = roomStore.room!.checkTypes |
| | | roomBedVO.opType = roomStore.room!.opType |
| | | |
| | | timerRunFlag = true |
| | | doctorTimer() |
| | |
| | | import TitlePanel from "@/views/ecg/doctor/components/TitlePanel.vue"; |
| | | import QueuePanel from "@/views/ecg/doctor/components/QueuePanel.vue"; |
| | | import {DoctorApi, PatientStatisticVO, RoomBedVO} from '@/api/ecg/doctor'; |
| | | import {useUserStore} from "@/store/modules/user"; |
| | | import {QueueVO} from "@/api/ecg/queue"; |
| | | import {ElNotification} from "element-plus"; |
| | | import DevReadyPanel from "@/views/ecg/doctor/components/DevReadyPanel.vue"; |
| | | import {useRoomStore} from "@/store/modules/room"; |
| | | |
| | | const userStore = useUserStore(); |
| | | const roomStore = useRoomStore(); |
| | | |
| | | const roomBedVO: RoomBedVO = { |
| | | roomId: null, |
| | |
| | | finishFlag.value = true |
| | | passFlag.value = true |
| | | |
| | | if (userStore.isSetRoom) { |
| | | roomBedVO.roomId = userStore.room!.roomId |
| | | roomBedVO.roomName = userStore.room!.roomName |
| | | roomBedVO.bedNo = userStore.room!.bedNo |
| | | roomBedVO.checkTypes = userStore.room!.checkTypes |
| | | roomBedVO.opType = userStore.room!.opType |
| | | if (roomStore.isSetRoom) { |
| | | roomBedVO.roomId = roomStore.room!.roomId |
| | | roomBedVO.roomName = roomStore.room!.roomName |
| | | roomBedVO.bedNo = roomStore.room!.bedNo |
| | | roomBedVO.checkTypes = roomStore.room!.checkTypes |
| | | roomBedVO.opType = roomStore.room!.opType |
| | | |
| | | timerRunFlag = true |
| | | doctorTimer() |
| | |
| | | import {isStringEmpty} from "@/utils/stringUtil"; |
| | | import {cloneDeep} from "lodash-es"; |
| | | import {DoctorApi} from "@/api/ecg/doctor"; |
| | | import {useRoomStore} from "@/store/modules/room"; |
| | | const { push } = useRouter() |
| | | |
| | | defineOptions({ name: 'RoomLoginSelect' }) |
| | |
| | | const route = useRoute(); |
| | | |
| | | const userStore = useUserStore() |
| | | const roomStore = useRoomStore() |
| | | const curUser = userStore.getUser |
| | | |
| | | const isEmptyOpeningBed = ref<boolean>(true); |
| | |
| | | bedNo: null, |
| | | status: null, |
| | | docId: null, |
| | | docName: null |
| | | docName: null, |
| | | ip: "", |
| | | checkTypes: [], |
| | | opType: 0 |
| | | }) |
| | | |
| | | /** åå§å **/ |
| | |
| | | roomVOArray.forEach((roomVO) => { |
| | | if (roomVO.docId === curUser.id) { |
| | | curSel.value = roomVO |
| | | userStore.setRoomInfoAction(curSel.value) |
| | | roomStore.setRoomInfoAction(curSel.value) |
| | | } |
| | | }) |
| | | } |
| | |
| | | } |
| | | |
| | | resetCurSel() |
| | | userStore.clearRoomInfoAction() |
| | | await roomStore.clearRoomInfoAction() |
| | | |
| | | const tempRoomVO = cloneDeep(newRoomVO) |
| | | tempRoomVO.docId = curUser.id |
| | |
| | | return |
| | | } |
| | | |
| | | userStore.setRoomInfoAction(tempRoomVO) |
| | | await roomStore.setRoomInfoAction(tempRoomVO) |
| | | newRoomVO.docId = curUser.id |
| | | newRoomVO.docName = curUser.nickname |
| | | curSel.value = newRoomVO; |
| | |
| | | } |
| | | |
| | | resetCurSel() |
| | | userStore.clearRoomInfoAction() |
| | | await roomStore.clearRoomInfoAction() |
| | | getList() |
| | | } |
| | | |