修复122 门诊医生站-》医嘱TAB:点击选中项目后查询框自动关闭
This commit is contained in:
@@ -1432,6 +1432,14 @@ function handleSkinTestChange(row, index) {
|
||||
row.skinTestFlag_enumText = row.skinTestFlag == 1 ? '是' : '否';
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择药品回调
|
||||
*/
|
||||
/**
|
||||
* 延迟函数
|
||||
*/
|
||||
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
||||
|
||||
/**
|
||||
* 选择药品回调
|
||||
*/
|
||||
@@ -1457,30 +1465,72 @@ function selectAdviceBase(key, row) {
|
||||
setNewRow(key, row);
|
||||
}
|
||||
|
||||
function setNewRow(key, row) {
|
||||
async function setNewRow(key, row) {
|
||||
// 每次选择药品时,将当前行数据完全重置,清空所有旧数据
|
||||
const preservedData = {
|
||||
uniqueKey: prescriptionList.value[rowIndex.value].uniqueKey,
|
||||
isEdit: true,
|
||||
statusEnum: 1,
|
||||
showPopover: false, // 确保popover关闭
|
||||
};
|
||||
|
||||
// 完全替换整个对象,只保留必要的初始字段
|
||||
prescriptionList.value[rowIndex.value] = preservedData;
|
||||
|
||||
setValue(row);
|
||||
|
||||
// 确保在setValue之后再次设置showPopover为false,防止被覆盖
|
||||
prescriptionList.value[rowIndex.value].showPopover = false;
|
||||
|
||||
expandOrder.value = [key];
|
||||
nextTick(() => {
|
||||
if (row.adviceType == 1) {
|
||||
if (row.injectFlag == 1) {
|
||||
inputRefs.value['executeNum']?.focus();
|
||||
} else {
|
||||
inputRefs.value['doseQuantity']?.focus();
|
||||
|
||||
// 自动聚焦到单次用量字段 - 使用 async/await 多次尝试
|
||||
await nextTick();
|
||||
|
||||
// 第一次尝试 - 快速定位
|
||||
await sleep(300);
|
||||
focusDoseQuantityInput(row);
|
||||
|
||||
}
|
||||
} else {
|
||||
inputRefs.value['quantity']?.focus();
|
||||
|
||||
// 聚焦到单次用量输入框的函数
|
||||
function focusDoseQuantityInput(row) {
|
||||
// 找到展开行对应的输入框并聚焦
|
||||
const expandedRows = document.querySelectorAll('.el-table__expanded-cell');
|
||||
|
||||
if (expandedRows.length > 0) {
|
||||
// 在最后一个展开行中查找输入框
|
||||
const lastExpandedRow = expandedRows[expandedRows.length - 1];
|
||||
|
||||
// 查找doseQuantity输入框(优先)
|
||||
let targetInput = lastExpandedRow.querySelector('[data-prop="doseQuantity"] .el-input-number__inner');
|
||||
|
||||
// 如果没找到,尝试其他方式
|
||||
if (!targetInput && row.adviceType == 1) {
|
||||
// 西药的情况:找第一个el-input-number
|
||||
targetInput = lastExpandedRow.querySelector('.el-input-number__inner');
|
||||
} else if (!targetInput) {
|
||||
// 诊疗/耗材的情况:找quantity输入框
|
||||
targetInput = lastExpandedRow.querySelector('[data-prop="quantity"] .el-input-number__inner');
|
||||
}
|
||||
});
|
||||
|
||||
// 最后的备用方案
|
||||
if (!targetInput) {
|
||||
targetInput = lastExpandedRow.querySelector('input:not([disabled]):not([readonly])');
|
||||
}
|
||||
|
||||
// 聚焦到输入框
|
||||
if (targetInput) {
|
||||
targetInput.focus();
|
||||
// 选中文本,便于用户直接输入
|
||||
if (targetInput.select) {
|
||||
targetInput.select();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2277,6 +2327,7 @@ function setValue(row) {
|
||||
uniqueKey: prescriptionList.value[rowIndex.value].uniqueKey,
|
||||
isEdit: prescriptionList.value[rowIndex.value].isEdit,
|
||||
statusEnum: prescriptionList.value[rowIndex.value].statusEnum,
|
||||
showPopover: false, // 确保查询框关闭
|
||||
};
|
||||
prescriptionList.value[rowIndex.value].orgId = undefined;
|
||||
prescriptionList.value[rowIndex.value].dose = undefined;
|
||||
|
||||
Reference in New Issue
Block a user