| | |
| | | <div class="room-select__scroll"> |
| | | <div class="room-select__list"> |
| | | <div class="room-select__item" v-for="(bed, index) in bedList" :key="`${bed.roomId}-${bed.bedNo}-${index}`"> |
| | | <RoomBedSelect :bed="bed" :curBed="curSel" :curUser='curUser' @event-haveseat="haveSeat" @event-leaveseat="leaveSeat" @event-setcurseat="setCurSeat"/> |
| | | <RoomBedSelect :bed="bed" :curBed="curSel" :curUser='curUser' @event-haveseat="haveSeat" @event-leaveseat="leaveSeat" @event-setcurseat="setCurSeat" @event-takeover="takeOverConfirm"/> |
| | | </div> |
| | | <el-empty v-if="isEmptyOpeningBed" class="room-select__empty" description="工位没有开放"/> |
| | | </div> |
| | |
| | | tempRoomVO.docId = curUser.id |
| | | tempRoomVO.docName = curUser.nickname |
| | | |
| | | // 【本次需求】走 store 的入座动作:服务端入座成功后会**自动释放我这个账号的其它工位** |
| | | // (一人一工位),并把工位信息写进会话缓存。 |
| | | // 【本需求·一人多工位】走 store 的入座动作:服务端**不再释放**我账号下的其它工位, |
| | | // 因此这里是"新增一个我的工位"(值班多岗位),并把工位信息写进会话缓存。 |
| | | const seated = await roomStore.seatRoom(tempRoomVO) |
| | | if (!seated) { |
| | | // 失败时自动调诊断接口,把库里真实行与结论一起给出(便于现场一键定位) |
| | |
| | | gotoAfterSeat(newRoomVO.opType, false) |
| | | } |
| | | |
| | | /** |
| | | * 【本需求·接班自助接管】对"别人占用"的工位执行接管。 |
| | | * |
| | | * 场景:上一班医生下班没点「离座」,下一班医生在同一工位接班 —— 原来只能找管理员清空。 |
| | | * 现在:二次确认 → 后端强制原占用人离座并把工位给我 → 刷新列表/我的工位。 |
| | | */ |
| | | const takeOverConfirm = async (roomVO: RoomVO) => { |
| | | const bedText = `${roomVO.roomName || '诊室' + roomVO.roomId} · ${roomVO.bedNo}` |
| | | const owner = roomVO.docName || '其他医生' |
| | | try { |
| | | await ElMessageBox.confirm( |
| | | `工位「${bedText}」当前由「${owner}」占用。\n` + |
| | | `确认接管?接管后「${owner}」将被强制离座(其页面会提示重新就坐),工位立即归你使用。`, |
| | | '接管工位', |
| | | { confirmButtonText: '确认接管', cancelButtonText: '取消', type: 'warning' } |
| | | ) |
| | | } catch { |
| | | return |
| | | } |
| | | const ok = await roomStore.takeOverBed(roomVO.roomId, roomVO.bedNo) |
| | | if (!ok) { |
| | | ElMessage({ message: '接管失败,请稍后重试或联系管理员', type: 'error', duration: 4000 }) |
| | | return |
| | | } |
| | | ElMessage.success(`已接管工位:${bedText}`) |
| | | resetCurSel() |
| | | curSel.value = { ...roomVO, docId: curUser.id, docName: curUser.nickname } |
| | | await roomStore.fetchMySeat() |
| | | await getList() |
| | | // 接管后进入该岗位对应的工作台(接管会带上该工位"就诊中"患者) |
| | | gotoAfterSeat(roomVO.opType, true) |
| | | } |
| | | |
| | | const leaveSeatConfirm = async (roomVO: RoomVO) => { |
| | | // 【本次需求】离座只能清**自己的** doc_id(服务端 setBedDoctorOff 已加 doc_id 条件), |
| | | // 这里先拦一道,避免"旁观/其他医生"点离座把正在操作的人踢掉。 |