Backup local changes before resolving remote repository issue

This commit is contained in:
2026-01-27 10:05:25 +08:00
parent 11c2758289
commit 86bca03b04
29 changed files with 2626 additions and 126 deletions

View File

@@ -42,6 +42,7 @@ import {defineEmits, ref, unref} from 'vue';
import {deleteRecord, getRecordByEncounterIdList} from '../api';
import {ElMessage} from 'element-plus';
import {patientInfo} from '../../store/patient.js';
import apiRequestManager from '@/utils/apiRequestManager.js';
const emits = defineEmits(['historyClick']);
const props = defineProps({
@@ -67,15 +68,30 @@ const queryParams = ref({
isPage: 0,
});
const historyData = ref([]);
// 防止重复加载的标志
let isLoadingHistory = false;
const queryList = async () => {
// 防止重复加载
if (isLoadingHistory) {
console.log('History data is already loading, skipping duplicate call');
return;
}
isLoadingHistory = true;
try {
if (patientInfo.value.encounterId && unref(definitionId) && unref(definitionId) !== '') {
const res = await getRecordByEncounterIdList({
...queryParams.value,
encounterId: patientInfo.value.encounterId,
patientId: patientInfo.value.patientId,
definitionId: unref(definitionId),
});
const res = await apiRequestManager.execute(
getRecordByEncounterIdList,
'/document/record/getRecordByEncounterIdList',
{
isPage: 0, // 确保参数一致,便于去重
encounterId: patientInfo.value.encounterId,
patientId: patientInfo.value.patientId,
definitionId: unref(definitionId),
}
);
historyData.value = res.data || [];
} else {
historyData.value = [];
@@ -83,6 +99,8 @@ const queryList = async () => {
} catch (error) {
// ElMessage.error(' 获取模板树失败 ');
historyData.value = [];
} finally {
isLoadingHistory = false; // 重置加载标志
}
};
const handleNodeClick = (data) => {

View File

@@ -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('未找到门诊病历模板');

View File

@@ -209,6 +209,7 @@ import useUserStore from '@/store/modules/user';
import { nextTick } from 'vue';
import { updatePatientInfo } from './components/store/patient.js';
import { ElMessage, ElMessageBox } from 'element-plus';
import { debounce } from 'lodash-es';
// // 监听路由离开事件
// onBeforeRouteLeave((to, from, next) => {
@@ -487,7 +488,8 @@ function handleOpen() {
patientDrawerRef.value.refreshList();
}
function handleCardClick(item, index) {
// 原始的handleCardClick函数
function handleCardClickOriginal(item, index) {
console.log('handleCardClick 被调用');
console.log('点击的患者项目:', item);
console.log('患者项目中的encounterId:', item.encounterId);
@@ -544,6 +546,9 @@ function handleCardClick(item, index) {
});
}
// 使用防抖的handleCardClick函数防止短时间内多次点击
const handleCardClick = debounce(handleCardClickOriginal, 500);
function handleLeave(encounterId) {
leaveEncounter(encounterId).then((res) => {
if (res.code == 200) {
@@ -589,7 +594,7 @@ function handleHospitalizationClick() {
// 接诊回调
function handleReceive(row) {
handleCardClick(row);
handleCardClickOriginal(row);
currentEncounterId.value = row.encounterId;
drawer.value = false;
getPatientList();
@@ -776,7 +781,7 @@ const markSeen = async () => {
currentCallPatient.value = {};
};
const callThis = (row) => {
handleCardClick(row);
handleCardClickOriginal(row);
currentCallPatient.value = row;
dialogVisible.value = false;
// 刷新患者列表和候诊列表