yxh
2026-10-18 01ee694a3bb8048372fc793a8de314d70b688b35
src/views/ecg/doctor/DevInstall.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 {useRoomStore} from "@/store/modules/room";
const roomStore = useRoomStore();
@@ -89,11 +90,9 @@
const initLoad = async () => {
  if (roomBedVO.value.roomId == null) {
    ElNotification.error({
      message: '请重新就座!',
      type: 'info',
      duration: 3000 // 自动关闭时间,默认为3000ms
    })
    // 【本需求】没有工位:停掉轮询并只提示一次(原来每 5 秒弹一次,现场表现就是一直跳)
    timerRunFlag = false
    notifySeatInvalidOnce()
    return
  }
@@ -102,7 +101,19 @@
  fetchInfo.value = `最近取数 ${new Date().toLocaleTimeString()} · 返回 ${patientList.value.length} 条`
  getInstallingPatient()
  patientStat.value = await DoctorApi.getDevInstallStatistic(roomBedVO.value)
  const queueVO2 = await DoctorApi.bedDoctorGet(roomBedVO.value)
  // 【本需求】bed-doctor-get 是【我是否还坐在这里】的判定:失败说明工位已被释放 / 他人接手,
  // 此时停掉轮询并一次性提示,避免每 5 秒刷一次【请重新就座】。
  let queueVO2: any
  try {
    queueVO2 = await DoctorApi.bedDoctorGet(roomBedVO.value)
  } catch (e: any) {
    if (isSeatInvalidError(e)) {
      timerRunFlag = false
      notifySeatInvalidOnce()
      return
    }
    throw e
  }
  // 【加固】接口可能返回 null,原来直接取 .status 会抛异常、中断本轮后续步骤
  if (queueVO2 && queueVO2.status === 20)
    state.value = true
@@ -239,6 +250,8 @@
    roomBedVO.value.bedNo = roomStore.room.bedNo
    roomBedVO.value.checkTypes = roomStore.room.checkTypes
    roomBedVO.value.opType = roomStore.room.opType
    // 【本需求】重新拿到工位 -> 复位【工位失效】提示,允许下次再提示一次
    resetSeatInvalidNotify()
    // 【本次需求】换工位后**整页数据都换成新工位的**:
    // ① 先清空左侧"患者信息"(避免还显示上一个工位的患者)
    devInstallPanelRef.value?.setPatient?.(undefined)
@@ -266,6 +279,7 @@
    roomBedVO.value.bedNo = roomStore.room!.bedNo
    roomBedVO.value.checkTypes = roomStore.room!.checkTypes
    roomBedVO.value.opType = roomStore.room!.opType
    resetSeatInvalidNotify()
    timerRunFlag = true
    doctorTimer()