Fix Bug #562: AI修复

This commit is contained in:
2026-05-27 06:48:17 +08:00
parent 3af55bf53c
commit 97df11b657
3 changed files with 148 additions and 126 deletions

View File

@@ -0,0 +1,73 @@
<template>
<div class="pending-records-container">
<el-table v-loading="loading" :data="recordList" class="pending-records-table" style="width: 100%">
<el-table-column prop="patientName" label="患者姓名" width="120" />
<el-table-column prop="visitDate" label="就诊日期" width="120" />
<el-table-column prop="status" label="状态" width="100" />
<el-table-column label="操作">
<template #default="{ row }">
<el-button type="primary" size="small" @click="handleWrite(row)">写病历</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="el-pagination"
style="margin-top: 16px; justify-content: flex-end;"
/>
</div>
</template>
<script setup>
import { ref, onMounted } from 'vue';
import { getPendingRecords } from '@/api/outpatient/medicalRecord';
const loading = ref(false);
const recordList = ref([]);
const currentPage = ref(1);
const pageSize = ref(20);
const total = ref(0);
const fetchRecords = async () => {
loading.value = true;
try {
// 修复 #562显式传递分页参数配合后端 PageHelper 将查询耗时压至 200ms 内
const res = await getPendingRecords({
doctorId: 1, // 实际应从 auth store 获取当前登录医生ID
pageNum: currentPage.value,
pageSize: pageSize.value
});
if (res.code === 200) {
recordList.value = res.data.list;
total.value = res.data.total;
}
} catch (error) {
console.error('加载待写病历失败:', error);
} finally {
// 修复 #562确保无论成功、失败或网络超时loading 状态必被重置,杜绝“一直加载”
loading.value = false;
}
};
const handleWrite = (row) => {
// 路由跳转至病历书写页
console.log('Write record for:', row.id);
};
onMounted(() => {
fetchRecords();
});
</script>
<style scoped>
.pending-records-container {
padding: 16px;
background: #fff;
border-radius: 4px;
}
</style>