zmdms-webui 2.9.1 → 2.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/table/excel.js +15 -4
- package/package.json +1 -1
package/dist/es/table/excel.js
CHANGED
|
@@ -410,8 +410,15 @@ function createWorksheetWithMerge(workbook, excelData, mergeKeys, sheetName) {
|
|
|
410
410
|
if (mergeKeys && mergeKeys.length > 0) {
|
|
411
411
|
var _loop_1 = function (colIndex) {
|
|
412
412
|
var mergeKey = mergeKeys[colIndex];
|
|
413
|
-
|
|
414
|
-
|
|
413
|
+
// 找到所有使用这个 mergeKey 的列(column.mergeKey === mergeKey 或 column.dataIndex/key === mergeKey)
|
|
414
|
+
var matchedColIndexes = leafColumns
|
|
415
|
+
.map(function (item, index) { return ({
|
|
416
|
+
index: index,
|
|
417
|
+
itemMergeKey: item.mergeKey || item.dataIndex || item.key,
|
|
418
|
+
}); })
|
|
419
|
+
.filter(function (item) { return item.itemMergeKey === mergeKey; })
|
|
420
|
+
.map(function (item) { return item.index; });
|
|
421
|
+
if (matchedColIndexes.length === 0)
|
|
415
422
|
return "continue";
|
|
416
423
|
for (var rowIndex = 0; rowIndex < data.length; rowIndex++) {
|
|
417
424
|
var rowData = data[rowIndex];
|
|
@@ -422,8 +429,12 @@ function createWorksheetWithMerge(workbook, excelData, mergeKeys, sheetName) {
|
|
|
422
429
|
if (spanCount && spanCount > 1) {
|
|
423
430
|
var startRow = headerRowCount + rowIndex + 1;
|
|
424
431
|
var endRow = headerRowCount + rowIndex + spanCount;
|
|
425
|
-
|
|
426
|
-
|
|
432
|
+
// 对所有匹配的列都执行合并
|
|
433
|
+
for (var _b = 0, matchedColIndexes_1 = matchedColIndexes; _b < matchedColIndexes_1.length; _b++) {
|
|
434
|
+
var excelColIndex = matchedColIndexes_1[_b];
|
|
435
|
+
var col = excelColIndex + 1;
|
|
436
|
+
worksheet.mergeCells(startRow, col, endRow, col);
|
|
437
|
+
}
|
|
427
438
|
}
|
|
428
439
|
}
|
|
429
440
|
};
|