fix : 分摊详情小计与导出

This commit is contained in:
2024-06-22 18:45:40 +08:00
parent 3f32683d69
commit 5c60bf91e4
3 changed files with 103 additions and 117 deletions

View File

@@ -7,8 +7,9 @@ import XLSX from "xlsx-style-vite";
* @param $table 表格html dom元素
* @param columnLength 列长度
* @param excelName 导出文件名称
* @param bigWidthIndex 更宽列的索引
*/
export function exportExcel($table, columnLength, excelName,bigWidth) {
export function exportExcel($table, columnLength, excelName, bigWidthIndex) {
//从el-table表生成工作簿对象
//使用原始的格式,保留表格中的格式如%、小数末尾的0等
let workbook = utils.table_to_book($table, {
@@ -16,7 +17,7 @@ export function exportExcel($table, columnLength, excelName,bigWidth) {
});
//列宽需要导出的表格有多少列这里的i就小于多少
for (let i = 1; i < columnLength; i++) {
if(i==bigWidth){
if (i === bigWidthIndex) {
workbook.Sheets.Sheet1["!cols"].push({wpx: 300});
}
workbook.Sheets.Sheet1["!cols"].push({wpx: 100});