function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import React from 'react';
import { Button, message } from 'antd';
import Upload from "../upload";
import "./index.less";
function BaseUpload(_ref) {
  var text = _ref.text,
    buttonProps = _ref.buttonProps,
    request = _ref.request,
    _onSuccess = _ref.onSuccess,
    _onError = _ref.onError;
  var props = {
    request: request,
    onError: function onError(errorMsg) {
      var msg = errorMsg || '导入数据失败！';
      message.warning(msg);
      _onError && _onError(new Error(msg));
    },
    onSuccess: function onSuccess() {
      // 导入输入成功有两个提示文案，故将此注释掉--谢小平 不确定是否有影响其他业务
      // message.success('导入数据成功！');
      _onSuccess && _onSuccess(null);
    }
  };
  return /*#__PURE__*/React.createElement(Upload, _extends({
    className: "upload-container"
  }, props), /*#__PURE__*/React.createElement(Button, buttonProps, text));
}
export default BaseUpload;