From 483f87b182ab3e671d8701f79bbb6b4d55896655 Mon Sep 17 00:00:00 2001 From: Euni4U <958079825@qq.com> Date: Fri, 14 Mar 2025 09:55:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Medical-examination-vehicle.vue | 46 ++++++++++++++++--- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/src/views/Department-entry/Medical-examination-vehicle.vue b/src/views/Department-entry/Medical-examination-vehicle.vue index 2f024f8..af95faa 100644 --- a/src/views/Department-entry/Medical-examination-vehicle.vue +++ b/src/views/Department-entry/Medical-examination-vehicle.vue @@ -436,17 +436,43 @@ const patientDataCache = ref(new Map()) const medicalSnQuery = ref('') // 添加本地搜索处理函数 -const handleLocalSearch = () => { +const handleLocalSearch = async () => { if (!searchQuery.value) { - filteredPatients.value = patients.value + // 如果搜索框为空,恢复原始列表 + await getPatientList() return } - const query = searchQuery.value.toLowerCase() - filteredPatients.value = patients.value.filter(patient => - (patient.pname && patient.pname.toLowerCase().includes(query)) || - (patient.medicalSn && patient.medicalSn.toLowerCase().includes(query)) - ) + try { + const loading = ElLoading.service({ + lock: true, + text: '搜索中...', + background: 'rgba(255, 255, 255, 0.7)' + }) + + const params = { + pageNo: pageNo.value, + pageSize: pageSize.value, + // 添加搜索条件,根据姓名或体检编号搜索 + pname: searchQuery.value, + medicalSn: searchQuery.value + } + + const res = await PatientApi.getPatientPage(params) + + if (res.list && res.list.length > 0) { + patients.value = res.list + total.value = res.total + } else { + patients.value = [] + total.value = 0 + } + + loading.close() + } catch (error) { + console.error('搜索患者失败:', error) + ElMessage.error('搜索患者失败') + } } // 修改获取患者列表数据的函数 @@ -1144,6 +1170,12 @@ const handleRefresh = async (e) => { urine: { summary: '' }, biochemical: { summary: '' } } + + // 清空搜索栏 + searchQuery.value = '' + + // 重置状态筛选 + statusFilter.value = '0' // 刷新患者列表 await getPatientList()