"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"), _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
    value: !0
}), exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")), _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")), _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")), _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")), _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")), _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")), _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")), _react = _interopRequireWildcard(require("react")), _propTypes = _interopRequireDefault(require("prop-types")), _GridButton = _interopRequireDefault(require("./../../common/btns/GridButton")), _amosAntd = require("amos-antd");

function _createSuper(e) {
    var t = _isNativeReflectConstruct();
    return function() {
        var r, n = (0, _getPrototypeOf2.default)(e);
        if (t) {
            var i = (0, _getPrototypeOf2.default)(this).constructor;
            r = Reflect.construct(n, arguments, i);
        } else r = n.apply(this, arguments);
        return (0, _possibleConstructorReturn2.default)(this, r);
    };
}

function _isNativeReflectConstruct() {
    if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
    if (Reflect.construct.sham) return !1;
    if ("function" == typeof Proxy) return !0;
    try {
        return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {}))), 
        !0;
    } catch (e) {
        return !1;
    }
}

var DelCompany = function(e) {
    (0, _inherits2.default)(r, e);
    var t = _createSuper(r);
    function r(e) {
        var n;
        return (0, _classCallCheck2.default)(this, r), n = t.call(this, e), (0, _defineProperty2.default)((0, 
        _assertThisInitialized2.default)(n), "onClick", (function() {
            var e = n.props.selectRows, t = n.handleDel;
            return e.length > 0 ? (_amosAntd.Modal.confirm({
                title: "批量删除",
                content: "是否删除所选信息？",
                okText: "确定",
                cancelText: "取消",
                onOk: function() {
                    t();
                },
                onCancel: function() {}
            }), null) : (_amosAntd.Modal.warning({
                title: "系统提示",
                content: "请先选中要删除的信息。",
                okText: "确定"
            }), null);
        })), (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(n), "handleDel", (function() {
            var e = n.props.selectRows, t = [];
            e.map((function(e) {
                t.push(e.id);
            })), n.props.companyDelAction(t);
        })), n;
    }
    return (0, _createClass2.default)(r, [ {
        key: "render",
        value: function() {
            var e = this.props.text;
            return _react.default.createElement("span", null, _react.default.createElement(_GridButton.default, {
                text: e,
                onClick: this.onClick,
                icon: "delete"
            }));
        }
    } ]), r;
}(_react.Component);

DelCompany.displayName = "DelCompany", DelCompany.propTypes = {
    text: _propTypes.default.string,
    selectRows: _propTypes.default.array,
    url: _propTypes.default.string,
    reload: _propTypes.default.func,
    companyDelAction: _propTypes.default.func
}, DelCompany.defaultProps = {
    text: "删除",
    selectRows: []
};

var _default = DelCompany;

exports.default = _default;