换卡bug

This commit is contained in:
2025-11-28 10:41:14 +08:00
parent d7955aa628
commit 263e21e157

View File

@@ -338,7 +338,7 @@ const handleCurrentChange = (newPage) => {
total.value = response.data.total || 0
selectedPatient.value = null // 查询时重置选中状态
// 如果只有一条记录且是第一页,自动选中
// 如果只有一条记录且是第一页,自动选中并展示到页面
if (response.data.records.length === 1 && currentPage.value === 1) {
const patient = response.data.records[0]
// 确保patient对象中同时包含id和patientId字段
@@ -346,9 +346,10 @@ const handleCurrentChange = (newPage) => {
patient.patientId = patient.id;
}
// 设置为选中状态,但不自动确认
// 设置为选中状态自动确认,将患者信息展示到页面
selectedPatient.value = patient
ElMessage.warning('已自动选中唯一患者,请点击确定')
confirmSelectPatient() // 自动调用确认选择方法,将患者信息展示到页面
ElMessage.success('已自动选中唯一患者')
} else {
// 如果有多条记录或不是第一页,显示患者列表供选择
// 确保每条患者记录都包含patientId字段优先使用id字段
@@ -492,16 +493,7 @@ const handleKeydown = (event) => {
onMounted(() => {
document.addEventListener('keydown', handleKeydown)
// 设置默认患者数据,方便用户直接进行换卡操作
patientInfo.value = {
outpatientNo: '20231001001',
patientName: '张三',
idCard: '110101199001011234',
phoneNumber: '13800138000',
gender: '男',
age: '33岁',
patientId: '1001'
}
// 初始化患者信息为空
})
// 组件卸载时移除键盘事件监听