fix(report): 修复库存报表查询SQL格式化问题并优化处方组套处理逻辑

- 修复InventoryProductReportMapper.xml中SQL查询的缩进格式问题
- 在prescriptionlist.vue中添加组套数据验证防止空值异常
- 优化组套处理逻辑确保医嘱详情数据正确获取
- 修复最小单位数量计算避免partPercent为空时的错误
This commit is contained in:
2026-03-02 14:14:20 +08:00
parent 04ad139eae
commit 25c266babb
2 changed files with 149 additions and 127 deletions

View File

@@ -2453,9 +2453,31 @@ function setValue(row) {
// 选择组套
function handleSaveGroup(orderGroupList) {
if (!orderGroupList || !Array.isArray(orderGroupList) || orderGroupList.length === 0) {
proxy.$modal.msgWarning('组套数据为空');
return;
}
orderGroupList.forEach((item) => {
rowIndex.value = prescriptionList.value.length;
setValue(item.orderDetailInfos);
// 确保 item 有值
if (!item) {
console.warn('组套中的项目为空');
return;
}
// 获取实际的医嘱项目数据
// 如果 item 包含 orderDetailInfos则使用它否则直接使用 item
const orderDetail = item.orderDetailInfos || item;
if (!orderDetail) {
console.warn('组套中的项目详情为空');
return;
}
// 使用医嘱项目详情设置值
setValue(orderDetail);
// 创建新的处方项目
const newRow = {
@@ -2490,7 +2512,7 @@ function handleSaveGroup(orderGroupList) {
} else {
newRow.price = newRow.unitPrice;
newRow.totalPrice = (item.quantity * newRow.unitPrice).toFixed(6);
newRow.minUnitQuantity = item.quantity * item.orderDetailInfos.partPercent;
newRow.minUnitQuantity = item.quantity * (orderDetail.partPercent || 1);
}
newRow.contentJson = JSON.stringify(newRow);