yxh
2026-10-18 01ee694a3bb8048372fc793a8de314d70b688b35
src/views/ecg/doctor/Routine.vue
@@ -9,8 +9,9 @@
import QueuePanel from '@/views/ecg/doctor/components/QueuePanel.vue'
import DoctorPageLayout from '@/components/DoctorPageLayout/src/DoctorPageLayout.vue'
import { DoctorApi, PatientStatisticVO, RoomBedVO, } from '@/api/ecg/doctor'
import { notifySeatInvalidOnce, isSeatInvalidError, resetSeatInvalidNotify } from '@/utils/seatGuard'
import { QueueVO } from '@/api/ecg/queue'
import { ElMessage, ElMessageBox, ElNotification } from 'element-plus'
import { ElMessage, ElMessageBox } from 'element-plus'
import RoutinePanel from '@/views/ecg/doctor/components/RoutinePanel.vue'
import { useRoomStore } from '@/store/modules/room'
@@ -303,11 +304,9 @@
const initLoad = async () => {
  if (roomBedVO.roomId == null) {
    ElNotification.error({
      message: '请重新就座!',
      type: 'info',
      duration: 3000 // 自动关闭时间,默认为3000ms
    })
    // 【本需求】没有工位:**停掉轮询**并只提示一次(原来每 5 秒弹一次,现场表现就是"一直跳")
    timerRunFlag = false
    notifySeatInvalidOnce()
    return
  }
@@ -318,7 +317,19 @@
  loadRoomWaitingList()
  getOnstagePatient()
  patientStat.value = await DoctorApi.getPatientStatistic(roomBedVO)
  const queueVO2 = await DoctorApi.bedDoctorGet(roomBedVO)
  // 【本需求】bed-doctor-get 是"我是否还坐在这里"的判定:失败说明工位已被释放 / 他人接手,
  // 此时停掉轮询并一次性提示,避免每 5 秒刷一次"请重新就座"。
  let queueVO2: any
  try {
    queueVO2 = await DoctorApi.bedDoctorGet(roomBedVO)
  } catch (e: any) {
    if (isSeatInvalidError(e)) {
      timerRunFlag = false
      notifySeatInvalidOnce()
      return
    }
    throw e
  }
  // 【加固】接口可能返回 null,原来直接取 .status 会抛异常、中断本轮后续步骤
  if (queueVO2 && queueVO2.status === 20) state.value = true
  else if (queueVO2 && queueVO2.status === 30) state.value = false
@@ -366,6 +377,8 @@
    roomBedVO.bedNo = roomStore.room.bedNo
    roomBedVO.checkTypes = roomStore.room.checkTypes
    roomBedVO.opType = roomStore.room.opType
    // 【本需求】重新拿到工位 -> 复位【工位失效】提示,允许下次再提示一次
    resetSeatInvalidNotify()
    // 【本次需求】换工位后**整页数据都换成新工位的**:
    // ① 先清空左侧"患者信息"(避免还显示上一个工位的患者)
    routimePanelRef.value?.setPatient?.(undefined)
@@ -394,6 +407,7 @@
    roomBedVO.bedNo = roomStore.room!.bedNo
    roomBedVO.checkTypes = roomStore.room!.checkTypes
    roomBedVO.opType = roomStore.room!.opType
    resetSeatInvalidNotify()
    timerRunFlag = true
    doctorTimer()