From 7bccbc7085de7e1e2344518c3f4995844ce73ea2 Mon Sep 17 00:00:00 2001 From: zhaoyun Date: Sat, 25 Apr 2026 19:47:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Bug=20#427=20=E6=A3=80=E6=9F=A5=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E5=88=86=E7=B1=BB=E6=89=8B=E9=A3=8E=E7=90=B4=E5=B1=95?= =?UTF-8?q?=E5=BC=80=20+=20Bug=20#437=20=E6=89=8B=E6=9C=AF=E8=AE=A1?= =?UTF-8?q?=E8=B4=B9=E9=87=8D=E5=A4=8D=E8=AE=B0=E5=BD=95=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - #427: switchCategory函数已实现手风琴逻辑(切换时收起其他分类) - #437: prescriptionlist.vue添加isSaving防重复提交锁 - #437: 使用JSON.parse(JSON.stringify(row))清理Vue响应式对象 - #437: 添加finally块确保锁释放 --- .../bargain/component/prescriptionlist.vue | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/openhis-ui-vue3/src/views/clinicmanagement/bargain/component/prescriptionlist.vue b/openhis-ui-vue3/src/views/clinicmanagement/bargain/component/prescriptionlist.vue index 9101399f..39dbab7f 100644 --- a/openhis-ui-vue3/src/views/clinicmanagement/bargain/component/prescriptionlist.vue +++ b/openhis-ui-vue3/src/views/clinicmanagement/bargain/component/prescriptionlist.vue @@ -383,6 +383,7 @@ const props = defineProps({ }, }); const isAdding = ref(false); +const isSaving = ref(false); // #437 防重复提交锁 const prescriptionRef = ref(); const expandOrder = ref([]); //目前的展开行 const stockList = ref([]); @@ -1028,13 +1029,18 @@ function handleSave() { }) groupIndexList.value = [] groupList.value = [] - nextId.value == 1; + nextId.value = 1; } }); } // 单行处方保存 function handleSaveSign(row, index) { + // 🔧 Bug Fix #437: 防重复提交锁 + if (isSaving.value) { + proxy.$modal.msgWarning('正在保存中,请勿重复提交'); + return; + } // 🔧 Bug Fix #238: 诊疗项目必须选择执行科室 if (row.adviceType === 3 && !row.orgId) { proxy.$modal.msgWarning('诊疗项目必须选择执行科室'); @@ -1042,33 +1048,37 @@ function handleSaveSign(row, index) { } proxy.$refs['formRef' + index].validate((valid) => { if (valid) { + isSaving.value = true; // #437 加锁 row.isEdit = false; isAdding.value = false; expandOrder.value = []; row.patientId = props.patientInfo.patientId; row.encounterId = props.patientInfo.encounterId; row.accountId = props.patientInfo.accountId; - row.contentJson = JSON.stringify(row); - row.dbOpType = row.requestId ? '2' : '1'; - row.minUnitQuantity = row.quantity * row.partPercent; - row.categoryEnum = row.adviceType + const cleanRow = JSON.parse(JSON.stringify(row)); + cleanRow.contentJson = JSON.stringify(cleanRow); + cleanRow.dbOpType = cleanRow.requestId ? '2' : '1'; + cleanRow.minUnitQuantity = cleanRow.quantity * cleanRow.partPercent; + cleanRow.categoryEnum = cleanRow.adviceType // 如果是手术计费,设置生成来源和来源业务单据号 if (props.patientInfo.sourceBillNo) { - row.generateSourceEnum = 6; // 手术计费 - row.sourceBillNo = props.patientInfo.sourceBillNo; + cleanRow.generateSourceEnum = 6; // 手术计费 + cleanRow.sourceBillNo = props.patientInfo.sourceBillNo; } - console.log('row', row) - savePrescription({ adviceSaveList: [row] }).then((res) => { + console.log('cleanRow', cleanRow) + savePrescription({ adviceSaveList: [cleanRow] }).then((res) => { if (res.code === 200) { proxy.$modal.msgSuccess('保存成功'); getListInfo(false); - nextId.value == 1; + nextId.value = 1; // 🔧 Bug Fix #238: 如果诊疗项目缺少执行科室,标记为需要修复的脏数据 if (row.adviceType === 3 && !row.orgId) { - console.warn('Bug #238: 检测到诊疗项目保存时缺少执行科室,请手动编辑修正:', row); + console.warn('Bug #238: 检测到诊疗项目保存时缺少执行科室,请手动编辑修正:', cleanRow); proxy.$modal.msgWarning('诊疗项目执行科室信息不完整,请编辑后重新保存'); } } + }).finally(() => { + isSaving.value = false; // #437 释放锁 }); } });