@aliretail/react-materials-components
Version:
91 lines (84 loc) • 4.24 kB
Markdown
---
title: DataImport-API
order: 4
category: UI
description: DataImport 组件描述
screenshot: https://gw.alicdn.com/imgextra/i2/O1CN01yW3hCD1M8CnqeKFlq_!!6000000001389-2-tps-90-90.png
---
导入数据按钮
## API
### props
```ts
interface BigExcelImportProps {
className?: string;
appCode: string;
service: string;
parameters?: any;
importHint?: any;
fileType?: string;
btnText?: string;
subTitle?: string;
isComplex?: boolean;
notifyService?: any;
onImportError?: (result: any) => void;
onImportSuccess?: (result: any) => void;
}
```
| 参数名 | 说明 | 必填 | 类型 | 默认值 | 备注 |
| ------------------ | -------------------- | ---- | ---------------------------------- | -------------------------------------------------- | ----------------------------- |
| className | 类名称 | N | string | undefined | |
| appCode | 应用编码 | Y | string | undefined | |
| service | 导入服务名称 | Y | string | undefined | |
| parameters | 附加参数 | N | Object | undefined | 会在调用 导入服务时附加的参数 |
| historyInputQuery | 历史记录查询附加参数 | N | Array<{field: string, value: any}> | undefined | 会在查询历史记录时附加的参数 |
| importHint | 弹窗顶部提示文案 | N | string | '请根据模板内容编辑后再上传,重复数据将进行覆盖。' | |
| fileType | 支持的文件类型 | N | string | .xlsx | |
| btnText | 按钮文案 | N | string | '导入' | |
| subTitle | 弹窗顶部副标题 | N | string | undefined | |
| isComplex | 是否二次提交 | N | boolean | false | 仅影响展示 |
| onImportError | 导入错误回调 | N | (result)=> void | undefined | |
| onImportSuccess | 导入成功回调 | N | (result)=> void | undefined | |
回调函数 result 参数示例:
```
{
"gmtModified": "2020-12-04 16:20:09",
"creator": "CZ_1",
"successNum": 21328,
"finished": 100,
"tenantCode": "master_daily",
"appCode": "omsdemo",
"gmtCreate": "2020-12-04 16:20:09",
"updater": "CZ_1",
"output": {
"successNum": 21328,
"totalNum": 21331,
"elapsedTime": 1518640926
},
"input": { "parameters": {} },
"inputFile": [
{
"path": "/excel/import/2020/12/04/8d23e393bc7642dd80abbeb3f896976c/",
"creator": "0",
"size": 340483,
"gmtCreated": 1607070007000,
"name": "test.xlsx"
}
],
"outputFile": [
{
"path": "/excel/importresult/2020/12/04/c83feed5aae741ce96212d34b36169c2/",
"creator": "CZ_1",
"size": 6864,
"gmtCreated": 1607070011280,
"name": "import_excel_result.xlsx"
}
],
"flowCode": "import_excel",
"totalNum": 21331,
"success": "partialSuccess",
"name": "import_excel",
"_id": "fdb22ef5-1dd7-4e5b-9dd7-431f86b04835",
"jobType": "excel_import",
"gmtFinished": "2020-12-04 16:20:11"
}
```