yxh
10 天以前 bd3f4b0a9b9207b647de0f0d8c52600a2742fd56
src/views/ecg/doctor/components/RoutinePanel.vue
@@ -110,11 +110,14 @@
  </div>
  <div class="records-host">
    <ContentWrap class="records-wrap">
      <div class="records-scroll">
      <el-table
        v-loading="loading"
        :data="list"
        :stripe="true"
        :show-overflow-tooltip="true"
        highlight-current-row
        @current-change="onCurrentRowChange"
        @row-click="onRowClick"
      >
      <!--
@@ -130,7 +133,8 @@
            type="warning"
            :disabled="undoDisabled"
            :loading="undoLoading"
            @click="$emit('event_undo_finish')"
            title="先在下方点选一条完成记录,再点此撤销"
            @click="undoSelected"
          >
            撤销
          </el-button>
@@ -143,6 +147,10 @@
          <span v-else-if="scope.row.jobType === 60">已检查</span>
          <span v-if="scope.row.jobType === 50">已放弃</span>
        </template>
      </el-table-column>
      <!-- 【2026-11-25 需求】同一患者一天可能做多个检查项目,必须列出来才能区分是哪条记录(也用于精确撤销) -->
      <el-table-column label="检查项目" align="center" width="150">
        <template #default="scope">{{ getCheckTypeName(scope.row.checkType) }}</template>
      </el-table-column>
      <!--      <el-table-column label="作业类型" align="center" prop="jobType" />-->
      <!--      <el-table-column label="医生编号" align="center" prop="docId" />-->
@@ -177,6 +185,7 @@
      </el-table-column>
-->
      </el-table>
      </div>
    </ContentWrap>
    <!-- 分页 -->
    <Pagination
@@ -274,6 +283,7 @@
import { Barcode } from '@/components/Barcode'
import { useCheckTypeStore } from '@/store/modules/checkType'
import { getCheckTypeName, needAutoFeeConfirm } from '../../../../utils/checkTypeFormatter'
import { copyText } from '@/utils/copyText'
import { useRoomStore } from '@/store/modules/room'
// ⚠️ 必须显式 import:`unplugin-vue-components` 的 globs 只覆盖
//    `src/components/**`(见 build/vite/index.ts 的 Components({ globs: [...] })),
@@ -352,7 +362,19 @@
  formData.value.patIdentityId = queueVO?.patIdentityId
  getFreeRentInfo(formData.value)
}
defineExpose({ setPatient, getList: () => getList() }) // 提供 setPatient 方法,用于设置患者
/**
 * 【叫号自动完成】供父页面点「叫号」时先自动完成当前患者(等同点「检查完成」)。
 * 返回 true=已完成;false=校验/接口失败(父页面应中止叫号并提示)。
 */
const completeCurrent = async (): Promise<boolean> => {
  try {
    return (await submitForm()) === true
  } catch (e) {
    console.warn('[RoutinePanel] 自动「检查完成」失败', e)
    return false
  }
}
defineExpose({ setPatient, getList: () => getList(), examineFromQueue, completeCurrent }) // setPatient 用于设置患者;examineFromQueue 供右侧列表「检查」按钮调用
const { t } = useI18n() // 国际化
const message = useMessage() // 消息弹窗
@@ -471,6 +493,51 @@
  }
}
/**
 * 按「申请单号 / 就诊号 / 患者编号」查预约候选并载入表单。
 * 回车搜索与右侧列表的「检查」按钮**共用这一条路径**,保证两者效果完全一致。
 * 返回 true = 已载入表单;false = 没找到 / 需要用户在弹窗里选。
 */
