mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 10:59:42 +08:00
修复 Excel 导出不支持嵌套 name 和 tpl 问题 (#1424)
This commit is contained in:
parent
9b273c0655
commit
98667870fb
@ -9,100 +9,121 @@ export default {
|
||||
{
|
||||
link: 'https://www.microsoft.com/',
|
||||
icon: __uri('../../static/ie.png'),
|
||||
engine: 'Trident',
|
||||
browser: 'Internet Explorer 4.2',
|
||||
platform: 'Win 95+',
|
||||
version: '4',
|
||||
notExport: '1',
|
||||
grade: 'A'
|
||||
grade: 'A',
|
||||
engine: {
|
||||
name: 'Trident',
|
||||
version: '4'
|
||||
}
|
||||
},
|
||||
{
|
||||
link: 'https://www.microsoft.com/',
|
||||
icon: __uri('../../static/ie.png'),
|
||||
engine: 'Trident',
|
||||
browser: 'Internet Explorer 4.2',
|
||||
platform: 'Win 95+',
|
||||
version: '4',
|
||||
|
||||
engine: {
|
||||
name: 'Trident',
|
||||
version: '4'
|
||||
},
|
||||
notExport: '1',
|
||||
grade: 'B'
|
||||
},
|
||||
{
|
||||
link: 'https://www.microsoft.com/',
|
||||
icon: __uri('../../static/ie.png'),
|
||||
engine: 'Trident',
|
||||
browser: 'AOL browser (AOL desktop)',
|
||||
platform: 'Win 95+',
|
||||
version: '4',
|
||||
engine: {
|
||||
name: 'Trident',
|
||||
version: '4'
|
||||
},
|
||||
notExport: '1',
|
||||
grade: 'C'
|
||||
},
|
||||
{
|
||||
link: 'https://www.microsoft.com/',
|
||||
icon: __uri('../../static/ie.png'),
|
||||
engine: 'Trident',
|
||||
engine: {
|
||||
name: 'Trident',
|
||||
version: '3'
|
||||
},
|
||||
browser: 'AOL browser (AOL desktop)',
|
||||
platform: 'Win 98',
|
||||
version: '3',
|
||||
notExport: '1',
|
||||
grade: 'A'
|
||||
},
|
||||
{
|
||||
link: 'https://www.microsoft.com/',
|
||||
icon: __uri('../../static/ie.png'),
|
||||
engine: 'Trident',
|
||||
engine: {
|
||||
name: 'Trident',
|
||||
version: '4'
|
||||
},
|
||||
browser: 'AOL browser (AOL desktop)',
|
||||
platform: 'Win 98',
|
||||
version: '4',
|
||||
notExport: '1',
|
||||
grade: 'A'
|
||||
},
|
||||
{
|
||||
icon: __uri('../../static/firefox.png'),
|
||||
link: 'https://www.mozilla.org/',
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 1.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '4',
|
||||
engine: {
|
||||
name: 'Gecko',
|
||||
version: '4'
|
||||
},
|
||||
notExport: '1',
|
||||
grade: 'A'
|
||||
},
|
||||
{
|
||||
icon: __uri('../../static/firefox.png'),
|
||||
link: 'https://www.mozilla.org/',
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 1.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
engine: {
|
||||
name: 'Gecko',
|
||||
version: '5'
|
||||
},
|
||||
notExport: '1',
|
||||
grade: 'A'
|
||||
},
|
||||
{
|
||||
icon: __uri('../../static/firefox.png'),
|
||||
link: 'https://www.mozilla.org/',
|
||||
engine: 'Gecko',
|
||||
engine: {
|
||||
name: 'Gecko',
|
||||
version: '5'
|
||||
},
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
notExport: '1',
|
||||
grade: 'B'
|
||||
},
|
||||
{
|
||||
icon: __uri('../../static/firefox.png'),
|
||||
link: 'https://www.mozilla.org/',
|
||||
engine: 'Gecko',
|
||||
engine: {
|
||||
name: 'Gecko',
|
||||
version: '5'
|
||||
},
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
notExport: '1',
|
||||
grade: 'C'
|
||||
},
|
||||
{
|
||||
icon: __uri('../../static/firefox.png'),
|
||||
link: 'https://www.mozilla.org/',
|
||||
engine: 'Gecko',
|
||||
engine: {
|
||||
name: 'Gecko',
|
||||
version: '5'
|
||||
},
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
notExport: '1',
|
||||
grade: 'D'
|
||||
}
|
||||
@ -121,7 +142,7 @@ export default {
|
||||
type: 'link'
|
||||
},
|
||||
{
|
||||
name: 'engine',
|
||||
name: 'engine.name',
|
||||
label: '引擎'
|
||||
},
|
||||
{
|
||||
@ -133,8 +154,9 @@ export default {
|
||||
label: '操作系统'
|
||||
},
|
||||
{
|
||||
name: 'version',
|
||||
label: '引擎版本'
|
||||
name: 'engine.version',
|
||||
label: 'CSS版本',
|
||||
tpl: '${engine.version}'
|
||||
},
|
||||
{
|
||||
name: 'grade',
|
||||
|
@ -14,7 +14,8 @@ import {
|
||||
difference,
|
||||
noop,
|
||||
autobind,
|
||||
isArrayChildrenModified
|
||||
isArrayChildrenModified,
|
||||
getVariable
|
||||
} from '../../utils/helper';
|
||||
import {resolveVariable} from '../../utils/tpl-builtin';
|
||||
import debounce from 'lodash/debounce';
|
||||
@ -1588,6 +1589,7 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
render,
|
||||
data,
|
||||
translate,
|
||||
locale,
|
||||
checkOnItemClick,
|
||||
buildItemProps,
|
||||
rowClassNameExpr,
|
||||
@ -1653,6 +1655,7 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
rowClassName={rowClassName}
|
||||
columns={columns}
|
||||
rows={rows}
|
||||
locale={locale}
|
||||
translate={translate}
|
||||
rowsProps={{
|
||||
regionPrefix: 'fixed/',
|
||||
@ -1820,7 +1823,8 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
let columIndex = 0;
|
||||
for (const key of firstRowKeys) {
|
||||
columIndex += 1;
|
||||
if (!(key in row.data)) {
|
||||
const value = getVariable(row.data, key);
|
||||
if (typeof value === 'undefined' && !columnNameMap[key].tpl) {
|
||||
continue;
|
||||
}
|
||||
// 处理合并单元格
|
||||
@ -1837,7 +1841,7 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
);
|
||||
}
|
||||
}
|
||||
const value = row.data[key];
|
||||
|
||||
const type = columnNameMap[key].type || 'plain';
|
||||
if (type === 'image') {
|
||||
const imageData = await toDataURL(value);
|
||||
@ -1913,7 +1917,14 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
sheetRow.getCell(columIndex).value = value;
|
||||
}
|
||||
} else {
|
||||
sheetRow.getCell(columIndex).value = value;
|
||||
if (columnNameMap[key].tpl) {
|
||||
sheetRow.getCell(columIndex).value = filter(
|
||||
columnNameMap[key].tpl,
|
||||
row.data
|
||||
);
|
||||
} else {
|
||||
sheetRow.getCell(columIndex).value = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user