yxh
2026-10-18 1446994d504819c367e1ff667360eadb314f9ac6
src/views/ecg/doctor/DevInstall.vue
@@ -40,6 +40,8 @@
const state = ref<boolean>()
const patientList = ref<QueueVO[]>([])
/** 【自助诊断】最近一次取数的说明(空列表时显示) */
const fetchInfo = ref('')
let timerRunFlag : boolean = false
const bedControlFlag = ref<boolean>(true);
@@ -95,13 +97,16 @@
    return
  }
  patientList.value = await DoctorApi.getToBeInstalledPatientList(roomBedVO.value)
  patientList.value = (await DoctorApi.getToBeInstalledPatientList(roomBedVO.value)) || []
  // 【自助诊断】记录本次取数时间与条数(空列表时显示)
  fetchInfo.value = `最近取数 ${new Date().toLocaleTimeString()} · 返回 ${patientList.value.length} 条`
  getInstallingPatient()
  patientStat.value = await DoctorApi.getDevInstallStatistic(roomBedVO.value)
  const queueVO2 = await DoctorApi.bedDoctorGet(roomBedVO.value)
  if (queueVO2.status === 20)
  // 【加固】接口可能返回 null,原来直接取 .status 会抛异常、中断本轮后续步骤
  if (queueVO2 && queueVO2.status === 20)
    state.value = true
  else if (queueVO2.status === 30)
  else if (queueVO2 && queueVO2.status === 30)
    state.value = false
  // 需求3:同步"停止候诊"开关状态
  await loadStopReady()
@@ -188,6 +193,8 @@
      checkType: last.bookCheckType
    } as any)
    ElMessage.success(msg || '已撤销')
    // 【撤销标识】撤销后立刻刷新「已完成记录」列表,让这条记录显示成「已撤销」
    devInstallPanelRef.value?.getList?.()
    await initLoad()
  } finally {
    undoFlag.value = false
@@ -211,12 +218,42 @@
const doctorTimer = () => {
  console.log('doctorTimer ...')
  initLoad()
  // 【加固】单轮取数失败不能变成 unhandled rejection(原来 `initLoad()` 不 await 不 catch,
  // 某轮接口异常会让页面停在旧数据,现场表现就是"列表一直是空的")。
  initLoad().catch((e) => console.error('[doctorTimer] 本轮取数失败(已忽略,下一轮继续)', e))
  if (timerRunFlag)
    setTimeout(doctorTimer, 5000) // five seconds
}
/** 初始化 **/
/**
 * 【主/围观】跟随 store 切换"正在查看的工位"(原来只在 onMounted 拷一次,
 * 切到别的人工位围观后本页数据不变,必须刷新页面才生效)。
 */
watch(
  () => [roomStore.room?.roomId, roomStore.room?.bedNo],
  async () => {
    if (!roomStore.room) return
    roomBedVO.value.roomId = roomStore.room.roomId
    roomBedVO.value.roomName = roomStore.room.roomName
    roomBedVO.value.bedNo = roomStore.room.bedNo
    roomBedVO.value.checkTypes = roomStore.room.checkTypes
    roomBedVO.value.opType = roomStore.room.opType
    // 【本次需求】换工位后**整页数据都换成新工位的**:
    // ① 先清空左侧"患者信息"(避免还显示上一个工位的患者)
    devInstallPanelRef.value?.setPatient?.(undefined)
    // ② 启动/继续取数定时器(待装列表、统计、当前叫号患者、停止候诊开关都会刷新)
    if (!timerRunFlag && roomBedVO.value.roomId != null) {
      timerRunFlag = true
      doctorTimer()
    } else if (roomBedVO.value.roomId != null) {
      await initLoad()
    }
    // ③ 刷新「已完成列表」(面板内会按新工位的 checkTypes 重新过滤)
    devInstallPanelRef.value?.getList?.()
  }
)
onMounted(() => {
  timerRunFlag = false
  bedControlFlag.value = true
@@ -278,7 +315,7 @@
    布局优化:功能按钮固定在页面底部,不再用 position:absolute 浮在内容上。
    详见 components/DoctorPageLayout(与叫号检查/设备领用页共用同一布局)。
  -->
  <DoctorPageLayout>
  <DoctorPageLayout :bed-switch-enabled="false">
    <template #header>
      <TitlePanel :titleType=2 :room="roomBedVO" :patientStatistic="patientStat" />
    </template>
@@ -293,7 +330,8 @@
    />
    <template #aside>
      <QueuePanel :room="roomBedVO" :queue="patientList" @event_RecallFinish="onEventRecallFinish"/>
      <QueuePanel :room="roomBedVO" :queue="patientList" :fetch-info="fetchInfo"
                  @event_RecallFinish="onEventRecallFinish"/>
    </template>