const searchByCode = async (code: string) => {
  if (!code) return false
  emergencyLoading.value = true
  try {
    const list = (await AppointmentApi.getEmergencyCandidates(code, currentWindowCheckTypes())) as AppointmentVO[]
    const rows = Array.isArray(list) ? list : []
    if (rows.length === 0) {
      message.warning('近一个月内没有找到本窗口检查项目的预约记录')
      return false
    }
    if (rows.length === 1) {
      applyAppointment(rows[0]) // 内部会提示「已读入预约记录,可直接点「检查完成」」
      return true
    }
    emergencyList.value = rows
    emergencySelected.value = undefined
    emergencyVisible.value = true
    return false
  } finally {
    emergencyLoading.value = false
  }
}
/**
 * 【需求·右侧列表「检查」按钮】把列表里的这位患者按「紧急加做」的方式加载进表单。
 * 与在输入框里输入申请单号/就诊号/患者编号后回车**完全同一条路径**:
 *   · 不排队、不取号、不叫号,也**不改他的队列状态** ——
 *     叫号屏/诊间屏上不会出现"就诊中",避免其他病人误以为有人插队;
 *   · 「检查完成」时后端按「患者 + 检查项目」收尾他自己的排队行
 *     (见 DevRentServiceImpl#routineFinishOperation 的 ①b / ①c)。
 */
async function examineFromQueue(item: any) {
  const code = String(item?.applyNo || item?.episodeId || item?.patId || '').trim()
  if (!code) {
    message.warning('该患者没有申请单号/就诊号/患者编号,无法直接检查')
    return false
  }
  return await searchByCode(code)
}
/** 选择框确认(也支持双击行直接确认) */
const confirmEmergency = (row?: AppointmentVO) => {
  const target = row ?? emergencySelected.value
@@ -543,6 +610,7 @@
    emit('event_routine')
    resetForm()
    getList() // 医生作业历史
    return true
  } finally {
    formLoading.value = false
  }
@@ -731,9 +799,32 @@
    const data = await JobRecordApi.getJobRecordDoctorPage(queryParams)
    list.value = data.list
    total.value = data.total
    // 列表刷新后旧的选中行已失效,清掉,避免「撤销」作用到上一屏的记录
    selectedRecord.value = undefined
  } finally {
    loading.value = false
  }
}
/** 【2026-11-25 需求】已完成列表的选中行:撤销前先点选一条,撤销作用在选中记录上 */
const selectedRecord = ref<any>()
const onCurrentRowChange = (row: any) => {
  selectedRecord.value = row || undefined
}
/**
 * 撤销:只撤销**当前选中**的那条完成记录(同一患者可能有多条不同检查项目,必须按行撤销)。
 * 未选中时明确提示,不再默认撤销"最近一条"(原实现医生无法选择,容易撤错人)。
 */
const undoSelected = () => {
  if (!selectedRecord.value) {
    message.warning('请先在「已完成列表」中点选一条记录,再点「撤销」')
    return
  }
  emit('event_undo_finish', {
    ...selectedRecord.value,
    checkTypeName: getCheckTypeName(selectedRecord.value.checkType)
  })
}
const onRowClick = (cur) => {
@@ -875,7 +966,14 @@
const copyBarcode = async () => {
  if (!barcodeContent.value) return
  await navigator.clipboard.writeText(barcodeContent.value)
  // 【兼容 Chrome 85 / http 访问】不能用 navigator.clipboard.writeText 直写,
  // 非安全上下文下它不可用会直接抛错,复制按钮就"没反应"。
  const ok = await copyText(barcodeContent.value)
  if (ok) {
    message.success('已复制')
  } else {
    message.warning('当前浏览器不支持自动复制,请手动选中复制')
  }
}
/** 初始化 **/
@@ -895,7 +993,7 @@
  :deep(.el-alert__title) {
    padding: 0;
    font-size: 13px;
    font-size: 14px;
    line-height: 20px;
  }
@@ -943,7 +1041,7 @@
.emergency-selected-hint {
  float: left;
  line-height: 32px;
  font-size: 13px;
  font-size: 14px;
  color: var(--el-color-primary);
  font-weight: 600;
}
@@ -970,7 +1068,7 @@
  }
  &__text {
    font-size: 14px;
    font-size: 15px;
    font-weight: 600;
    color: var(--el-text-color-primary);
  }
@@ -1047,4 +1145,22 @@
    margin-left: 0;
  }
}
/* ==========================================================================
   【2026-11-25 需求】已完成列表:只显示 4 行左右,超过就出现纵向滚动条
   (实测行高 40px、表头 63px → 63 + 4×40 + 2 = 225px)。
   ========================================================================== */
.records-scroll {
  max-height: 225px;
  min-height: 120px;
  overflow-y: auto;
  overflow-x: hidden;
  :deep(.el-table__header-wrapper) {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: var(--el-bg-color);
  }
}
</style>