Fix Bug #562: AI修复
This commit is contained in:
@@ -1,40 +1,26 @@
|
||||
<template>
|
||||
<div class="pending-records-container">
|
||||
<div class="pending-medical-record-container">
|
||||
<div class="header-bar">
|
||||
<h2>待写病历</h2>
|
||||
<el-date-picker
|
||||
v-model="queryParams.visitDate"
|
||||
type="date"
|
||||
placeholder="选择就诊日期"
|
||||
@change="fetchRecords"
|
||||
/>
|
||||
<h3>待写病历</h3>
|
||||
<el-button type="primary" :loading="loading" @click="fetchRecords">刷新</el-button>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="recordList"
|
||||
style="width: 100%"
|
||||
row-key="id"
|
||||
@row-click="handleRowClick"
|
||||
>
|
||||
<el-table-column prop="patientName" label="患者姓名" min-width="120" />
|
||||
<el-table-column prop="visitDate" label="就诊日期" min-width="120" />
|
||||
<el-table-column prop="status" label="状态" min-width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag type="warning">待书写</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table v-loading="loading" :data="recordList" style="width: 100%" stripe>
|
||||
<el-table-column prop="patientName" label="患者姓名" width="120" />
|
||||
<el-table-column prop="visitNo" label="就诊号" width="150" />
|
||||
<el-table-column prop="createTime" label="就诊时间" width="180" />
|
||||
<el-table-column prop="diagnosis" label="初步诊断" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" size="small" @click.stop="handleWrite(row)">书写</el-button>
|
||||
<el-button type="primary" size="small" @click="handleWrite(row)">书写</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination-wrapper">
|
||||
<el-pagination
|
||||
v-model:current-page="queryParams.pageNum"
|
||||
v-model:page-size="queryParams.pageSize"
|
||||
v-model:current-page="currentPage"
|
||||
v-model:page-size="pageSize"
|
||||
:total="total"
|
||||
:page-sizes="[10, 20, 50]"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@@ -46,53 +32,63 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { getPendingMedicalRecords } from '@/api/outpatient/medicalRecord';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
import { ref, onMounted, onUnmounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { getPendingMedicalRecords } from '@/api/outpatient/medicalRecord'
|
||||
|
||||
const router = useRouter();
|
||||
const userStore = useUserStore();
|
||||
const router = useRouter()
|
||||
const loading = ref(false)
|
||||
const recordList = ref([])
|
||||
const currentPage = ref(1)
|
||||
const pageSize = ref(20)
|
||||
const total = ref(0)
|
||||
|
||||
const loading = ref(false);
|
||||
const recordList = ref([]);
|
||||
const total = ref(0);
|
||||
const queryParams = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
doctorId: userStore.userInfo?.id || null,
|
||||
visitDate: null
|
||||
});
|
||||
// 修复 #562:使用 AbortController 取消重复/过期请求,防止并发堆积导致 UI 假死
|
||||
let abortController = null
|
||||
|
||||
const fetchRecords = async () => {
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await getPendingMedicalRecords(queryParams.value);
|
||||
if (res.code === 200) {
|
||||
recordList.value = res.data.list || [];
|
||||
total.value = res.data.total || 0;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载待写病历失败:', error);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
if (abortController) {
|
||||
abortController.abort()
|
||||
}
|
||||
};
|
||||
abortController = new AbortController()
|
||||
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await getPendingMedicalRecords({
|
||||
pageNum: currentPage.value,
|
||||
pageSize: pageSize.value,
|
||||
status: 'pending'
|
||||
}, { signal: abortController.signal })
|
||||
|
||||
recordList.value = res.data.list || []
|
||||
total.value = res.data.total || 0
|
||||
} catch (error) {
|
||||
if (error.name !== 'AbortError') {
|
||||
console.error('加载待写病历失败:', error)
|
||||
}
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleWrite = (row) => {
|
||||
router.push({ name: 'MedicalRecordEditor', params: { id: row.id } });
|
||||
};
|
||||
router.push({ name: 'EmrEditor', query: { recordId: row.id, visitNo: row.visitNo } })
|
||||
}
|
||||
|
||||
const handleRowClick = (row) => {
|
||||
handleWrite(row);
|
||||
};
|
||||
onMounted(() => {
|
||||
fetchRecords()
|
||||
})
|
||||
|
||||
onMounted(fetchRecords);
|
||||
onUnmounted(() => {
|
||||
if (abortController) {
|
||||
abortController.abort()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.pending-records-container {
|
||||
padding: 20px;
|
||||
.pending-medical-record-container {
|
||||
padding: 16px;
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
}
|
||||
@@ -107,7 +103,4 @@ onMounted(fetchRecords);
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.el-table__row {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user