diff --git a/openhis-ui-vue3/src/views/outpatient/doctor-workstation/PendingRecords.vue b/openhis-ui-vue3/src/views/outpatient/doctor-workstation/PendingRecords.vue index 6e67a7ffa..24ef38f3e 100644 --- a/openhis-ui-vue3/src/views/outpatient/doctor-workstation/PendingRecords.vue +++ b/openhis-ui-vue3/src/views/outpatient/doctor-workstation/PendingRecords.vue @@ -1,6 +1,6 @@ @@ -48,47 +55,61 @@ const fetchRecords = async () => { loading.value = true try { const res = await getPendingMedicalRecords() - // 兼容不同后端返回结构 - recordList.value = res.data?.list || res.data || [] - } catch (error) { - console.error('加载待写病历失败:', error) - ElMessage.error('数据加载失败,请检查网络或联系管理员') - recordList.value = [] + // 假设后端返回 { data: [...] } + recordList.value = res.data || [] + } catch (e) { + ElMessage.error('加载待写病历失败') } finally { - // 核心修复:使用 finally 确保无论请求成功、失败或超时,loading 状态必定重置 loading.value = false } } -const handleWrite = (row) => { - // 路由跳转至病历编辑器 - console.log('进入病历编辑:', row.id) -} - -onMounted(fetchRecords) +// 页面挂载后自动加载 +onMounted(() => { + fetchRecords() +})