"use strict";
Object.defineProperty(exports, "__esModule", {
  value: !0
}), exports.default = void 0;
var _react = _interopRequireWildcard(require("react")),
  _propTypes = _interopRequireDefault(require("prop-types")),
  _amosAntd = require("amos-antd");

function _interopRequireDefault(e) {
  return e && e.__esModule ? e : {
    default: e
  }
}

function _getRequireWildcardCache() {
  if ("function" != typeof WeakMap) return null;
  var e = new WeakMap;
  return _getRequireWildcardCache = function() {
    return e
  }, e
}

function _interopRequireWildcard(e) {
  if (e && e.__esModule) return e;
  if (null === e || "object" !== _typeof(e) && "function" != typeof e) return {
    default: e
  };
  var t = _getRequireWildcardCache();
  if (t && t.has(e)) return t.get(e);
  var r, n, a = {},
    o = Object.defineProperty && Object.getOwnPropertyDescriptor;
  for (r in e) Object.prototype.hasOwnProperty.call(e, r) && ((n = o ? Object.getOwnPropertyDescriptor(e, r) : null) && (n.get || n.set) ? Object.defineProperty(a, r, n) : a[r] = e[r]);
  return a.default = e, t && t.set(e, a), a
}

function _typeof(e) {
  return (_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
    return typeof e
  } : function(e) {
    return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e
  })(e)
}

function _classCallCheck(e, t) {
  if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}

function _defineProperties(e, t) {
  for (var r = 0; r < t.length; r++) {
    var n = t[r];
    n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
  }
}

function _createClass(e, t, r) {
  return t && _defineProperties(e.prototype, t), r && _defineProperties(e, r), e
}

function _inherits(e, t) {
  if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
  e.prototype = Object.create(t && t.prototype, {
    constructor: {
      value: e,
      writable: !0,
      configurable: !0
    }
  }), t && _setPrototypeOf(e, t)
}

function _setPrototypeOf(e, t) {
  return (_setPrototypeOf = Object.setPrototypeOf || function(e, t) {
    return e.__proto__ = t, e
  })(e, t)
}

function _createSuper(r) {
  var n = _isNativeReflectConstruct();
  return function() {
    var e, t = _getPrototypeOf(r);
    return _possibleConstructorReturn(this, n ? (e = _getPrototypeOf(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments))
  }
}

function _possibleConstructorReturn(e, t) {
  return !t || "object" !== _typeof(t) && "function" != typeof t ? _assertThisInitialized(e) : t
}

function _assertThisInitialized(e) {
  if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  return e
}

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

function _getPrototypeOf(e) {
  return (_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function(e) {
    return e.__proto__ || Object.getPrototypeOf(e)
  })(e)
}

function _defineProperty(e, t, r) {
  return t in e ? Object.defineProperty(e, t, {
    value: r,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : e[t] = r, e
}
var BatchClearAlarm = function() {
  _inherits(n, _react.Component);
  var t = _createSuper(n);

  function n(e) {
    var r;
    return _classCallCheck(this, n), _defineProperty(_assertThisInitialized(r = t.call(this, e)), "onClick", function() {
      var e;
      "one" !== r.props.type && 0 === r.props.selectedRowKeys().length ? (e = _amosAntd.Modal.warning({
        title: "系统提示",
        content: "请选择数据！",
        okText: "确定"
      }), setTimeout(function() {
        return e.destroy()
      }, 2e3)) : r.setState({
        visible: !0
      })
    }), _defineProperty(_assertThisInitialized(r), "onChange", function(e) {
      r.setState({
        inputStr: e.target.value
      })
    }), _defineProperty(_assertThisInitialized(r), "handleCancel", function() {
      r.setState({
        visible: !1
      })
    }), _defineProperty(_assertThisInitialized(r), "handleSubmit", function() {
      r.handleCancel();
      var e = [];
      "one" === r.props.type ? e.push(r.props.alarmId) : e = r.props.selectedRowKeys();
      var t = r.state.inputStr;
      r.props.clearAlarm(t, e)
    }), r.state = {
      visible: !1,
      inputStr: "告警已处理！"
    }, r
  }
  return _createClass(n, [{
    key: "componentDidMount",
    value: function() {}
  }, {
    key: "render",
    value: function() {
      var e = this.state.inputStr;
      return _react.default.createElement("div", {
        className: "alarm-delete",
        title: "批量清除"
      }, _react.default.createElement("img", {
        src: require("./../../../assets/iot/alarm/delete.png"),
        onClick: this.onClick,
        alt: ""
      }), _react.default.createElement(_amosAntd.Modal, {
        width: 333,
        className: "clear-alarm-modal",
        title: "清除告警信息",
        visible: this.state.visible,
        footer: null,
        onCancel: this.handleCancel,
        maskClosable: !1,
        destroyOnClose: !0
      }, _react.default.createElement("div", null, _react.default.createElement(_amosAntd.Row, {
        style: {
          marginTop: "20px",
          textAlign: "center"
        }
      }, _react.default.createElement(_amosAntd.Col, {
        span: 24
      }, _react.default.createElement("span", {
        style: {
          "font-size": "13px"
        }
      }, "备注："), _react.default.createElement(_amosAntd.Input, {
        value: e,
        style: {
          width: "250px",
          "font-size": "13px"
        },
        onChange: this.onChange
      })))), _react.default.createElement(_amosAntd.Row, {
        style: {
          "padding-top": "30px"
        }
      }, _react.default.createElement(_amosAntd.Col, {
        className: "alarm-detail-clear",
        span: 4,
        offset: 6,
        onClick: this.handleSubmit
      }, "确定"), _react.default.createElement(_amosAntd.Col, {
        className: "alarm-detail-cancel",
        span: 4,
        offset: 2,
        onClick: this.handleCancel
      }, "取消"))))
    }
  }]), n
}();
BatchClearAlarm.displayName = "BatchClearAlarm", BatchClearAlarm.propTypes = {
  title: _propTypes.default.any,
  selectedRowKeys: _propTypes.default.func,
  clearAlarm: _propTypes.default.func,
  alarmId: _propTypes.default.string,
  type: _propTypes.default.string
}, BatchClearAlarm.defaultProps = {};
var _default = BatchClearAlarm;
exports.default = BatchClearAlarm, module.exports = exports.default;
