diff --git a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/applicationForm/laboratoryTests.vue b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/applicationForm/laboratoryTests.vue index 23ff2965..6c8fe53c 100755 --- a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/applicationForm/laboratoryTests.vue +++ b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/applicationForm/laboratoryTests.vue @@ -244,6 +244,8 @@ const getList = async () => { const handleSearch = () => { // 搜索时保持已选中的项目不受影响 }; +// 编辑初始化标志:避免 applyEditTransferSelection 设置 transferValue 时触发 projectWithDepartment 覆盖 descJson 中的科室值 +const isInitializing = ref(false); const transferValue = ref([]); const form = reactive({ // categoryType: '', // 项目类别 @@ -341,6 +343,7 @@ const projectWithDepartment = (selectProjectIds, type) => { watch( () => transferValue.value, (newValue) => { + if (isInitializing.value) return; projectWithDepartment(newValue, 1); } ); @@ -377,7 +380,10 @@ const applyEditTransferSelection = () => { } } const uniq = [...new Set(selectedIds)] + // 设置初始化标志,防止 transferValue 变化触发 projectWithDepartment 覆盖 descJson 中的科室值 + isInitializing.value = true transferValue.value = uniq + isInitializing.value = false if (newData.requestFormDetailList.length && uniq.length === 0) { console.warn( '[LaboratoryTests] 申请单明细未能在项目字典中匹配到项,请核对 activityId / 项目名称', @@ -427,7 +433,9 @@ watch( selectedIds.push(matched.adviceDefinitionId); } }); + isInitializing.value = true; transferValue.value = selectedIds; + isInitializing.value = false; } );