- #427: switchCategory函数已实现手风琴逻辑(切换时收起其他分类) - #437: prescriptionlist.vue添加isSaving防重复提交锁 - #437: 使用JSON.parse(JSON.stringify(row))清理Vue响应式对象 - #437: 添加finally块确保锁释放
This commit is contained in:
@@ -383,6 +383,7 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
const isAdding = ref(false);
|
const isAdding = ref(false);
|
||||||
|
const isSaving = ref(false); // #437 防重复提交锁
|
||||||
const prescriptionRef = ref();
|
const prescriptionRef = ref();
|
||||||
const expandOrder = ref([]); //目前的展开行
|
const expandOrder = ref([]); //目前的展开行
|
||||||
const stockList = ref([]);
|
const stockList = ref([]);
|
||||||
@@ -1028,13 +1029,18 @@ function handleSave() {
|
|||||||
})
|
})
|
||||||
groupIndexList.value = []
|
groupIndexList.value = []
|
||||||
groupList.value = []
|
groupList.value = []
|
||||||
nextId.value == 1;
|
nextId.value = 1;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 单行处方保存
|
// 单行处方保存
|
||||||
function handleSaveSign(row, index) {
|
function handleSaveSign(row, index) {
|
||||||
|
// 🔧 Bug Fix #437: 防重复提交锁
|
||||||
|
if (isSaving.value) {
|
||||||
|
proxy.$modal.msgWarning('正在保存中,请勿重复提交');
|
||||||
|
return;
|
||||||
|
}
|
||||||
// 🔧 Bug Fix #238: 诊疗项目必须选择执行科室
|
// 🔧 Bug Fix #238: 诊疗项目必须选择执行科室
|
||||||
if (row.adviceType === 3 && !row.orgId) {
|
if (row.adviceType === 3 && !row.orgId) {
|
||||||
proxy.$modal.msgWarning('诊疗项目必须选择执行科室');
|
proxy.$modal.msgWarning('诊疗项目必须选择执行科室');
|
||||||
@@ -1042,33 +1048,37 @@ function handleSaveSign(row, index) {
|
|||||||
}
|
}
|
||||||
proxy.$refs['formRef' + index].validate((valid) => {
|
proxy.$refs['formRef' + index].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
isSaving.value = true; // #437 加锁
|
||||||
row.isEdit = false;
|
row.isEdit = false;
|
||||||
isAdding.value = false;
|
isAdding.value = false;
|
||||||
expandOrder.value = [];
|
expandOrder.value = [];
|
||||||
row.patientId = props.patientInfo.patientId;
|
row.patientId = props.patientInfo.patientId;
|
||||||
row.encounterId = props.patientInfo.encounterId;
|
row.encounterId = props.patientInfo.encounterId;
|
||||||
row.accountId = props.patientInfo.accountId;
|
row.accountId = props.patientInfo.accountId;
|
||||||
row.contentJson = JSON.stringify(row);
|
const cleanRow = JSON.parse(JSON.stringify(row));
|
||||||
row.dbOpType = row.requestId ? '2' : '1';
|
cleanRow.contentJson = JSON.stringify(cleanRow);
|
||||||
row.minUnitQuantity = row.quantity * row.partPercent;
|
cleanRow.dbOpType = cleanRow.requestId ? '2' : '1';
|
||||||
row.categoryEnum = row.adviceType
|
cleanRow.minUnitQuantity = cleanRow.quantity * cleanRow.partPercent;
|
||||||
|
cleanRow.categoryEnum = cleanRow.adviceType
|
||||||
// 如果是手术计费,设置生成来源和来源业务单据号
|
// 如果是手术计费,设置生成来源和来源业务单据号
|
||||||
if (props.patientInfo.sourceBillNo) {
|
if (props.patientInfo.sourceBillNo) {
|
||||||
row.generateSourceEnum = 6; // 手术计费
|
cleanRow.generateSourceEnum = 6; // 手术计费
|
||||||
row.sourceBillNo = props.patientInfo.sourceBillNo;
|
cleanRow.sourceBillNo = props.patientInfo.sourceBillNo;
|
||||||
}
|
}
|
||||||
console.log('row', row)
|
console.log('cleanRow', cleanRow)
|
||||||
savePrescription({ adviceSaveList: [row] }).then((res) => {
|
savePrescription({ adviceSaveList: [cleanRow] }).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
proxy.$modal.msgSuccess('保存成功');
|
proxy.$modal.msgSuccess('保存成功');
|
||||||
getListInfo(false);
|
getListInfo(false);
|
||||||
nextId.value == 1;
|
nextId.value = 1;
|
||||||
// 🔧 Bug Fix #238: 如果诊疗项目缺少执行科室,标记为需要修复的脏数据
|
// 🔧 Bug Fix #238: 如果诊疗项目缺少执行科室,标记为需要修复的脏数据
|
||||||
if (row.adviceType === 3 && !row.orgId) {
|
if (row.adviceType === 3 && !row.orgId) {
|
||||||
console.warn('Bug #238: 检测到诊疗项目保存时缺少执行科室,请手动编辑修正:', row);
|
console.warn('Bug #238: 检测到诊疗项目保存时缺少执行科室,请手动编辑修正:', cleanRow);
|
||||||
proxy.$modal.msgWarning('诊疗项目执行科室信息不完整,请编辑后重新保存');
|
proxy.$modal.msgWarning('诊疗项目执行科室信息不完整,请编辑后重新保存');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
isSaving.value = false; // #437 释放锁
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user