修改报表格式

This commit is contained in:
2025-11-04 16:10:16 +08:00
parent e5edb6bda2
commit b5d4da97f9
2 changed files with 172 additions and 14 deletions

View File

@@ -164,12 +164,15 @@
:data="purchaseinventoryList"
@selection-change="handleSelectionChange"
:span-method="arraySpanMethod"
border
fit
:default-sort="{ prop: 'chargeTime', order: 'descending' }"
@header-click="handleHeaderClick"
>
<!-- :span-method="arraySpanMethod" -->
<!-- :summary-method="getSummaries"
show-summary 每页单独合计-->
<el-table-column type="selection" width="50px" align="center" />
<el-table-column type="selection" width="50px" align="center" resizable />
<el-table-column
label='门诊号'
align="center"
@@ -177,14 +180,16 @@
prop="busNo"
width="110px"
:show-overflow-tooltip="true"
resizable
/>
<el-table-column
label="科室"
align="center"
key="departmentName"
prop="departmentName"
min-width="120px"
:show-overflow-tooltip="true"
resizable
/>
<el-table-column
label="姓名"
@@ -193,6 +198,7 @@
prop="name"
width="90px"
:show-overflow-tooltip="true"
resizable
/>
<el-table-column
label="医保号"
@@ -201,6 +207,7 @@
prop="ybCode"
width="190px"
:show-overflow-tooltip="true"
resizable
/>
<el-table-column
@@ -208,8 +215,9 @@
align="center"
key="clinicalName"
prop="clinicalName"
min-width="150px"
:show-overflow-tooltip="true"
resizable
/>
<el-table-column
label="医保码"
@@ -218,14 +226,16 @@
prop="ybNo"
width="220px"
:show-overflow-tooltip="true"
resizable
/>
<el-table-column
label="医保类别"
align="center"
key="type_dictText"
prop="type_dictText"
min-width="100px"
:show-overflow-tooltip="true"
resizable
/>
<el-table-column
@@ -233,8 +243,9 @@
align="center"
key="issuerName"
prop="issuerName"
min-width="100px"
:show-overflow-tooltip="true"
resizable
/>
<el-table-column
@@ -242,8 +253,9 @@
align="center"
key="payeeName"
prop="payeeName"
min-width="100px"
:show-overflow-tooltip="true"
resizable
/>
<el-table-column
label="规格"
@@ -252,46 +264,52 @@
prop="totalVolume"
width="135px"
:show-overflow-tooltip="true"
resizable
/>
<el-table-column
label="数量"
align="center"
key="number"
prop="number"
min-width="80px"
:show-overflow-tooltip="true"
resizable
/>
<el-table-column
label="单价"
align="center"
key="price"
prop="price"
min-width="100px"
:show-overflow-tooltip="true"
resizable
/>
<el-table-column
label="金额"
align="center"
key="totalPrice"
prop="totalPrice"
min-width="100px"
:show-overflow-tooltip="true"
resizable
/>
<el-table-column
label="医保等级"
align="center"
key="chrgitmLv_enumText"
prop="chrgitmLv_enumText"
min-width="100px"
:show-overflow-tooltip="true"
resizable
/>
<el-table-column
label="收费时间"
align="center"
key="chargeTime"
prop="chargeTime"
min-width="160px"
:show-overflow-tooltip="true"
resizable
>
<template #default="scope">
<span>{{ parseTime(scope.row.chargeTime) }}</span>
@@ -697,6 +715,41 @@ function handleSelectionChange(selection) {
multiple.value = !selection.length;
}
// 表头点击事件,用于实现更灵活的列操作
function handleHeaderClick(column) {
// 可以在这里添加额外的表头操作逻辑
// 例如:根据列内容自动调整宽度
if (column.property) {
autoFitColumnWidth(column.property);
}
}
// 根据内容自动调整列宽
function autoFitColumnWidth(property) {
// 实际项目中可以根据需要实现更复杂的自动宽度计算逻辑
// 这里提供一个简单的实现方式
const table = document.querySelector('.el-table__body-wrapper table');
if (table) {
const rows = table.querySelectorAll('tbody tr');
let maxWidth = 100; // 默认最小宽度
rows.forEach(row => {
const cell = Array.from(row.cells).find((cell, index) => {
const headerCell = table.querySelector(`thead th:nth-child(${index + 1})`);
return headerCell && headerCell.dataset.property === property;
});
if (cell) {
const textWidth = cell.textContent.length * 8; // 粗略估算文本宽度
maxWidth = Math.max(maxWidth, textWidth);
}
});
// 应用计算出的宽度(可以根据实际需要调整)
// 注意在实际Element Plus中可能需要通过ref获取表格实例并调用API来设置列宽
}
}
getList();
getPharmacyCabinetLists()