修复西药处方单bug

This commit is contained in:
2025-11-25 13:49:38 +08:00
parent 250d7dde34
commit 50ef9e6743

View File

@@ -1604,15 +1604,24 @@ function selectAdviceBase(key, row) {
let targetIndex = -1; let targetIndex = -1;
let targetRow = null; let targetRow = null;
// 遍历所有处方找到对应的行 // 1. 首先在当前处方的prescriptionList中查找
for (const prescription of westernPrescriptions.value) { const currentIndex = prescriptionList.value.findIndex((item) => item.uniqueKey === key);
const prescriptionData = allPrescriptionsData.value[prescription.id] || []; if (currentIndex !== -1) {
const index = prescriptionData.findIndex((item) => item.uniqueKey === key); // 在当前处方中找到匹配的行
if (index !== -1) { targetPrescriptionId = currentPrescriptionId.value;
targetPrescriptionId = prescription.id; targetIndex = currentIndex;
targetIndex = index; targetRow = prescriptionList.value[currentIndex];
targetRow = prescriptionData[index]; } else {
break; // 2. 如果当前处方中找不到,遍历所有处方找到对应的行
for (const prescription of westernPrescriptions.value) {
const prescriptionData = allPrescriptionsData.value[prescription.id] || [];
const index = prescriptionData.findIndex((item) => item.uniqueKey === key);
if (index !== -1) {
targetPrescriptionId = prescription.id;
targetIndex = index;
targetRow = prescriptionData[index];
break;
}
} }
} }
@@ -2285,6 +2294,13 @@ function handleSaveBatch(prescriptionId) {
return item.statusEnum == 1 && !item.isSaved; return item.statusEnum == 1 && !item.isSaved;
}) })
.map((item) => { .map((item) => {
// 为每个医嘱项设置minUnitQuantity值避免后端null值异常
if (item.adviceType == 1 || item.adviceType == 2) {
item.minUnitQuantity = item.minUnitCode == item.unitCode ? item.quantity : item.quantity * item.partPercent;
} else {
item.minUnitQuantity = item.quantity;
}
// 将前端的耗材类型4转换为后端需要的类型2 // 将前端的耗材类型4转换为后端需要的类型2
const saveAdviceType = item.adviceType == 4 ? 2 : item.adviceType; const saveAdviceType = item.adviceType == 4 ? 2 : item.adviceType;