修复西药处方单bug
This commit is contained in:
@@ -1604,15 +1604,24 @@ function selectAdviceBase(key, row) {
|
||||
let targetIndex = -1;
|
||||
let targetRow = null;
|
||||
|
||||
// 遍历所有处方找到对应的行
|
||||
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;
|
||||
// 1. 首先在当前处方的prescriptionList中查找
|
||||
const currentIndex = prescriptionList.value.findIndex((item) => item.uniqueKey === key);
|
||||
if (currentIndex !== -1) {
|
||||
// 在当前处方中找到匹配的行
|
||||
targetPrescriptionId = currentPrescriptionId.value;
|
||||
targetIndex = currentIndex;
|
||||
targetRow = prescriptionList.value[currentIndex];
|
||||
} else {
|
||||
// 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;
|
||||
})
|
||||
.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)
|
||||
const saveAdviceType = item.adviceType == 4 ? 2 : item.adviceType;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user