yxh
2026-11-26 bd3f4b0a9b9207b647de0f0d8c52600a2742fd56
src/views/ecg/doctor/components/DevReadyPanel.vue
@@ -14,19 +14,19 @@
    >
      <!-- ===== 编辑区(需要录入的字段)===== -->
      <el-row :gutter="20">
        <el-col :span="6">
        <el-col :xs="24" :sm="12" :md="12" :lg="6">
          <el-form-item label="检查项目" prop="">
            {{getCheckTypeName(formData.checkType)}}
          </el-form-item>
        </el-col>
        <el-col :span="12">
        <el-col :xs="24" :sm="24" :md="12" :lg="12">
          <el-form-item label="患者编号" prop="patId">
            <el-input v-model="formData.patId" placeholder="请输入患者编号" @input="getRentInfoByPatId" />
            <Barcode v-if="displayBarCode" :value="displayBarCode" :width=100 />
            <el-button @click="copyBarcode()">复制</el-button>
            <Barcode v-if="showBarCode" :value="barcodeContent" :width=100 />
            <el-button v-if="showCopyButton" :disabled="!barcodeContent" @click="copyBarcode()">复制</el-button>
          </el-form-item>
        </el-col>
        <el-col :span="6">
        <el-col :xs="24" :sm="12" :md="12" :lg="6">
          <el-form-item label="设备编号" prop="devId">
            <el-input v-model="formData.devId" placeholder="请输入设备编号" @input="getDevInfo"/>
          </el-form-item>
@@ -81,11 +81,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"
    >
      <!-- 需求11(修正):「撤销」作为**已完成领用记录列表的第一列**(表头插槽),
@@ -97,7 +100,8 @@
            type="warning"
            :disabled="undoDisabled"
            :loading="undoLoading"
            @click="$emit('event_undo_finish')"
            title="先在下方点选一条完成记录,再点此撤销"
            @click="undoSelected"
          >
            撤销
          </el-button>
@@ -115,6 +119,10 @@
          <span v-else-if="scope.row.jobType === 5">"已领用"</span>
          <span v-if="scope.row.jobType === 30">"已放弃"</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" />-->
@@ -162,6 +170,7 @@
      </el-table-column>
-->
    </el-table>
    </div>
    </ContentWrap>
    <!-- 分页 -->
    <Pagination
@@ -191,6 +200,7 @@
import {calGender, getBookBeginTime} from "@/utils";
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import {tranlateDevState} from "@/utils/statusFormatter";
import { copyText } from '@/utils/copyText'
import {getCheckTypeName, needAutoFeeConfirm, needDevReady} from "../../../../utils/checkTypeFormatter";
import { useRoomStore } from '@/store/modules/room'
// 需求1:患者信息 18 项统一展示块
@@ -258,7 +268,6 @@
  state: undefined,
})
const displayBarCode = ref<string> ()
const getRentInfoByPatId = () => {
  const tempPatId = formData.value.patId;
@@ -268,7 +277,6 @@
  formData.value.patId = tempPatId;
  getFreeRentInfo(formData.value)
  copyBarcode()
}
// 根据患者或设备, 获取 Free的租赁
@@ -316,7 +324,7 @@
      `「${ctName}」不需要设备领用,不能在设备领用模块办理。` +
      `请确认是否应到「叫号检查」页面处理该患者。`
    )
    return
    return false
  }
  // 校验表单
@@ -343,6 +351,7 @@
    // 发送操作成功的事件
    emit('event_dev_ready')
    message.success(t('操作完成'))
    return true
  } finally {
    formLoading.value = false
  }
@@ -437,9 +446,19 @@
    formData.value.doctorAdviceNo = queueVO?.doctorAdviceNo
  formData.value.patIdentityId = queueVO?.patIdentityId
  getFreeRentInfo(formData.value)  // 待检查的信息  @ dev_rent 表
  copyBarcode()
}
defineExpose({ setPatient, getList: () => getList() }) // 提供 setPatient 方法,用于设置患者
/**
 * 【叫号自动完成】供父页面点「叫号」时先自动完成当前患者(等同点「领用完成」)。
 */
