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

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

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)(t, e);
    var a = _createSuper(t);
    function t(e) {
        var l;
        return (0, _classCallCheck2.default)(this, t), l = a.call(this, e), (0, _defineProperty2.default)((0, 
        _assertThisInitialized2.default)(l), "onClick", (function() {
            l.setState({
                visible: !0
            });
        })), (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(l), "handleCancel", (function(e) {
            l.setState({
                visible: !1
            });
        })), l.state = {
            visible: !1
        }, l;
    }
    return (0, _createClass2.default)(t, [ {
        key: "render",
        value: function() {
            var e = this.props, a = e.alarmInfo, t = e.clearAlarm, l = a.name, r = a.level, n = a.status, s = a.type, i = a.durationDate, u = a.count, o = a.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
            }, l)), _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 === 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 === 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
            }, i)), _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
            }, u)), _react.default.createElement(_amosAntd.Row, {
                style: {
                    "padding-top": "15px"
                }
            }, _react.default.createElement(_amosAntd.Col, {
                className: "alarm-detail-clear",
                span: 4,
                offset: 20,
                onClick: t
            }, "删除")))));
        }
    } ]), t;
}(_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;