删除重复函数

This commit is contained in:
叶锦涛
2025-11-19 16:43:12 +08:00
parent a6561e2ca6
commit c84fc3c236

View File

@@ -1655,89 +1655,19 @@ function validateGroups(saveList) {
}
return true;
}
// 获取处方单药品数量
function getPrescriptionMedicineCount(prescriptionIndex) {
// 这里需要根据实际数据结构来判断暂时返回0
// TODO: 根据处方单索引获取对应的药品数量
return 0;
}
// 获取处方单总价
function getPrescriptionTotalPrice(prescriptionIndex) {
// 这里需要根据实际数据结构来判断暂时返回0
// TODO: 根据处方单索引获取对应的总价
return 0;
}
// 判断处方单是否可删除
function isPrescriptionDeletable(prescriptionIndex) {
// 条件1处方单没有药品
const medicineCount = getPrescriptionMedicineCount(prescriptionIndex);
if (medicineCount > 0) {
return false;
}
// 条件2处方单未收费这里需要根据实际收费状态字段判断
// TODO: 根据实际的收费状态字段来判断
// const isCharged = checkPrescriptionCharged(prescriptionIndex);
// if (isCharged) {
// return false;
// }
return true;
}
// 删除处方单
function handleDeletePrescriptionClick(prescriptionIndex) {
if (!isPrescriptionDeletable(prescriptionIndex)) {
const medicineCount = getPrescriptionMedicineCount(prescriptionIndex);
if (medicineCount > 0) {
proxy.$modal.msgWarning('该处方单还有药品,请先删除所有药品后再删除处方单');
} else {
proxy.$modal.msgWarning('该处方单已收费,不能删除');
}
return;
}
// 确认删除
proxy.$modal.confirm('确定要删除这个处方单吗?').then(() => {
tcmPrescriptionList.value.splice(prescriptionIndex, 1);
proxy.$modal.msgSuccess('处方单删除成功');
}).catch(() => {
// 用户取消删除
});
}
// 获取处方单药品数量
function getPrescriptionMedicineCount(prescriptionIndex) {
// 目前所有药品都在 prescriptionList 中,暂时返回总数量
// TODO: 将来需要按处方单分组药品
return prescriptionList.value.filter(item => item.statusEnum !== 2).length;
}
// 获取处方单总价
function getPrescriptionTotalPrice(prescriptionIndex) {
// 目前所有药品都在 prescriptionList 中,暂时返回总价
// TODO: 将来需要按处方单分组计算总价
return prescriptionList.value
.filter(item => item.statusEnum !== 2)
.reduce((total, item) => total + (Number(item.totalPrice) || 0), 0)
.toFixed(2);
}
// 判断处方单是否可删除
function isPrescriptionDeletable(prescriptionIndex) {
// 条件1处方单没有药品
const medicineCount = getPrescriptionMedicineCount(prescriptionIndex);
if (medicineCount > 0) {
return false;
}
// 条件2处方单未收费这里需要根据实际收费状态字段判断
// TODO: 根据实际的收费状态字段来判断
// 暂时返回true等有收费状态字段后再完善
return true;
}
defineExpose({ getListInfo, getDiagnosisInfo });
</script>