diff --git a/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/infectiousDiseaseReportDialog.vue b/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/infectiousDiseaseReportDialog.vue index 647bfa928..837f2eb1c 100755 --- a/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/infectiousDiseaseReportDialog.vue +++ b/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/infectiousDiseaseReportDialog.vue @@ -548,6 +548,8 @@ const dialogReadOnly = ref(false); const formRef = ref(null); // 保存按钮加载状态,防止重复提交 const submitLoading = ref(false); +// 数据加载中标志,防止 showReport 加载已有数据时 watch 清空分型字段 +const loadingData = ref(false); const props = defineProps({ title: { @@ -940,7 +942,8 @@ const showSubtypeSelect = computed(() => { // 监听疾病选择变化,自动清空分型选择 watch(() => [form.value.selectedClassA, form.value.selectedClassB, form.value.selectedClassC], (newVal, oldVal) => { // 如果疾病选择发生变化,清空分型选择 - if (JSON.stringify(newVal) !== JSON.stringify(oldVal)) { + // 数据加载中时不清空,避免 showReport 加载已有数据时被错误清空 + if (JSON.stringify(newVal) !== JSON.stringify(oldVal) && !loadingData.value) { form.value.diseaseType = ''; } }, { deep: true }); @@ -1092,6 +1095,9 @@ function showReport(reportData = {}, readOnly = true) { dialogVisible.value = true; dialogReadOnly.value = readOnly; + // 标记数据加载中,防止 watch 清空 diseaseType 分型字段 + loadingData.value = true; + resetAddressSelector(); initProvinceOptions(); @@ -1149,6 +1155,9 @@ function showReport(reportData = {}, readOnly = true) { form.value.addressCounty, form.value.addressTown ); + + // 数据加载完成,恢复 watch 监听 + loadingData.value = false; } /**