Files
his/openhis-ui-vue3/src/views/outpatient/PendingMedicalRecord.vue
2026-05-27 03:54:36 +08:00

74 lines
2.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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>
<el-table
v-loading="loading"
:data="records"
style="width: 100%"
data-cy="record-list"
empty-text="暂无待写病历"
>
<el-table-column prop="patientName" label="患者姓名" width="120" />
<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 type="primary" size="small" @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 { getPendingRecords } from '@/api/medicalRecord'
const loading = ref(false)
const records = ref([])
const fetchRecords = async () => {
loading.value = true
try {
// 修复增加请求超时控制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) => {
// 路由跳转至病历书写页
// router.push({ name: 'MedicalRecordWrite', params: { id: row.id } })
}
onMounted(fetchRecords)
</script>
<style scoped>
.pending-records-container {
padding: 16px;
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
}
</style>