"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 a, r, n = {},
    l = Object.defineProperty && Object.getOwnPropertyDescriptor;
  for (a in e) Object.prototype.hasOwnProperty.call(e, a) && ((r = l ? Object.getOwnPropertyDescriptor(e, a) : null) && (r.get || r.set) ? Object.defineProperty(n, a, r) : n[a] = e[a]);
  return n.default = e, t && t.set(e, n), n
}

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 a = 0; a < t.length; a++) {
    var r = t[a];
    r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
  }
}

function _createClass(e, t, a) {
  return t && _defineProperties(e.prototype, t), a && _defineProperties(e, a), 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(a) {
  var r = _isNativeReflectConstruct();
  return function() {
    var e, t = _getPrototypeOf(a);
    return _possibleConstructorReturn(this, r ? (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, a) {
  return t in e ? Object.defineProperty(e, t, {
    value: a,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : e[t] = a, e
}
var createForm = _amosAntd.Form.create(),
  AlarmDetail = function() {
    _inherits(r, _react.Component);
    var a = _createSuper(r);

    function r(e) {
      var t;
      return _classCallCheck(this, r), _defineProperty(_assertThisInitialized(t = a.call(this, e)), "onClick", function() {
        t.setState({
          visible: !0
        })
      }), _defineProperty(_assertThisInitialized(t), "onSubClick", function() {
        t.setState({
          subVisible: !0
        })
      }), _defineProperty(_assertThisInitialized(t), "onChange", function(e) {
        t.setState({
          inputStr: e.target.value
        })
      }), _defineProperty(_assertThisInitialized(t), "handleCancel", function(e) {
        t.setState({
          visible: !1
        })
      }), _defineProperty(_assertThisInitialized(t), "handleSubCancel", function() {
        t.setState({
          subVisible: !1
        })
      }), _defineProperty(_assertThisInitialized(t), "handleSubmit", function() {
        t.handleSubCancel();
        var e = [];
        e.push(t.props.alarmInfo.id), t.props.clearAlarm(t.state.inputStr, e)
      }), t.state = {
        visible: !1,
        subVisible: !1,
        inputStr: "告警已处理！"
      }, t
    }
    return _createClass(r, [{
      key: "componentDidMount",
      value: function() {}
    }, {
      key: "render",
      value: function() {
        var e = this.props.alarmInfo,
          t = this.state.inputStr,
          a = e.name,
          r = e.level,
          n = e.status,
          l = e.type,
          o = e.durationDate,
          s = e.count,
          e = e.descr;
        return _react.default.createElement("div", {
          className: "alarm-detail-root"
        }, _react.default.createElement("label", {
          onClick: this.onClick
        }, "详情"), _react.default.createElement(_amosAntd.Modal, {
          className: "alarm-detail-modal",
          title: "告警详情",
          visible: this.state.visible,
          onCancel: this.handleCancel,
          footer: null,
          width: 700
        }, _react.default.createElement("div", {
          className: "alarm-detail-content"
        }, _react.default.createElement(_amosAntd.Row, null, _react.default.createElement(_amosAntd.Col, {
          className: "alarm-detail-source-name",
          span: 5
        }, "告警源:"), _react.default.createElement(_amosAntd.Col, {
          className: "alarm-detail-source-value",
          span: 19
        }, a)), _react.default.createElement(_amosAntd.Row, null, _react.default.createElement(_amosAntd.Col, {
          className: "alarm-detail-descr-name",
          span: 5
        }, "描述:"), _react.default.createElement(_amosAntd.Col, {
          title: e,
          className: "alarm-detail-descr-value",
          span: 19
        }, e)), _react.default.createElement(_amosAntd.Row, null, _react.default.createElement(_amosAntd.Col, {
          className: "alarm-detail-level-name",
          span: 5
        }, "告警级别:"), _react.default.createElement(_amosAntd.Col, {
          className: "alarm-detail-level-value",
          span: 19
        }, 1 === r ? "一级" : 2 === r ? "二级" : "三级")), _react.default.createElement(_amosAntd.Row, null, _react.default.createElement(_amosAntd.Col, {
          className: "alarm-detail-type-name",
          span: 5
        }, "告警类型:"), _react.default.createElement(_amosAntd.Col, {
          className: "alarm-detail-type-value",
          span: 19
        }, 1 === l ? "指标越界" : 2 === l ? "采集异常" : "设备掉线")), _react.default.createElement(_amosAntd.Row, null, _react.default.createElement(_amosAntd.Col, {
          className: "alarm-detail-status-name",
          span: 5
        }, "状态:"), _react.default.createElement(_amosAntd.Col, {
          className: "alarm-detail-status-value",
          span: 19
        }, 1 === n ? "未处理" : 2 === n ? "历史告警" : "已删除")), _react.default.createElement(_amosAntd.Row, null, _react.default.createElement(_amosAntd.Col, {
          className: "alarm-detail-duration-name",
          span: 5
        }, "持续时间:"), _react.default.createElement(_amosAntd.Col, {
          className: "alarm-detail-duration-value",
          span: 19
        }, o)), _react.default.createElement(_amosAntd.Row, null, _react.default.createElement(_amosAntd.Col, {
          className: "alarm-detail-count-name",
          span: 5
        }, "告警次数:"), _react.default.createElement(_amosAntd.Col, {
          className: "alarm-detail-count-value",
          span: 19
        }, s)), _react.default.createElement(_amosAntd.Row, {
          style: {
            "padding-top": "15px"
          }
        }, _react.default.createElement(_amosAntd.Col, {
          className: "alarm-detail-clear",
          span: 4,
          offset: 20,
          onClick: this.onSubClick
        }, "清除", _react.default.createElement(_amosAntd.Modal, {
          width: 333,
          className: "clear-alarm-modal",
          title: "清除告警信息",
          visible: this.state.subVisible,
          footer: null,
          onCancel: this.handleSubCancel,
          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: t,
          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.handleSubCancel
        }, "取消"))))))))
      }
    }]), r
  }();
AlarmDetail.displayName = "AlarmDetail", AlarmDetail.propTypes = {
  form: _propTypes.default.any,
  alarmInfo: _propTypes.default.any,
  clearAlarm: _propTypes.default.func
};
var _default = createForm(AlarmDetail);
exports.default = _default, module.exports = exports.default;
