换卡bug
This commit is contained in:
@@ -338,18 +338,19 @@ 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字段
|
||||
if (patient.id && !patient.patientId) {
|
||||
patient.patientId = patient.id;
|
||||
}
|
||||
|
||||
// 设置为选中状态,但不自动确认
|
||||
selectedPatient.value = patient
|
||||
ElMessage.warning('已自动选中唯一患者,请点击确定')
|
||||
} else {
|
||||
// 如果只有一条记录且是第一页,自动选中并展示到页面
|
||||
if (response.data.records.length === 1 && currentPage.value === 1) {
|
||||
const patient = response.data.records[0]
|
||||
// 确保patient对象中同时包含id和patientId字段
|
||||
if (patient.id && !patient.patientId) {
|
||||
patient.patientId = patient.id;
|
||||
}
|
||||
|
||||
// 设置为选中状态并自动确认,将患者信息展示到页面
|
||||
selectedPatient.value = patient
|
||||
confirmSelectPatient() // 自动调用确认选择方法,将患者信息展示到页面
|
||||
ElMessage.success('已自动选中唯一患者')
|
||||
} else {
|
||||
// 如果有多条记录或不是第一页,显示患者列表供选择
|
||||
// 确保每条患者记录都包含patientId字段,优先使用id字段
|
||||
patientList.value = response.data.records.map(patient => ({
|
||||
@@ -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'
|
||||
}
|
||||
// 初始化患者信息为空
|
||||
})
|
||||
|
||||
// 组件卸载时移除键盘事件监听
|
||||
|
||||
Reference in New Issue
Block a user