fix: #568 (codex)

This commit is contained in:
2026-05-24 14:55:18 +08:00
parent 2b2fcc0f20
commit 1ac2252c34
2 changed files with 148 additions and 103 deletions

View File

@@ -150,6 +150,10 @@
<span class="label">普通挂号费</span>
<span class="value">{{ formatValue(reportValue.GENERAL_CONSULTATION_FEE) }}</span>
</el-col>
<el-col :span="6">
<span class="label">挂号费</span>
<span class="value">{{ formatValue(reportValue.REGISTRATION_FEE) }}</span>
</el-col>
<el-col :span="6">
<span class="label">其他费用</span>
<span class="value">{{ formatValue(reportValue.OTHER_FEE) }}</span>
@@ -158,15 +162,15 @@
<span class="label">退费金额</span>
<span class="value">{{ formatValue(reportValue.returnFee) }}</span>
</el-col>
</el-row>
<el-row class="data-row data-row-summary" :gutter="10">
<el-col :span="6">
<span class="label">费用总额</span>
<span class="value">{{ formatValue(Number(reportValue.DIAGNOSTIC_FEE || 0) + Number(reportValue.CHECK_FEE || 0) + Number(reportValue.DIAGNOSTIC_TEST_FEE || 0) + Number(reportValue.MEDICAL_EXPENSE_FEE || 0) + Number(reportValue.WEST_MEDICINE || 0) + Number(reportValue.CHINESE_MEDICINE_SLICES_FEE || 0) + Number(reportValue.CHINESE_MEDICINE_FEE || 0) + Number(reportValue.GENERAL_CONSULTATION_FEE || 0) + Number(reportValue.REGISTRATION_FEE || 0) + Number(reportValue.OTHER_FEE || 0) + Number(reportValue.SANITARY_MATERIALS_FEE || 0)) }}</span>
<span class="value value-highlight">{{ totalFeeAmount }}</span>
</el-col>
</el-row>
<el-row class="data-row" :gutter="10">
<el-col :span="6">
<span class="label">医保报销</span>
<span class="value">{{ formatValue(Number(reportValue.tcSum || 0) + Number(reportValue.zhSum || 0)) }}</span>
<span class="value value-highlight">{{ insuranceReimbursement }}</span>
</el-col>
</el-row>
</div>
@@ -174,7 +178,7 @@
</template>
<script setup name="DayEnd">
import { ref, reactive, toRefs, getCurrentInstance } from 'vue';
import { ref, reactive, toRefs, getCurrentInstance, computed } from 'vue';
import Decimal from 'decimal.js';
import { getTotal, getContractList, getRreportReturnIssue } from './component/api';
import useUserStore from '@/store/modules/user';
@@ -338,70 +342,111 @@ function formatValue(value) {
return value == null || value == undefined ? '0.00 元' : value.toFixed(2) + ' 元';
}
// 计算属性:费用总额
const totalFeeAmount = computed(() => {
const v = reportValue.value;
const sum =
Number(v.DIAGNOSTIC_FEE || 0) +
Number(v.CHECK_FEE || 0) +
Number(v.DIAGNOSTIC_TEST_FEE || 0) +
Number(v.MEDICAL_EXPENSE_FEE || 0) +
Number(v.WEST_MEDICINE || 0) +
Number(v.CHINESE_MEDICINE_SLICES_FEE || 0) +
Number(v.CHINESE_MEDICINE_FEE || 0) +
Number(v.GENERAL_CONSULTATION_FEE || 0) +
Number(v.REGISTRATION_FEE || 0) +
Number(v.OTHER_FEE || 0) +
Number(v.SANITARY_MATERIALS_FEE || 0);
return formatValue(sum);
});
// 计算属性:医保报销(统筹+账户)
const insuranceReimbursement = computed(() => {
const v = reportValue.value;
const sum = Number(v.tcSum || 0) + Number(v.zhSum || 0);
return formatValue(sum);
});
getList();
getPharmacyCabinetLists();
</script>
<style scoped>
.app-container {
padding: 16px;
}
.report-container {
width: 100%;
max-width: 1300px;
margin: 20px auto;
padding: 0 20px;
margin: 16px 0;
padding: 20px 24px;
background: #fff;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.report-title {
text-align: center;
font-size: 18px;
font-size: 20px;
font-weight: 600;
margin: 0 0 16px 0;
margin: 0 0 20px 0;
color: #303133;
padding: 12px 0;
}
.info-row {
margin: 20px 0;
padding: 0 10px;
margin-bottom: 16px;
display: flex;
flex-wrap: wrap;
gap: 12px 24px;
}
.info-row .el-col {
display: flex;
align-items: center;
margin-bottom: 0;
}
.data-row {
margin: 12px 0;
padding: 0 10px;
margin: 8px 0;
}
.data-row .el-col {
display: flex;
align-items: center;
margin-bottom: 4px;
}
.section-title {
font-size: 14px;
font-size: 15px;
font-weight: 600;
color: #409eff;
padding: 12px 0 8px;
margin: 16px 0 8px;
padding: 12px 0 8px 12px;
margin: 8px 0;
border-left: 3px solid #409eff;
padding-left: 8px;
background: linear-gradient(90deg, rgba(64, 158, 255, 0.05) 0%, transparent 100%);
}
.divider {
height: 2px;
background-color: #e4e7ed;
margin: 16px 0;
height: 1px;
background: linear-gradient(90deg, transparent, #e4e7ed 10%, #e4e7ed 90%, transparent);
margin: 12px 0;
}
.label {
display: inline-block;
min-width: 100px;
color: #606266;
font-size: 14px;
color: #909399;
font-size: 13px;
white-space: nowrap;
margin-right: 4px;
}
.value {
display: inline-block;
color: #303133;
font-size: 14px;
font-weight: 500;
}
.el-col {
margin-bottom: 8px;
/* 搜索表单区域样式优化 */
.el-form--inline .el-form-item {
margin-bottom: 12px;
}
</style>

View File

@@ -298,6 +298,7 @@ const { proxy } = getCurrentInstance();
const totalAmount = ref(0);
const purchaseinventoryListAll = ref([]);
const xiaojiTotal = ref([]);
const rowSpanMap = ref({});
const rowSpan = ref(1);
const issuerOptions = ref([]);
const payeeOptions = ref([]);
@@ -548,92 +549,91 @@ function handleTotalAmount() {
}, 0);
}
// 门诊号合并行处理
function getTotals(row, i) {
let totalPriceSums = Number(purchaseinventoryList.value[i].totalPrice);
for (let j = 1; i - j >= 0; j++) {
if (purchaseinventoryList.value[i].busNo == purchaseinventoryList.value[i - j].busNo) {
totalPriceSums += Number(purchaseinventoryList.value[i - j].totalPrice);
}
}
xiaojiTotal.value.push({
inde: i + 1,
busNo: row.busNo,
genderEnum_enumText: row.genderEnum_enumText,
totalPrice: totalPriceSums.toFixed(4) || 0.0,
});
purchaseinventoryList.value.splice(i + 1, 0, {
busNo: row.busNo,
genderEnum_enumText: row.genderEnum_enumText,
departmentName: '小计',
totalPrice: totalPriceSums.toFixed(4) || 0.0,
});
}
// 表格合并行方法
// 表格合并行方法(纯函数,不修改数据)
const arraySpanMethod = ({ row, column, rowIndex, columnIndex }) => {
if (columnIndex === 1 && purchaseinventoryList.value.length > 0) {
if (
rowIndex === 0 ||
(rowIndex > 0 && row.busNo !== purchaseinventoryList.value[rowIndex - 1]?.busNo)
) {
let rowspan = 1;
let totalPriceSum = 0;
for (let i = rowIndex + 1; i < purchaseinventoryList.value.length + 1; i++) {
if (purchaseinventoryList.value[i - 1].departmentName != '合计') {
if (
purchaseinventoryList.value[i] &&
purchaseinventoryList.value[i].busNo === row.busNo
) {
rowspan++;
totalPriceSum += Number(purchaseinventoryList.value[i].totalPrice);
if (i == purchaseinventoryList.value.length - 1) {
let findIndexTotal = xiaojiTotal.value.findIndex((k) => k.busNo == row.busNo);
if (findIndexTotal < 0) {
getTotals(row, i);
}
}
} else {
totalPriceSum += Number(row.totalPrice);
let findIndexTotal = xiaojiTotal.value.findIndex((k) => k.busNo == row.busNo);
if (findIndexTotal < 0) {
xiaojiTotal.value.push({
inde: i,
genderEnum_enumText: row.genderEnum_enumText,
busNo: row.busNo,
totalPrice: totalPriceSum,
});
purchaseinventoryList.value.splice(i, 0, {
busNo: row.busNo,
genderEnum_enumText: row.genderEnum_enumText,
departmentName: '小计',
totalPrice: totalPriceSum.toFixed(4) || 0.0,
});
}
break;
}
}
}
return { rowspan, colspan: 1 };
// 仅处理科室列columnIndex === 1的门诊号合并
if (columnIndex === 1) {
const spanInfo = rowSpanMap.value[rowIndex];
if (spanInfo) {
return { rowspan: spanInfo.rowspan, colspan: spanInfo.colspan || 1 };
} else {
return { rowspan: 0, colspan: 0 };
}
}
// 其他列不合并
return { rowspan: 1, colspan: 1 };
};
// 预处理列表数据:插入小计行、计算合并行信息
// 此函数替代了原来在 arraySpanMethod 中 splice 修改数据的做法
function processListWithSubtotals(list) {
rowSpanMap.value = {};
xiaojiTotal.value = [];
const result = [];
let i = 0;
while (i < list.length) {
const row = list[i];
// 跳过已有的合计行
if (row.departmentName === '合计') {
result.push(row);
i++;
continue;
}
const currentBusNo = row.busNo;
let rowspan = 0;
let totalPriceSum = 0;
let j = i;
// 计算相同门诊号的行数
while (j < list.length && list[j].busNo === currentBusNo && list[j].departmentName !== '合计') {
rowspan++;
totalPriceSum += Number(list[j].totalPrice) || 0;
j++;
}
// 设置第一行的 rowspan
const startRow = result.length;
rowSpanMap.value[startRow] = { rowspan, colspan: 1 };
// 添加数据行
for (let k = i; k < j; k++) {
result.push(list[k]);
}
// 添加小计行多于1行时才添加
if (rowspan > 1) {
const subtotalRow = {
...list[i],
departmentName: '小计',
totalPrice: totalPriceSum.toFixed(4),
};
// 小计行不合并
rowSpanMap.value[result.length] = { rowspan: 1, colspan: 1 };
result.push(subtotalRow);
xiaojiTotal.value.push({
inde: result.length,
busNo: currentBusNo,
genderEnum_enumText: list[i].genderEnum_enumText,
totalPrice: totalPriceSum.toFixed(4),
});
}
i = j;
}
return result;
}
// 统计类型变化处理
function inventoryChange(val) {
queryParams.value.statisticsType = val;
xiaojiTotal.value = [];
purchaseinventoryList.value = [];
rowSpanMap.value = {};
getList();
}