"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"), _urlConsts = require("../../../consts/urlConsts");

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

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;
    }
}

require("./onlineTest.scss");

var PerformanceTest = function(e) {
    (0, _inherits2.default)(r, e);
    var t = _createSuper(r);
    function r(e) {
        var a;
        (0, _classCallCheck2.default)(this, r), a = t.call(this, e), (0, _defineProperty2.default)((0, 
        _assertThisInitialized2.default)(a), "getViewForList", (function() {
            var e = [], t = a.state.quotaSelecteList;
            return t.length > 0 && t.map((function(t) {
                var r = t.value, a = t.datatype, l = t.minValue, n = t.maxValue;
                r && null !== r ? 1 !== a && 2 !== a || !(r < l || r > n) ? e.push(_react.default.createElement(_amosAntd.Row, null, _react.default.createElement("span", {
                    style: {
                        fontSize: "14px"
                    }
                }, t.displayName), _react.default.createElement("span", {
                    style: {
                        color: "red",
                        float: "right",
                        marginTop: "5px"
                    }
                }, t.value), _react.default.createElement("div", {
                    className: "divider-css"
                }))) : e.push(_react.default.createElement(_amosAntd.Row, null, _react.default.createElement("span", {
                    style: {
                        fontSize: "14px",
                        color: "red"
                    }
                }, t.displayName), _react.default.createElement("span", {
                    style: {
                        color: "red",
                        float: "right",
                        marginTop: "5px"
                    }
                }, t.value), _react.default.createElement("div", {
                    className: "divider-red"
                }))) : e.push(_react.default.createElement(_amosAntd.Row, null, _react.default.createElement("span", {
                    style: {
                        fontSize: "14px"
                    }
                }, t.displayName), _react.default.createElement("span", {
                    style: {
                        color: "red",
                        float: "right",
                        marginTop: "5px"
                    }
                }, "--"), _react.default.createElement("div", {
                    className: "divider-css"
                })));
            })), e;
        })), (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(a), "anErrorInfo", (function(e) {
            a.setState((0, _defineProperty2.default)({}, e, !a.state[e]));
        })), (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(a), "TodoTest", (function() {
            a.setState({
                percent: 0
            });
            a.props.saveEquipmnet({
                binaryImg: null,
                imgName: "default.png"
            }, "metric");
        })), (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(a), "export", (function() {
            var e = _urlConsts.OltSerUrl.exportData;
            window.location.href = encodeURI(encodeURI(e));
        }));
        var l = a.props.quotaList, n = a.props.quotaSelecteList, s = a.props.percent, i = a.props.exprotButton;
        return a.state = {
            quotaList: l,
            quotaSelecteList: n,
            percent: s,
            exprotButton: i
        }, a;
    }
    return (0, _createClass2.default)(r, [ {
        key: "componentWillReceiveProps",
        value: function(e) {
            this.setState({
                percent: e.percent
            }), 100 === e.percent ? this.setState({
                exprotButton: "inline"
            }) : this.setState({
                exprotButton: "none"
            });
        }
    }, {
        key: "render",
        value: function() {
            var e = "".concat(_urlConsts.OltSerUrl.exportData);
            return _react.default.createElement("div", null, _react.default.createElement("div", {
                className: "online-test-top"
            }, _react.default.createElement(_amosAntd.Row, null, _react.default.createElement(_amosAntd.Progress, {
                type: "circle",
                percent: this.state.percent,
                width: 175
            })), _react.default.createElement(_amosAntd.Row, {
                style: {
                    marginTop: "20px"
                }
            }, _react.default.createElement(_amosAntd.Button, {
                type: "primary",
                onClick: this.TodoTest
            }, "测试"), " ", _react.default.createElement("a", {
                href: e
            }, _react.default.createElement(_amosAntd.Button, {
                type: "primary",
                style: {
                    display: this.state.exprotButton
                }
            }, "导出测试报告")))), _react.default.createElement("div", {
                className: "online-test-bottom"
            }, _react.default.createElement("div", {
                className: "bottom-one"
            }, _react.default.createElement(_amosAntd.Row, null, _react.default.createElement("span", {
                style: {
                    fontSize: "20px",
                    fontWeight: "bold"
                }
            }, "数据采集")), _react.default.createElement("div", {
                className: "divider-css"
            }), _react.default.createElement(_amosAntd.Row, null, _react.default.createElement("span", {
                style: {
                    fontSize: "14px",
                    fontWeight: "bold"
                }
            }, "固定采集指标测试")), _react.default.createElement("div", {
                className: "divider-css"
            }), this.getViewForList())));
        }
    } ]), r;
}(_react.Component);

PerformanceTest.displayName = "PerformanceTest", PerformanceTest.propTypes = {
    quotaList: _propTypes.default.any,
    quotaSelecteList: _propTypes.default.any,
    saveEquipmnet: _propTypes.default.func,
    visible: _propTypes.default.any,
    percent: _propTypes.default.any
};

var _default = PerformanceTest;

exports.default = _default;