fix: CRUD 导出 excel 支持 children 节点 Closes #3563 (#8734)

This commit is contained in:
吴多益 2023-11-15 16:33:14 +08:00 committed by GitHub
parent c94522cc66
commit be6ec93ed5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 0 deletions

View File

@ -8,6 +8,46 @@ export default {
'*': '其他'
},
items: [
{
link: 'https://www.microsoft1.com/',
icon: __uri('../../static/ie.png'),
browser: 'Internet Explorer 4.2 2',
platform: 'Win 95+',
notExport: '1',
grade: 'A',
engine: {
name: 'Trident1',
version: '4/2'
},
date: '1591326307',
num: '12312334234234523',
children: [
{
link: 'https://www.microsoft2.com/',
engine: {
name: 'Trident2',
version: '4/2'
},
browser: 'Internet Explorer 4.0',
platform: 'Win 95+',
version: '4',
grade: 'X',
id: 1001
},
{
link: 'https://www.microsoft3.com/',
engine: {
name: 'Trident3',
version: '3/2'
},
browser: 'Internet Explorer 5.0',
platform: 'Win 95+',
version: '5',
grade: 'C',
id: 1002
}
]
},
{
link: 'https://www.microsoft.com/',
icon: __uri('../../static/ie.png'),

View File

@ -10,6 +10,7 @@ import {
getVariable,
removeHTMLTag,
decodeEntity,
flattenTree,
createObject
} from 'amis-core';
import {isPureVariable, resolveVariableAndFilter} from 'amis-core';
@ -325,6 +326,8 @@ export async function exportExcel(
}
// 前置总结行
rowIndex = renderSummary(worksheet, data, prefixRow, rowIndex);
// children 展开
rows = flattenTree(rows, item => item);
for (const row of rows) {
const rowData = createObject(data, row.data);
rowIndex += 1;