src/api/ecg/room/index.ts | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/components/RoomBedSelect/src/RoomBedSelect.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/store/modules/user.ts | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/views/ecg/room/RoomLoginSelect.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/api/ecg/room/index.ts
@@ -2,11 +2,11 @@ // 诊室和诊疗床 VO export interface RoomVO { id: number // roomId: number // 诊室编号 roomName: string // 诊室名称 bedNo: string // 诊疗床编号 status: number //开诊状态 0-关闭 1-关闭中 10-已开通 20-有医生 30-暂停 id: number | null // roomId: number | null // 诊室编号 roomName: string | null // 诊室名称 bedNo: string | null // 诊疗床编号 status: number | null //开诊状态 0-关闭 1-关闭中 10-已开通 20-有医生 30-暂停 docId: number | null docName: string | null } src/components/RoomBedSelect/src/RoomBedSelect.vue
@@ -2,7 +2,7 @@ import { RoomApi, RoomVO } from '@/api/ecg/room' import {PropType} from "vue"; import {useUserStore} from "@/store/modules/user"; const emit = defineEmits(['haveSeat']) const emit = defineEmits(['haveSeat', 'leaveSeat']) defineComponent({ name: 'RoomBedSelect' @@ -26,12 +26,11 @@ const userStore = useUserStore() const curUser = userStore.getUser // const emit2 = defineEmits<{ // (e: 'update:curBed', message: string): void; // }>(); const onclick = (newItem) => { const onHaveSeatclick = (newItem) => { emit('haveSeat', newItem) } const onLeaveSeatclick = (curItem) => { emit('leaveSeat', curItem) } /** 初始化 **/ @@ -57,9 +56,12 @@ style="width: 100%" /> <div>{{bedItem.bedNo}} {{bedItem.docName}}</div> <el-button v-if="bedItem.docId === null" @click = onclick(bedItem)> <el-button v-if="bedItem.docId === null" @click = onHaveSeatclick(bedItem)> 入座 </el-button> <el-button v-if="bedItem.docId === curUser.id" @click = onLeaveSeatclick(bedItem)> 离座 </el-button> </div> </div> </el-card> src/store/modules/user.ts
@@ -23,7 +23,7 @@ // 医生诊室选择 isSetRoom: boolean room: RoomVO room: RoomVO | null } export const useUserStore = defineStore('admin-user', { @@ -85,7 +85,7 @@ wsCache.set(CACHE_KEY.USER, userInfo) wsCache.set(CACHE_KEY.ROLE_ROUTERS, userInfo.menus) }, // 医生诊室选择 // 医生入座 async setRoomInfoAction(room: RoomVO) { // 更新 store this.room = room @@ -99,6 +99,20 @@ 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) src/views/ecg/room/RoomLoginSelect.vue
@@ -2,10 +2,13 @@ <div style="display: flex; flex-direction: column; align-items: center;"> <div style="display: flex; flex-wrap: wrap; justify-content: center; margin-bottom: 20px"> <div class=roomwrap v-for="(value, key) in bedMap" :key="key"> <RoomBedSelect :title="key" :bedList="value" :curBed="curSel" @haveSeat="haveSeat"/> <RoomBedSelect :title="key" :bedList="value" :curBed="curSel" @haveSeat="haveSeat" @leaveSeat="leaveSeat"/> </div> </div> <el-button type="primary" @click="roomConfirm">确认</el-button> <div> <el-button type="primary" @click="haveSeatConfirm">入座确认</el-button> <el-button type="primary" @click="leaveSeatConfirm">离座确认</el-button> </div> </div> </template> @@ -15,7 +18,7 @@ import { queueApi } from '@/api/ecg/queue' import {useUserStore} from "@/store/modules/user"; import {ElMessage} from "element-plus"; import {isStringEmpty} from "@/utils/stringUtil" import {isStringEmpty} from "@/utils/stringUtil"; const { push } = useRouter() defineOptions({ name: 'RoomLoginSelect' }) @@ -30,13 +33,13 @@ const originalSel = ref<RoomVO>(); let curSel = ref<RoomVO>({ id: 0, roomId: 0, roomName: "", bedNo: "", status: 0, docId: 0, docName: "" id: null, roomId: null, roomName: null, bedNo: null, status: null, docId: null, docName: null }); /** 查询列表 */ @@ -56,10 +59,8 @@ } } const roomConfirm = async () => { console.info(curSel.value) if (curSel.value.roomId === 0) { const haveSeatConfirm = async () => { if (curSel.value.roomId === null) { ElMessage({ message: '请先选择工作的位置!', type: 'info', @@ -103,9 +104,33 @@ push({ path: route.redirectedFrom?.fullPath}) } const haveSeat = (roomVO: RoomVO) => { console.info(roomVO) const leaveSeatConfirm = async () => { if (curSel.value.roomId !== null) { ElMessage({ message: '请先离开工位, 再确认离座!', type: 'info', duration: 3000 // 自动关闭时间,默认为3000ms }); return } if (originalSel.value !== undefined) { let data = await queueApi.bedDoctorOff(originalSel.value) if (data !== 0) { ElMessage({ message: '内部错误!' + data, type: 'info', duration: 3000 // 自动关闭时间,默认为3000ms }); return } originalSel.value = undefined } userStore.clearRoomInfoAction() } const haveSeat = (roomVO: RoomVO) => { curSel.value.docId = null curSel.value.docName = null @@ -113,6 +138,20 @@ roomVO.docName = curUser.nickname curSel.value = roomVO } const leaveSeat = (roomVO: RoomVO) => { curSel.value.docId = null curSel.value.docName = null curSel.value = { id: null, roomId: null, roomName: null, bedNo: null, status: null, docId: null, docName: null } } /** 初始化 **/ onMounted(() => {