mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 02:58:05 +08:00
chore: 导出 excel 多做一些类型判断兼容
This commit is contained in:
parent
abb615a00e
commit
6c4bab7b60
@ -152,7 +152,7 @@ export async function exportExcel(
|
||||
|
||||
const type = (column as BaseSchema).type || 'plain';
|
||||
// TODO: 这里很多组件都是拷贝对应渲染的逻辑实现的,导致
|
||||
if (type === 'image' && value) {
|
||||
if ((type === 'image' || (type as any) === 'static-image') && value) {
|
||||
try {
|
||||
const imageData = await toDataURL(value);
|
||||
const imageDimensions = await getImageDimensions(imageData);
|
||||
@ -200,7 +200,7 @@ export async function exportExcel(
|
||||
} catch (e) {
|
||||
console.warn(e.stack);
|
||||
}
|
||||
} else if (type == 'link') {
|
||||
} else if (type == 'link' || (type as any) === 'static-link') {
|
||||
const href = column.pristine.href;
|
||||
const linkURL =
|
||||
(typeof href === 'string' && href
|
||||
@ -218,7 +218,7 @@ export async function exportExcel(
|
||||
text: text || absoluteURL,
|
||||
hyperlink: absoluteURL
|
||||
};
|
||||
} else if (type === 'mapping') {
|
||||
} else if (type === 'mapping' || (type as any) === 'static-mapping') {
|
||||
// 拷贝自 Mapping.tsx
|
||||
let map = column.pristine.map;
|
||||
const source = column.pristine.source;
|
||||
@ -256,7 +256,7 @@ export async function exportExcel(
|
||||
} else {
|
||||
sheetRow.getCell(columIndex).value = removeHTMLTag(value);
|
||||
}
|
||||
} else if (type === 'date') {
|
||||
} else if (type === 'date' || (type as any) === 'static-date') {
|
||||
let viewValue;
|
||||
const {
|
||||
fromNow,
|
||||
|
Loading…
Reference in New Issue
Block a user