Backup local changes before resolving remote repository issue
This commit is contained in:
@@ -103,6 +103,7 @@ import dayjs from 'dayjs';
|
||||
// 打印工具
|
||||
import {PRINT_TEMPLATE, simplePrint} from '@/utils/printUtils.js';
|
||||
import {getEncounterDiagnosis} from '../api';
|
||||
import apiRequestManager from '@/utils/apiRequestManager.js';
|
||||
import History from './components/history';
|
||||
import Template from './components/template';
|
||||
import TemplateEdit from './components/templateEdit.vue';
|
||||
@@ -205,7 +206,7 @@ const handleNodeClick = (data, node) => {
|
||||
|
||||
// 选择任何病历模板后,都加载该病历类型的最新历史记录
|
||||
if (node.isLeaf && props.patientInfo && props.patientInfo.patientId) {
|
||||
loadLatestMedicalRecord();
|
||||
debouncedLoadLatestMedicalRecord();
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
@@ -279,7 +280,7 @@ const handleSubmitOk = async (data) => {
|
||||
|
||||
// 等待历史记录列表更新后,重新加载最新病历并更新选中状态
|
||||
setTimeout(() => {
|
||||
loadLatestMedicalRecord();
|
||||
debouncedLoadLatestMedicalRecord();
|
||||
}, 100);
|
||||
} catch (error) {
|
||||
ElMessage.error('提交失败');
|
||||
@@ -410,7 +411,7 @@ const selectOutpatientMedicalRecordTemplate = async () => {
|
||||
// 等待模板加载完成,然后获取并回显最新病历数据
|
||||
setTimeout(() => {
|
||||
historyRef.value?.queryList();
|
||||
loadLatestMedicalRecord();
|
||||
debouncedLoadLatestMedicalRecord();
|
||||
}, 500);
|
||||
});
|
||||
} else {
|
||||
@@ -421,19 +422,36 @@ const selectOutpatientMedicalRecordTemplate = async () => {
|
||||
// 当前选中的历史病历ID,用于在History组件中高亮显示
|
||||
const selectedHistoryRecordId = ref('');
|
||||
|
||||
import { debounce } from 'lodash-es';
|
||||
|
||||
// 防止重复加载的标志
|
||||
let isLoadingLatestRecord = false;
|
||||
|
||||
// 加载最新的病历数据并回显
|
||||
const loadLatestMedicalRecord = async () => {
|
||||
if (!patientInfo.value.encounterId || !currentSelectTemplate.value.id) return;
|
||||
|
||||
// 防止重复加载
|
||||
if (isLoadingLatestRecord) {
|
||||
console.log('Latest medical record is already loading, skipping duplicate call');
|
||||
return;
|
||||
}
|
||||
|
||||
isLoadingLatestRecord = true;
|
||||
loading.value = true;
|
||||
|
||||
try {
|
||||
// 获取患者的历史病历记录
|
||||
const res = await getRecordByEncounterIdList({
|
||||
isPage: 0,
|
||||
encounterId: patientInfo.value.encounterId,
|
||||
patientId: patientInfo.value.patientId,
|
||||
definitionId: currentSelectTemplate.value.id,
|
||||
});
|
||||
const res = await apiRequestManager.execute(
|
||||
getRecordByEncounterIdList,
|
||||
'/document/record/getRecordByEncounterIdList',
|
||||
{
|
||||
isPage: 0,
|
||||
encounterId: patientInfo.value.encounterId,
|
||||
patientId: patientInfo.value.patientId,
|
||||
definitionId: currentSelectTemplate.value.id,
|
||||
}
|
||||
);
|
||||
|
||||
const historyRecords = res.data || [];
|
||||
if (historyRecords.length > 0) {
|
||||
@@ -519,8 +537,12 @@ const loadLatestMedicalRecord = async () => {
|
||||
});
|
||||
} finally {
|
||||
loading.value = false;
|
||||
isLoadingLatestRecord = false; // 重置加载标志
|
||||
}
|
||||
};
|
||||
|
||||
// 防抖版本的加载最新病历数据函数
|
||||
const debouncedLoadLatestMedicalRecord = debounce(loadLatestMedicalRecord, 300);
|
||||
const templateRef = ref(null);
|
||||
|
||||
const handleTemplateClick = (data) => {
|
||||
@@ -750,7 +772,7 @@ const selectDefaultTemplate = () => {
|
||||
|
||||
// 直接加载最新病历数据,不再使用额外的setTimeout延迟
|
||||
// 因为handleNodeClick中已经有nextTick和setTimeout处理组件渲染
|
||||
loadLatestMedicalRecord();
|
||||
debouncedLoadLatestMedicalRecord();
|
||||
});
|
||||
} else {
|
||||
console.log('未找到门诊病历模板');
|
||||
|
||||
Reference in New Issue
Block a user