"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"), _typeof = require("@babel/runtime/helpers/typeof");

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")), _amosAntd = require("amos-antd");

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

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

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

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 createForm = _amosAntd.Form.create(), AlarmDetail = function(e) {
  (0, _inherits2.default)(a, e);
  var t = _createSuper(a);
  function a(e) {
    var r;
    return (0, _classCallCheck2.default)(this, a), r = t.call(this, e), (0, _defineProperty2.default)((0, 
    _assertThisInitialized2.default)(r), "onClick", (function() {
      r.setState({
        visible: !0
      });
    })), (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(r), "handleCancel", (function(e) {
      r.setState({
        visible: !1
      });
    })), r.state = {
      visible: !1
    }, r;
  }
  return (0, _createClass2.default)(a, [ {
    key: "render",
    value: function() {
      var e = this.props, t = e.alarmInfo, a = e.clearAlarm, r = t.name, l = t.level, n = t.status, s = t.type, u = t.durationDate, i = t.count, o = 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: o,
        className: "alarm-detail-descr-value",
        span: 19
      }, o)), _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 === l ? "一级" : 2 === l ? "二级" : "三级")), _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 === s ? "指标越界" : 2 === s ? "采集异常" : "设备掉线")), _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
      }, u)), _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
      }, i)), _react.default.createElement(_amosAntd.Row, {
        style: {
          "padding-top": "15px"
        }
      }, _react.default.createElement(_amosAntd.Col, {
        className: "alarm-detail-clear",
        span: 4,
        offset: 20,
        onClick: a
      }, "删除")))));
    }
  } ]), a;
}(_react.Component);

AlarmDetail.displayName = "AlarmDetail", AlarmDetail.propTypes = {
  form: _propTypes.default.any,
  alarmInfo: _propTypes.default.any,
  clearAlarm: _propTypes.default.func
};

var _default = createForm(AlarmDetail);

exports.default = _default;