• 通用导入组件

    01. 说明

    02. API

    参数是放在search中

    参数 说明 类型 默认值 必输 版本
    prefixPath 导入接口前缀 string 无 是 v1.0
    tenantId 租户id number 当前租户id 否 v1.0
    backPath 作为子路由时的backPath string 无 否 v1.0
    sync 是否同步导入 boolean false 否 v1.0
    auto 是否自动导入 boolean false 否 v1.0
    args 与当前批次号绑定的参数 string(需要使用JSON.stringify格式化) ‘null’ 否 v1.0
    autoRefreshInterval 自动刷新的间隔 number(ms) 5000 否 v1.0
    action 标题 string Header的标题 否 v1.0

    03. 使用示例

    v1.0.0

        // 按照新页面配置路由,
        // path中必须包含 :code 占位路由
        // component 指向 当前模块下的 src/routes/himp/CommentImport
        // authorized: true, 如果配置子路由, 则为false, 且必须符合子路由规范
        module.exports = [
            {
                path: '/hiam/comment-import/:code',
                component: '/himp/CommentImport',
                authorized: true,
            }
        ];
    
    // 当前模块/src/routes/himp/CommentImport.js
    // 先从 himp 模块引进 CommentImport
    // 再将 CommentImport 默认导出
    import CommentImport from 'hzero-front-himp/lib/routes/CommentImport';
    
    export default CommentImport;
    
    import React from 'react';
    import { Button } from 'hzero-ui';
    import { Bind } from 'lodash-decorators';
    import queryString from 'query-string';
    
    import { Header, Content } from 'components/Page';
    
    import { openTab } from 'utils/menuTab';
    import { HZERO_IAM } from 'utils/config';
    
    export class Demo extends React.Component {
    
        @Bind()
        handleBatchExport() {
            openTab({
                // 编码是后端给出的
                key: `/hiam/comment-import/HIAM.ACCOUNT_CREATE`,
                // MenuTab 的国际化必须使用 hzero.common 开头(或者其他公用多语言)
                title: 'hzero.common.title.subAccountImport',
                search: queryString.stringify({
                    // 如果是客户端导入, 那么一般是该模块的接口前缀,
                    prefixPath: HZERO_IAM,
                    action: intl.get('hiam.subAccount.view.button.subAccountImport').d('账户导入'),
                }),
            });
        }
    
        render(){
            <React.Fragment>
                <Header>
                    <Button 
                        onClick={this.handleBatchExport}
                    >
                        {intl.get('hiam.subAccount.view.button.subAccountImport').d('账户导入')}
                    </Button>
                </Header>
                <Content/>
            </React.Fragment>
        }
    }