"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), "handleCancel", function(e) {
        t.setState({
          visible: !1
        })
      }), t.state = {
        visible: !1
      }, t
    }
    return _createClass(r, [{
      key: "render",
      value: function() {
        var e = this.props,
          t = e.alarmInfo,
          a = e.clearAlarm,
          r = t.name,
          n = t.level,
          l = t.status,
          o = t.type,
          c = t.durationDate,
          e = t.count,
          t = t.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
        }, r)), _react.default.createElement(_amosAntd.Row, null, _react.default.createElement(_amosAntd.Col, {
          className: "alarm-detail-descr-name",
          span: 5
        }, "描述:"), _react.default.createElement(_amosAntd.Col, {
          title: t,
          className: "alarm-detail-descr-value",
          span: 19
        }, t)), _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 === n ? "一级" : 2 === n ? "二级" : "三级")), _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 === o ? "指标越界" : 2 === o ? "采集异常" : "设备掉线")), _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 === l ? "未处理" : 2 === l ? "历史告警" : "已删除")), _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
        }, c)), _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
        }, e)), _react.default.createElement(_amosAntd.Row, {
          style: {
            "padding-top": "15px"
          }
        }, _react.default.createElement(_amosAntd.Col, {
          className: "alarm-detail-clear",
          span: 4,
          offset: 20,
          onClick: a
        }, "删除")))))
      }
    }]), 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;
