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"); }