From 83328321f947d6c249d15327331b039b000dff9a Mon Sep 17 00:00:00 2001 From: duhe Date: Tue, 11 Mar 2025 10:22:28 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=A8=E8=AF=8A=E7=9B=AE=E5=BD=95=E4=B8=8A?= =?UTF-8?q?=E4=B8=8B=E5=B7=A6=E5=8F=B3=E5=88=87=E6=8D=A2=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E9=80=89=E5=92=8Cinput=E6=A1=86=E7=9A=84=E7=89=88=E6=9C=AC=20u?= =?UTF-8?q?p=20by=20dh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/patientInfoDialog.vue | 10 +- .../charge/outpatientregistration/index.vue | 134 +++++++++++++----- 2 files changed, 105 insertions(+), 39 deletions(-) diff --git a/openhis-ui-vue3/src/views/charge/outpatientregistration/components/patientInfoDialog.vue b/openhis-ui-vue3/src/views/charge/outpatientregistration/components/patientInfoDialog.vue index 9781ee6e..55827c8b 100644 --- a/openhis-ui-vue3/src/views/charge/outpatientregistration/components/patientInfoDialog.vue +++ b/openhis-ui-vue3/src/views/charge/outpatientregistration/components/patientInfoDialog.vue @@ -5,6 +5,7 @@ :data="patientInfoList" @selection-change="handleSelectionChange" width="90%" + @cell-dblclick="handleCellDblClick" > - + @@ -220,6 +220,7 @@ placeholder="费用性质" clearable style="width: 240px" + ref="contractNameRef" > - - + - + @@ -294,6 +273,7 @@ placeholder="优先级" clearable style="width: 240px" + ref="prioritySelectRef" > - + @@ -350,7 +330,7 @@ children: 'children', }" value-key="id" - placeholder="请选择就诊位置" + placeholder="请选择就诊科室" check-strictly :expand-on-click-node="false" :filter-node-method="filterNode" @@ -374,6 +354,7 @@ clearable style="width: 240px" @change="setchargeItem" + ref="serviceTypeRef" > { + const { key } = event; + + // 获取当前焦点的元素 + const currentIndex = inputs.findIndex((input) => { + if (input.value && input.value.$el) { + return input.value.$el.contains(document.activeElement); + } + return input.value === document.activeElement; + }); + + if (key === "ArrowDown" || key === "ArrowRight" || key === "Tab") { + event.preventDefault(); + const nextIndex = (currentIndex + 1) % inputs.length; + const nextInput = inputs[nextIndex].value; + if (nextInput && nextInput.focus) { + nextInput.focus(); + } else if (nextInput && nextInput.$el) { + nextInput.$el.querySelector("input").focus(); + } + } else if (key === "ArrowUp" || key === "ArrowLeft") { + event.preventDefault(); + const prevIndex = (currentIndex - 1 + inputs.length) % inputs.length; + const prevInput = inputs[prevIndex].value; + if (prevInput && prevInput.focus) { + prevInput.focus(); + } else if (prevInput && prevInput.$el) { + prevInput.$el.querySelector("input").focus(); + } + } +}; + +// 添加事件监听器 +onMounted(() => { + window.addEventListener("keydown", handleKeyDown); +}); + +// 移除事件监听器 +onUnmounted(() => { + window.removeEventListener("keydown", handleKeyDown); +}); + const { queryParams, form, rules } = toRefs(data); /** 初期所用数据查询 */ @@ -735,6 +783,13 @@ function setForm(formData) { console.log(formData, "formData"); form.value = { ...form.value, ...formData }; form.value.patientId = formData.id; + // 使用 nextTick 确保 DOM 更新完成后设置焦点 + nextTick(() => { + const prioritySelect = prioritySelectRef.value?.$el?.querySelector("input"); + if (prioritySelect) { + prioritySelect.focus(); + } + }); } // 设定表单 function setInfo() { @@ -777,8 +832,10 @@ function getList() { /** 查询费用性质 */ function getContract() { + form.value.jzyy = jzyyList.value[0]; // 设置默认值为第一项 getContractList().then((response) => { contractList.value = response.data; + form.value.contractNo = response.data[0].busNo; }); } @@ -789,7 +846,7 @@ function getContract() { // }); // } -/** 查询就诊位置 */ +/** 查询就诊科室 */ function getLocationInfo() { getLocationTree().then((response) => { locationOptions.value = response.data.records; @@ -878,6 +935,7 @@ function reset() { definitionId: undefined, serviceId: undefined, totalPrice: undefined, + jzyy: 1, }; proxy.resetForm("outpatientRegistrationRef"); }