fix: #579 (codex)

This commit is contained in:
2026-05-24 14:57:10 +08:00
parent 1ac2252c34
commit f11fa023c4
2 changed files with 23 additions and 32 deletions

View File

@@ -445,6 +445,18 @@ getPharmacyCabinetLists();
font-weight: 500;
}
.value-highlight {
color: #409eff;
font-weight: 700;
font-size: 15px;
}
.data-row-summary {
margin-top: 16px;
padding-top: 16px;
border-top: 2px solid #e4e7ed;
}
/* 搜索表单区域样式优化 */
.el-form--inline .el-form-item {
margin-bottom: 12px;

View File

@@ -578,6 +578,7 @@ function processListWithSubtotals(list) {
// 跳过已有的合计行
if (row.departmentName === '合计') {
result.push(row);
rowSpanMap.value[result.length - 1] = { rowspan: 1, colspan: 1 };
i++;
continue;
}
@@ -695,6 +696,9 @@ function getList(type) {
// 处理搜索关键词时的合计
if (queryParams.value.searchKey) {
// 先处理小计行和合并信息
purchaseinventoryList.value = processListWithSubtotals(purchaseinventoryList.value);
purchaseinventoryList.value.forEach((k) => {
if (k.departmentName !== '小计' && k.departmentName !== '合计') {
totalPrice2 += Number(k.totalPrice) || 0;
@@ -720,6 +724,9 @@ function getList(type) {
// 单页数据合计
if (total.value && total.value <= queryParams.value.pageSize) {
// 先处理小计行和合并信息
purchaseinventoryList.value = processListWithSubtotals(purchaseinventoryList.value);
totalPrice2 = totalPrice2 ? totalPrice2.toFixed(4) : totalPrice2;
let pageNoAll = total.value / queryParams.value.pageSize;
@@ -745,7 +752,7 @@ function getList(type) {
purchaseinventoryListAll.value = res.data.records || [];
if (purchaseinventoryListAll.value.length > 0) {
purchaseinventoryListAll.value.map((k, index) => {
purchaseinventoryListAll.value.map((k) => {
k.totalPrice = k.totalPrice ? k.totalPrice.toFixed(4) : '0.0000';
k.price = k.price ? k.price.toFixed(4) : '0.0000';
k.number = k.number
@@ -753,39 +760,11 @@ function getList(type) {
: '0.0000' + (k.quantityUnit_dictText ? k.quantityUnit_dictText : '');
totalPrice2 += Number(k.totalPrice);
// 处理跨页门诊号小计
for (let m = 1; m < index; m++) {
if (
queryParams.value.pageNo > 1 &&
index == queryParams.value.pageSize * (queryParams.value.pageNo - 1) &&
k.busNo == purchaseinventoryListAll.value[index - m]?.busNo
) {
let dispenseNoIndex1 = purchaseinventoryList.value.findIndex(
(o) => o.departmentName == '小计' && o.busNo == purchaseinventoryListAll.value[index - m].busNo
);
if (dispenseNoIndex1 > 0) {
purchaseinventoryList.value[dispenseNoIndex1].totalPrice =
(Number(purchaseinventoryList.value[dispenseNoIndex1].totalPrice) +
Number(purchaseinventoryListAll.value[index - m].totalPrice)).toFixed(4) || '0.0000';
}
}
if (
index + m == queryParams.value.pageSize * queryParams.value.pageNo &&
k.busNo == purchaseinventoryListAll.value[index + m]?.busNo
) {
if (
purchaseinventoryList.value[purchaseinventoryList.value.length - 1]
.departmentName == '小计'
) {
purchaseinventoryList.value.splice(purchaseinventoryList.value.length - 1, 1);
}
}
}
});
// 用 processListWithSubtotals 统一处理小计和合并行
purchaseinventoryList.value = processListWithSubtotals(purchaseinventoryListAll.value);
totalPrice2 = totalPrice2 ? totalPrice2.toFixed(4) : totalPrice2;
loading.value = false;