const completeCurrent = async (): Promise<boolean> => {
  try {
    return (await submitForm()) === true
  } catch (e) {
    console.warn('[DevReadyPanel] 自动「领用完成」失败', e)
    return false
  }
}
defineExpose({ setPatient, getList: () => getList(), completeCurrent }) // 提供 setPatient 方法,用于设置患者
const loading = ref(true) // 列表的加载中
@@ -499,9 +518,29 @@
    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) => {
@@ -642,51 +681,51 @@
/**
 * 获取条形码,显示与否  同一个值
 */
const getDisplayBarcode = (): string => {
  if (formData.value.checkType == null)
    return ""
/**
 * 【本需求】患者条码口径(门诊/急诊/体检 = 就诊流水号;住院不出条码,只留「复制」)
 *
 *  · 门诊(1) / 急诊(2) / 体检(4) → 条码内容 = **就诊流水号**(episodeId)
 *  · 住院(3)                    → **不显示条码**,只保留「复制」按钮(复制内容同样是就诊流水号)
 *  · 「复制」按钮与条码一致:同受「检查类型 → 患者条码显示」配置控制
 *    (该检查类型未勾选这个患者来源时,条码和复制按钮都不显示)
 */
const patSourceValue = computed<number | null>(() => {
  const source = formData.value.patDetails?.source ?? formData.value.patSrc
  return source === null || source === undefined || source === '' ? null : Number(source)
})
  // 【本次修复】「患者条码显示」未配置(null/空)→ 不显示(按现场确认口径)
/** 是否通过了「患者条码显示」配置(勾选了当前患者来源) */
const barcodeEnabled = computed<boolean>(() => {
  if (formData.value.checkType == null) return false
  const displayBarcode: number[] | undefined = checkTypeStore.getCheckTypeDispBarCode(formData.value.checkType)
  if (displayBarcode == null || displayBarcode.length === 0)
    return ""
  if (displayBarcode == null || displayBarcode.length === 0) return false
  const patSource = patSourceValue.value
  if (patSource == null) return false
  return displayBarcode.map(Number).includes(patSource)
})
  // 【本次修复】来源优先取 patDetails.source,缺失时回退到平铺的 patSrc
  const patSource = formData.value.patDetails?.source ?? formData.value.patSrc
  if (patSource == null)
    return ""
/** 条码 / 复制的内容:统一取「就诊流水号」 */
const barcodeContent = computed<string>(() =>
  barcodeEnabled.value ? (formData.value.episodeId ?? '') : ''
)
  if (!displayBarcode.map(Number).includes(Number(patSource)))
    return ""
/** 是否显示条码:住院(来源 3)不显示;内容为空时也不显示 */
const showBarCode = computed<boolean>(
  () => barcodeEnabled.value && patSourceValue.value !== 3 && barcodeContent.value !== ''
)
  return getBarcode()
}
const getBarcode = (): string => {
  if (formData.value.checkType == null)
    return ""
  const patSource = formData.value.patDetails?.source ?? formData.value.patSrc
  if (patSource == null)
    return ""
  // 门诊/急诊 → 申请单号;住院/体检 → 就诊流水号
  if (1 === Number(patSource) || 2 === Number(patSource))
    return formData.value.applyNo??""
  else if (3 === Number(patSource) || 4 === Number(patSource))
    return formData.value.episodeId??""
  return ""
}
/** 是否显示「复制」按钮:与条码一致(同受配置控制) */
const showCopyButton = computed<boolean>(() => barcodeEnabled.value)
const copyBarcode = async () => {
  displayBarCode.value = getDisplayBarcode()
  const barCode = getBarcode()
  if (isStringEmpty(barCode))
    return
  await navigator.clipboard.writeText( barCode );
  if (!barcodeContent.value) return
  // 【兼容 Chrome 85 / http 访问】非安全上下文下 navigator.clipboard 不可用,用兼容实现
  const ok = await copyText(barcodeContent.value)
  if (ok) {
    message.success('已复制')
  } else {
    message.warning('当前浏览器不支持自动复制,请手动选中复制')
  }
}
/** 初始化 **/
@@ -714,7 +753,7 @@
  }
  &__text {
    font-size: 14px;
    font-size: 15px;
    font-weight: 600;
    color: var(--el-text-color-primary);
  }
@@ -791,4 +830,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>