| | |
| | | > |
| | | <!-- ===== 编辑区(需要录入的字段)===== --> |
| | | <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-input v-model="formData.devId" :placeholder="requireDevId ? '请输入设备编号' : '可留空'" @input="getDevInfo"/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | </div> |
| | | |
| | | <!-- 医生装机列表 --> |
| | | <!-- 【本次需求】操作功能区与已完成记录之间的标题栏 --> |
| | | <div class="records-title"> |
| | | <span class="records-title__bar"></span> |
| | | <span class="records-title__text">已完成列表</span> |
| | | </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(修正):「撤销」作为**已完成领用记录列表的第一列**(表头插槽), |
| | |
| | | type="warning" |
| | | :disabled="undoDisabled" |
| | | :loading="undoLoading" |
| | | @click="$emit('event_undo_finish')" |
| | | title="先在下方点选一条完成记录,再点此撤销" |
| | | @click="undoSelected" |
| | | > |
| | | 撤销 |
| | | </el-button> |
| | |
| | | </el-table-column> |
| | | <el-table-column label="领用情况" align="center" prop="cancelled" > |
| | | <template #default="scope"> |
| | | <span v-if="scope.row.jobType === 5">"已领用"</span> |
| | | <!-- 【本需求】完成被撤销过:该条记录显示「已撤销」;再次完成时后端 undone 自动变回 false --> |
| | | <el-tag v-if="scope.row.undone" type="danger" size="small">已撤销</el-tag> |
| | | <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" />--> |
| | |
| | | </el-table-column> |
| | | --> |
| | | </el-table> |
| | | </div> |
| | | </ContentWrap> |
| | | <!-- 分页 --> |
| | | <Pagination |
| | |
| | | import {calGender, getBookBeginTime} from "@/utils"; |
| | | import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' |
| | | import {tranlateDevState} from "@/utils/statusFormatter"; |
| | | import { copyText } from '@/utils/copyText' |
| | | import { getConfigKey } from '@/api/infra/config' |
| | | import {getCheckTypeName, needAutoFeeConfirm, needDevReady} from "../../../../utils/checkTypeFormatter"; |
| | | import { useRoomStore } from '@/store/modules/room' |
| | | // 需求1:患者信息 18 项统一展示块 |
| | |
| | | patId: [{ required: true, message: '目前没有患者', trigger: 'blur' }], |
| | | patName: [{ required: true, message: '目前没有患者', trigger: 'blur' }] |
| | | }) |
| | | |
| | | /** |
| | | * 【系统参数】动态血压和心电设备领用安装登记设备编号 |
| | | * 值“是”(默认)→ 设备编号必填; |
| | | * 值“否” → 允许不填(校验规则同步放开)。 |
| | | */ |
| | | const requireDevId = ref(true) |
| | | const loadDevIdRequired = async () => { |
| | | try { |
| | | const value = await getConfigKey('ecg.dev.rent.device.no.required') |
| | | const text = String(value ?? '').trim() |
| | | requireDevId.value = !( |
| | | text === '否' || text === '0' || |
| | | text.toLowerCase() === 'false' || text.toLowerCase() === 'no' |
| | | ) |
| | | } catch (e) { |
| | | console.warn('[DevReadyPanel] 读取“设备编号必填”系统参数失败,按必填处理', e) |
| | | requireDevId.value = true |
| | | } |
| | | formRules.devId = requireDevId.value |
| | | ? [{ required: true, message: '设备编号不能为空', trigger: 'blur' }] |
| | | : [] |
| | | } |
| | | const formRef = ref() // 表单 Ref |
| | | |
| | | const devInfo = ref<Partial<DeviceVO>>({ |
| | |
| | | state: undefined, |
| | | }) |
| | | |
| | | const displayBarCode = ref<string> () |
| | | |
| | | const getRentInfoByPatId = () => { |
| | | const tempPatId = formData.value.patId; |
| | |
| | | |
| | | formData.value.patId = tempPatId; |
| | | getFreeRentInfo(formData.value) |
| | | copyBarcode() |
| | | } |
| | | |
| | | // 根据患者或设备, 获取 Free的租赁 |
| | |
| | | `「${ctName}」不需要设备领用,不能在设备领用模块办理。` + |
| | | `请确认是否应到「叫号检查」页面处理该患者。` |
| | | ) |
| | | return |
| | | return false |
| | | } |
| | | |
| | | // 校验表单 |
| | |
| | | await DevRentApi.devReady(formData.value) |
| | | |
| | | if (autoPrint.value && formData.value.patId && formData.value.checkType) { |
| | | printBill(formData.value.patDetails?.appointmentId) |
| | | const apptId = formData.value.patDetails?.appointmentId |
| | | // 【本次修复】自动打印时若没有预约单号就**静默跳过**: |
| | | // 手动点「打印小票」会给出"无预约单"的提示,但领用完成后的自动打印不该弹警告打断流程。 |
| | | if (apptId != null) { |
| | | printBill(apptId) |
| | | } |
| | | } |
| | | |
| | | // 自动确费 |
| | |
| | | // 发送操作成功的事件 |
| | | emit('event_dev_ready') |
| | | message.success(t('操作完成')) |
| | | return true |
| | | } finally { |
| | | formLoading.value = false |
| | | } |
| | |
| | | formData.value.doctor = queueVO?.doctor |
| | | formData.value.doctorTime = queueVO?.doctorTime |
| | | formData.value.patSrc = queueVO?.patSrc |
| | | // 【本次修复】条码/打印小票依赖 patDetails(含 source/appointmentId), |
| | | // 队列行本就带着它;原先只在 getFreeRentInfo() 查到"待检查单"时才赋值, |
| | | // 导致绝大多数情况下 patDetails 为 undefined → 条码不显示。 |
| | | formData.value.patDetails = queueVO?.patDetails |
| | | formData.value.patMobile = queueVO?.patMobile |
| | | formData.value.patPhone = queueVO?.patPhone |
| | | formData.value.patWardDesc = queueVO?.patWardDesc |
| | |
| | | formData.value.doctorAdviceNo = queueVO?.doctorAdviceNo |
| | | formData.value.patIdentityId = queueVO?.patIdentityId |
| | | getFreeRentInfo(formData.value) // 待检查的信息 @ dev_rent 表 |
| | | copyBarcode() |
| | | } |
| | | defineExpose({ setPatient }) // 提供 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) // 列表的加载中 |
| | |
| | | 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) => { |
| | |
| | | devInfo.value.state = data.devState |
| | | } |
| | | |
| | | /** |
| | | * 【本次修复】等待 hiprint 打印客户端就绪(最多约 800ms)。 |
| | | * |
| | | * 打印客户端是**本机** websocket 服务(默认 http://localhost:17521), |
| | | * `print2()`(静默打印)要求它已连接;首次点击时 socket 可能还在连接中, |
| | | * 这里短暂轮询,避免"本机明明装了客户端,却因为没连上而打不出票"。 |
| | | * |
| | | * @returns true = 客户端可用,可静默打印;false = 不可用,应回退浏览器打印 |
| | | */ |
| | | const waitPrintClientOpened = async (tpl: any, timeoutMs = 800): Promise<boolean> => { |
| | | if (typeof tpl?.clientIsOpened !== 'function') return false |
| | | if (tpl.clientIsOpened()) return true |
| | | const step = 100 |
| | | for (let waited = 0; waited < timeoutMs; waited += step) { |
| | | // eslint-disable-next-line no-await-in-loop |
| | | await new Promise((resolve) => setTimeout(resolve, step)) |
| | | if (tpl.clientIsOpened()) return true |
| | | } |
| | | return false |
| | | } |
| | | |
| | | const printBill = async (appointmentId: number | null | undefined, printMode?: number) => { |
| | | if ( appointmentId == null ) |
| | | // 【本次修复】原来这里直接 return,现场表现是"点「打印小票」完全没反应"。 |
| | | // 小票内容取自**预约单**,没有预约单号就没有可打印的内容 —— 这里明确提示。 |
| | | if (appointmentId == null) { |
| | | message.warning('该患者没有关联的预约单(缺少预约单号),无法打印小票') |
| | | return |
| | | } |
| | | |
| | | const curAppointment: AppointmentVO = await AppointmentApi.getAppointment( appointmentId ) |
| | | |
| | |
| | | // 下列方法都是没有拖拽设计页面的, 相当于代码模式, 使用代码设计页面 |
| | | // 想要实现拖拽设计页面,请往下看 '自定义设计' |
| | | var hiprintTemplate = new hiprint.PrintTemplate(); // 可传参数 |
| | | //var panel = hiprintTemplate.addPrintPanel({ width: 100, height: 130, paperFooter: 340, paperHeader: 10 }); 导致走三页 |
| | | var panel = hiprintTemplate.addPrintPanel({ width: 140, height: 130, paperNumberDisabled:true}); |
| | | //文本 |
| | | |
| | | // ============================================================================ |
| | | // 【本次调整·适配得实 DL-210 + 热敏纸 50×30mm】 |
| | | // |
| | | // 打印机:得实 DL-210(203dpi = 8 dots/mm,可打印宽度 108mm,USB 口) |
| | | // 耗材 :热敏标签纸 50mm(宽) × 30mm(高) |
| | | // |
| | | // 之前模板是 140×130mm(给 A4/大面单用的),比 50mm 纸宽出 90mm ⇒ 驱动按 50mm 缩放, |
| | | // 字与条码会被压得很小/裁切。这里整体改为 50×30mm,并按小纸重排为 **5 行 + 1 条码**: |
| | | // |
| | | // y 0.8mm ── 检查项目(10pt 加粗居中) |
| | | // y 5.6mm ── 姓名 性别 年龄(9pt 加粗居中) |
| | | // y10.0mm ── 病区-床号(左半) | 预约 11-28 08:00(右半) 7.5pt |
| | | // y14.0mm ── 患者编号(左半) | 手机号(右半) 7.5pt |
| | | // y18.4mm ── 条形码(高 10.8mm,宽 46mm;内容 = 就诊流水号 episodeId) |
| | | // |
| | | // ⚠️【单位坑·2026-11-28 实测】hiprint 的 **面板**尺寸 `addPrintPanel({width,height})` 用 **mm**, |
| | | // 但**元素**的 `top/left/width/height` 用 **pt**(源码:`options.displayLeft()` 返回 `left+"pt"`, |
| | | // 元素默认 height=9.75 / width=120 也都是 pt)。第一版把元素坐标也当 mm 传入(0.6/5/8.8…), |
| | | // 结果 27.4"mm" 实际只有 27.4pt≈9.7mm ⇒ 所有文字/条码挤在标签顶部、互相重叠。 |
| | | // 现在统一:**布局仍按 mm 写**,进入 hiprint 前用 mm2pt() 换算(1mm = 72/25.4 pt)。 |
| | | // ============================================================================ |
| | | const PAPER_W = 50 // 标签纸宽 mm(面板单位=mm) |
| | | const PAPER_H = 30 // 标签纸高 mm(面板单位=mm) |
| | | /** 1mm = 2.83465pt */ |
| | | const PT_PER_MM = 72 / 25.4 |
| | | /** mm → pt(元素坐标/尺寸用) */ |
| | | const mm2pt = (v: number) => Math.round(v * PT_PER_MM * 100) / 100 |
| | | // 【打印份数】正式口径 = 2 张(患者 1 张 + 科室留存 1 张)。 |
| | | // 想改份数只改这一个数字:改 1 = 测试省纸;改 3 = 三联。 |
| | | const PRINT_COPIES = 2 |
| | | var panel = hiprintTemplate.addPrintPanel({ width: PAPER_W, height: PAPER_H, paperNumberDisabled:true}); |
| | | |
| | | const FONT = '微软雅黑' |
| | | /** |
| | | * 加一行文本(统一字体/居中)。 |
| | | * 入参单位:**mm**(内部换算成 hiprint 需要的 pt);fontSize 单位是 **pt**。 |
| | | */ |
| | | const addLine = (opts: { |
| | | top: number; left?: number; width?: number; height?: number; |
| | | title: string; fontSize?: number; bold?: boolean; align?: string; |
| | | }) => { |
| | | panel.addPrintText({ |
| | | options: { |
| | | left: mm2pt(opts.left ?? 1), |
| | | top: mm2pt(opts.top), |
| | | width: mm2pt(opts.width ?? PAPER_W - 2), |
| | | height: mm2pt(opts.height ?? 3.6), |
| | | title: opts.title ?? '', |
| | | textAlign: opts.align ?? 'center', |
| | | fontSize: opts.fontSize ?? 8, |
| | | fontFamily: FONT, |
| | | fontWeight: opts.bold === false ? '400' : '700' |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // ① 检查项目(y 0.8~5.4mm) |
| | | const checkTypeName = getCheckTypeName(curAppointment.bookCheckType) |
| | | panel.addPrintText({ options: { width: 140, height: 12, top: 2, left: 20, title: checkTypeName, textAlign: 'center', fontSize: 10, fontFamily: '微软雅黑', fontWeight: '700', } }); |
| | | addLine({ top: 0.8, height: 4.6, title: checkTypeName, fontSize: 10 }) |
| | | // ② 姓名 性别 年龄(y 5.6~9.6mm) |
| | | const patientBaisc = curAppointment.patName + " " + calGender(curAppointment.patGender) + " " + calculateAge(curAppointment.patBirthday) + "岁" |
| | | panel.addPrintText({ options: { width: 140, height: 12, top: 16, left: 20, title: patientBaisc, textAlign: 'center' , fontSize: 10, fontFamily: '微软雅黑', fontWeight: '700', } }); |
| | | const ward_bed = curAppointment.patWardDesc + "-" + curAppointment.patBedNo |
| | | panel.addPrintText({ options: { width: 140, height: 12, top: 30, left: 20, title: ward_bed, textAlign: 'center', fontSize: 10, fontFamily: '微软雅黑', fontWeight: '700', } }); |
| | | const bookTime = formatTimestamp(curAppointment.bookDate) + " " + getBookBeginTime(curAppointment.bookTimeslot) |
| | | panel.addPrintText({ options: { width: 140, height: 12, top: 44, left: 20, title: bookTime, textAlign: 'center', fontSize: 10, fontFamily: '微软雅黑', fontWeight: '700', } }); |
| | | panel.addPrintText({ options: { width: 140, height: 12, top: 58, left: 20, title: curAppointment.patId, textAlign: 'center', fontSize: 10, fontFamily: '微软雅黑', fontWeight: '700', } }); |
| | | panel.addPrintText({ options: { width: 140, height: 12, top: 72, left: 20, title: curAppointment.patMobile, textAlign: 'center', fontSize: 10, fontFamily: '微软雅黑', fontWeight: '700', } }); |
| | | //条形码 |
| | | panel.addPrintText({ options: { width: 140, height: 22, top: 86, left: 20, title: curAppointment.episodeId, textType: 'barcode' } }); |
| | | addLine({ top: 5.6, height: 4.0, title: patientBaisc, fontSize: 9 }) |
| | | // ③ 病区-床号 | 预约时间(y 10.0~13.6mm;"2026-11-28 08:00" 缩成 "11-28 08:00") |
| | | const ward_bed = (curAppointment.patWardDesc || '') + (curAppointment.patBedNo ? "-" + curAppointment.patBedNo : '') |
| | | addLine({ top: 10.0, height: 3.6, left: 1.5, width: 22, title: ward_bed, fontSize: 7.5 }) |
| | | const bookTime = formatTimestamp(curAppointment.bookDate).slice(5) + " " + getBookBeginTime(curAppointment.bookTimeslot) |
| | | addLine({ top: 10.0, height: 3.6, left: 24, width: 25, title: bookTime, fontSize: 7.5 }) |
| | | // ④ 患者编号 | 手机号(y 14.0~17.6mm) |
| | | addLine({ top: 14.0, height: 3.6, left: 1.5, width: 22, title: curAppointment.patId ?? '', fontSize: 7.5 }) |
| | | addLine({ top: 14.0, height: 3.6, left: 24, width: 25, title: curAppointment.patMobile ?? '', fontSize: 7.5 }) |
| | | // ⑤ 条形码(内容 = 就诊流水号;坐标同样 mm→pt) |
| | | // |
| | | // 【"没居中"】① 元素按内容算宽后 `left = (50-w)/2` 精确居中; |
| | | // ② hiprint 的条形 svg 是 `width:100%`,宽度随元素走,所以元素宽度不能随手给。 |
| | | // 【"数值太低"】hiprint 条码元素内部是: |
| | | // <svg class="hibarcode_imgcode" width=100% height=100%> + <div class="hibarcode_displayValue">数值</div> |
| | | // 条形占满元素高度,数值 div 排在元素盒子**之下**,元素一高数值就被推到纸边(甚至会掉到第二页/被裁)。 |
| | | // 因此这里:**关掉它自带的数值(hideTitle)**,改由我们自己紧贴条码画一行居中数值(位置可控)。 |
| | | const barcodeText = curAppointment.episodeId ?? '' |
| | | const isPureDigits = /^\d+$/.test(barcodeText) |
| | | // CODE128 模块数:起始 11 + 数据 + 校验 11 + 终止 13; |
| | | // 纯数字偶数位走 CODE128-C(2 位/符号),否则走 CODE128-B(1 位/符号) |
| | | const barcodeModules = isPureDigits && barcodeText.length % 2 === 0 |
| | | ? 11 + (barcodeText.length / 2) * 11 + 11 + 13 |
| | | : 11 + barcodeText.length * 11 + 11 + 13 |
| | | // JsBarcode 里 1 模块 = 1px ≈ 0.2646mm;+1mm 余量,并限制在 18~40mm(太窄会糊、太宽超出纸面) |
| | | const barcodeWidthMm = Math.min(40, Math.max(18, barcodeModules * 0.2646 + 1)) |
| | | const barcodeLeftMm = (PAPER_W - barcodeWidthMm) / 2 |
| | | const BARCODE_TOP = 17.4 // 条形起始 |
| | | const BARCODE_H = 8.2 // 条形高度(203dpi ≈ 66 点高,扫码足够) |
| | | panel.addPrintText({ |
| | | options: { |
| | | left: mm2pt(barcodeLeftMm), |
| | | top: mm2pt(BARCODE_TOP), |
| | | width: mm2pt(barcodeWidthMm), |
| | | height: mm2pt(BARCODE_H), |
| | | title: barcodeText, |
| | | textType: 'barcode', |
| | | hideTitle: true // 不要 hiprint 自带的数值(它在元素下方,会把内容顶出纸面) |
| | | } |
| | | }); |
| | | // ⑤-2 数值:紧贴条码下方 0.9mm,居中(与条码同宽,超出会被截断) |
| | | addLine({ top: BARCODE_TOP + BARCODE_H + 0.9, height: 3.0, title: barcodeText, fontSize: 7.5 }) |
| | | |
| | | //打印 |
| | | if (printMode == null) |
| | | hiprintTemplate.print2([{},{},{}]); // 预览方式 可以传 [定位参数] http://https://ccsimple.github.io/sv-print-docs/config/template.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E8%AE%BE%E8%AE%A1%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B |
| | | else |
| | | hiprintTemplate.print([{},{},{}]); |
| | | // 【本次修复】优先"静默打印"(需要本机 hiprint 打印客户端); |
| | | // 客户端未连接/未安装时**回退浏览器打印**(弹打印对话框),避免只报「连接客户端失败」而打不出票。 |
| | | // · printMode == null → 期望静默打印(本机有客户端时) |
| | | // · printMode != null → 明确要求浏览器打印(原逻辑保留) |
| | | // |
| | | // 【打印份数】hiprint 的入参数组长度 = 页数(每元素一页)。 |
| | | // 正式口径 = 2 张;份数只在 PRINT_COPIES 一处维护(1=测试省纸,3=三联)。 |
| | | const pages: any[] = Array.from({ length: PRINT_COPIES }, () => ({})) |
| | | if (printMode == null && (await waitPrintClientOpened(hiprintTemplate))) { |
| | | hiprintTemplate.print2(pages); // 静默打印(本机客户端) 可传 [定位参数] http://https://ccsimple.github.io/sv-print-docs/config/template.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E8%AE%BE%E8%AE%A1%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B |
| | | } else { |
| | | console.info('[printBill] 打印客户端未就绪,回退为浏览器打印,份数=' + PRINT_COPIES) |
| | | hiprintTemplate.print(pages); |
| | | } |
| | | } |
| | | /* hiprint 示例 |
| | | // 引入后使用示例 |
| | |
| | | */ |
| | | |
| | | const getDevInfo = async () => { |
| | | if (formData.value?.devId == null) { |
| | | // 设备编号允许留空(系统参数=否)时,空值不再去查设备,避免无意义请求/报错 |
| | | if (!formData.value?.devId) { |
| | | devInfo.value.brand = undefined |
| | | devInfo.value.model = undefined |
| | | devInfo.value.state = undefined |
| | |
| | | /** |
| | | * 获取条形码,显示与否 同一个值 |
| | | */ |
| | | 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) |
| | | }) |
| | | |
| | | if (formData.value.patDetails?.source == null) |
| | | return "" |
| | | /** 是否通过了「患者条码显示」配置(勾选了当前患者来源) */ |
| | | 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 false |
| | | const patSource = patSourceValue.value |
| | | if (patSource == null) return false |
| | | return displayBarcode.map(Number).includes(patSource) |
| | | }) |
| | | |
| | | const displayBarcode: number[] = checkTypeStore.getCheckTypeDispBarCode(formData.value.checkType) |
| | | if (displayBarcode == null || displayBarcode.length === 0) |
| | | return "" |
| | | /** 条码 / 复制的内容:统一取「就诊流水号」 */ |
| | | const barcodeContent = computed<string>(() => |
| | | barcodeEnabled.value ? (formData.value.episodeId ?? '') : '' |
| | | ) |
| | | |
| | | if (!displayBarcode.includes( formData.value.patDetails.source )) |
| | | 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 |
| | | if (patSource == null) |
| | | return "" |
| | | |
| | | if (1 === patSource || 2 === patSource) |
| | | return formData.value.applyNo??"" |
| | | else if (3 === patSource || 4 === 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('当前浏览器不支持自动复制,请手动选中复制') |
| | | } |
| | | } |
| | | |
| | | /** 初始化 **/ |
| | | onMounted(() => { |
| | | getList() |
| | | loadDevIdRequired() |
| | | }) |
| | | |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | |
| | | /* 【本次需求】「已完成列表」标题栏:左侧主色竖线 + 加粗小标题,紧凑高度不挤压表格 */ |
| | | .records-title { |
| | | display: flex; |
| | | align-items: center; |
| | | flex: none; |
| | | gap: 6px; |
| | | padding: 2px 0 6px; |
| | | |
| | | &__bar { |
| | | width: 3px; |
| | | height: 14px; |
| | | background-color: var(--el-color-primary); |
| | | border-radius: 2px; |
| | | } |
| | | |
| | | &__text { |
| | | font-size: 15px; |
| | | font-weight: 600; |
| | | color: var(--el-text-color-primary); |
| | | } |
| | | } |
| | | /* ========================================================================== |
| | | 需求:表单内容挤占了下方记录表格的空间 —— 压缩行间距。 |
| | | Element Plus 默认 `.el-form-item { margin-bottom: 18px }`; |
| | |
| | | .patient-actions { |
| | | display: flex; |
| | | flex: none; |
| | | flex-wrap: nowrap; |
| | | /* 按钮多时允许换行,避免挤在一行(检查页最多 6 个按钮) */ |
| | | flex-wrap: wrap; |
| | | gap: 8px; |
| | | align-items: center; |
| | | /* 上下留白 + 分隔线,形成独立功能块 */ |
| | | padding: 6px 4px; |
| | | margin-bottom: 6px; |
| | | background-color: var(--el-bg-color); |
| | | border-top: 1px solid var(--el-border-color-lighter); |
| | | border-bottom: 1px solid var(--el-border-color-lighter); |
| | | /* |
| | | 【本次需求】操作功能区做一点视觉区分,方便医生一眼定位: |
| | | 极浅的主色底 + 细边框 + 左侧 3px 主色竖条(与「▎已完成列表」标题条同款语言)。 |
| | | 只做"稍有区分",不改按钮本身的尺寸/颜色/顺序。 |
| | | */ |
| | | padding: 8px 10px; |
| | | margin: 2px 0 10px; |
| | | background-color: var(--el-color-primary-light-9); |
| | | border: 1px solid var(--el-color-primary-light-7); |
| | | border-left: 3px solid var(--el-color-primary); |
| | | border-radius: 4px; |
| | | |
| | | /* Element Plus 给相邻 el-button 默认加了 margin-left:12px,会与 gap 叠加,清掉 */ |
| | | :deep(.el-button + .el-button) { |
| | | 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> |