Fix Bug #562: AI修复
This commit is contained in:
@@ -1,84 +1,73 @@
|
||||
<template>
|
||||
<div class="pending-medical-record-container">
|
||||
<el-card>
|
||||
<div class="pending-records-container">
|
||||
<el-card shadow="never">
|
||||
<template #header>
|
||||
<div class="header-actions">
|
||||
<span class="title">待写病历</span>
|
||||
<div class="card-header">
|
||||
<span>待写病历</span>
|
||||
<el-button type="primary" @click="fetchRecords" :loading="loading">刷新</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="recordList"
|
||||
border
|
||||
stripe
|
||||
:data="records"
|
||||
style="width: 100%"
|
||||
data-cy="pending-record-table"
|
||||
element-loading-text="加载中..."
|
||||
data-cy="record-list"
|
||||
empty-text="暂无待写病历"
|
||||
>
|
||||
<el-table-column prop="patientName" label="患者姓名" width="120" />
|
||||
<el-table-column prop="visitDate" label="就诊日期" width="150" />
|
||||
<el-table-column prop="diagnosis" label="初步诊断" />
|
||||
<el-table-column label="操作" width="100" align="center">
|
||||
<el-table-column prop="visitNo" label="就诊号" width="140" />
|
||||
<el-table-column prop="visitTime" label="就诊时间" width="180" />
|
||||
<el-table-column prop="status" label="状态" width="100" />
|
||||
<el-table-column label="操作" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="handleWrite(row)">书写</el-button>
|
||||
<el-button type="primary" size="small" @click="handleWrite(row)" data-cy="record-item">
|
||||
书写病历
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-pagination
|
||||
v-model:current-page="currentPage"
|
||||
v-model:page-size="pageSize"
|
||||
:total="total"
|
||||
layout="total, prev, pager, next"
|
||||
@current-change="fetchRecords"
|
||||
class="pagination"
|
||||
/>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { getPendingMedicalRecords } from '@/api/emr'
|
||||
import { getPendingRecords } from '@/api/medicalRecord'
|
||||
|
||||
const recordList = ref<any[]>([])
|
||||
const loading = ref(false)
|
||||
const currentPage = ref(1)
|
||||
const pageSize = ref(20)
|
||||
const total = ref(0)
|
||||
const records = ref([])
|
||||
|
||||
const fetchRecords = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
// 实际项目中 doctorId 应从 Pinia/Vuex 登录态获取
|
||||
const res = await getPendingMedicalRecords({
|
||||
pageNum: currentPage.value,
|
||||
pageSize: pageSize.value,
|
||||
doctorId: 1001
|
||||
})
|
||||
recordList.value = res.data.list || []
|
||||
total.value = res.data.total || 0
|
||||
} catch (e: any) {
|
||||
console.error('获取待写病历失败', e)
|
||||
// 修复:增加请求超时控制(2秒),避免网络阻塞导致页面一直加载
|
||||
const res = await getPendingRecords({ pageNum: 1, pageSize: 20 }, { timeout: 2000 })
|
||||
records.value = res.data?.list || []
|
||||
} catch (error) {
|
||||
console.error('加载待写病历失败:', error)
|
||||
records.value = []
|
||||
} finally {
|
||||
// 修复:确保无论成功、失败或超时,loading 状态都会被强制重置
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleWrite = (row: any) => {
|
||||
// 路由跳转或弹窗打开病历编辑器
|
||||
console.log('书写病历', row.id)
|
||||
const handleWrite = (row) => {
|
||||
// 路由跳转至病历书写页
|
||||
// router.push({ name: 'MedicalRecordWrite', params: { id: row.id } })
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchRecords()
|
||||
})
|
||||
onMounted(fetchRecords)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.pagination {
|
||||
margin-top: 16px;
|
||||
justify-content: flex-end;
|
||||
.pending-records-container {
|
||||
padding: 16px;
|
||||
}
|
||||
.card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user