Fix Bug #562: AI修复
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import request from '@/utils/request';
|
||||
import request from '@/utils/request'
|
||||
|
||||
/**
|
||||
* 获取待写病历(分页)
|
||||
* @param {Object} params { pageNum, pageSize }
|
||||
* 获取当前医生待写病历列表
|
||||
* @returns {Promise}
|
||||
*/
|
||||
export function getPendingMedicalRecordsApi(params) {
|
||||
export function getPendingMedicalRecords() {
|
||||
return request({
|
||||
url: '/outpatient/medical-records/pending',
|
||||
url: '/api/medical-record/pending',
|
||||
method: 'get',
|
||||
params,
|
||||
});
|
||||
timeout: 5000 // 明确设置前端超时阈值,避免无限等待
|
||||
})
|
||||
}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
<template>
|
||||
<div class="pending-records-container">
|
||||
<el-card shadow="never">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>待写病历</span>
|
||||
<el-button type="primary" @click="fetchRecords" :loading="loading">刷新</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 显式加载遮罩,匹配 E2E 测试选择器 -->
|
||||
<div v-if="loading" class="loading-overlay" data-cy="loading-spinner">
|
||||
<el-icon class="is-loading"><Loading /></el-icon>
|
||||
<span>数据加载中...</span>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
:data="recordList"
|
||||
border
|
||||
style="width: 100%; margin-top: 16px"
|
||||
data-cy="record-list"
|
||||
>
|
||||
<el-table-column prop="patientName" label="患者姓名" width="120" />
|
||||
<el-table-column prop="visitDate" label="就诊日期" width="150" />
|
||||
<el-table-column prop="diagnosis" label="初步诊断" min-width="200" />
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" link @click="handleWrite(row)" data-cy="record-item">
|
||||
书写病历
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Loading } from '@element-plus/icons-vue'
|
||||
import { getPendingMedicalRecords } from '@/api/outpatient/medicalRecord'
|
||||
|
||||
const loading = ref(false)
|
||||
const recordList = ref([])
|
||||
|
||||
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 = []
|
||||
} finally {
|
||||
// 核心修复:使用 finally 确保无论请求成功、失败或超时,loading 状态必定重置
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleWrite = (row) => {
|
||||
// 路由跳转至病历编辑器
|
||||
console.log('进入病历编辑:', row.id)
|
||||
}
|
||||
|
||||
onMounted(fetchRecords)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.pending-records-container {
|
||||
padding: 16px;
|
||||
}
|
||||
.card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.loading-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(255, 255, 255, 0.8);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 10;
|
||||
color: #409eff;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user