"use strict";
Object.defineProperty(exports, "__esModule", {
  value: !0
}), exports.default = void 0;
var _react = _interopRequireWildcard(require("react")),
  _propTypes = _interopRequireDefault(require("prop-types")),
  _amosFramework = require("amos-framework"),
  _urlConsts = _interopRequireDefault(require("../../../consts/urlConsts")),
  _UpLoadIcon = _interopRequireDefault(require("./upload/UpLoadIcon")),
  _DeviceEnum = require("./../../deviceManage/common/DeviceEnum"),
  _DeviceLang = require("./../../deviceManage/common/DeviceLang");

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 r, a, n = {},
    o = Object.defineProperty && Object.getOwnPropertyDescriptor;
  for (r in e) Object.prototype.hasOwnProperty.call(e, r) && ((a = o ? Object.getOwnPropertyDescriptor(e, r) : null) && (a.get || a.set) ? Object.defineProperty(n, r, a) : n[r] = e[r]);
  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 r = 0; r < t.length; r++) {
    var a = t[r];
    a.enumerable = a.enumerable || !1, a.configurable = !0, "value" in a && (a.writable = !0), Object.defineProperty(e, a.key, a)
  }
}

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

    function o(e) {
      var n;
      _classCallCheck(this, o), _defineProperty(_assertThisInitialized(n = a.call(this, e)), "onAttributeChange", function(e, t) {
        var r = n.state.deviceBasicParam,
          a = n.props.updateBasicInfo;
        r[e] = t.target.value, a(r), n.setState({
          deviceBasicParam: r
        })
      });
      var t = n.props,
        r = t.updateBasicInfo,
        e = t.equipment,
        t = t.device,
        t = {
          name: e ? e.name : "",
          descr: e ? e.descr : "",
          type: e ? e.type : "",
          eqpTmplId: t.id
        };
      return r(t), n.state = {
        deviceBasicParam: t
      }, n
    }
    return _createClass(o, [{
      key: "componentWillMount",
      value: function() {}
    }, {
      key: "componentDidMount",
      value: function() {}
    }, {
      key: "componentWillReceiveProps",
      value: function() {}
    }, {
      key: "componentWillUnmount",
      value: function() {}
    }, {
      key: "render",
      value: function() {
        var t = this,
          e = this.props,
          r = e.device,
          a = (e.setImgFile, e.equipment, e.enable),
          n = this.state.deviceBasicParam,
          e = "".concat(_urlConsts.default.fetchDeviceImg, "/").concat(r.img);
        return _react.default.createElement("div", {
          className: "add-device-left-basic"
        }, _react.default.createElement("div", {
          className: "template-basic-info-title"
        }, "设备信息"), _react.default.createElement("div", {
          className: "template-basic-icon"
        }, _react.default.createElement("img", {
          src: e,
          alt: "",
          style: {
            maxWidth: "159px",
            maxHeight: "81px",
            paddingTop: "14px"
          }
        })), _react.default.createElement("div", {
          className: "template-basic-name"
        }, _react.default.createElement("div", {
          className: "ant-form-item-required property-label-name"
        }, "设备名称："), a ? _react.default.createElement(_amosFramework.Input, {
          value: n.name,
          onChange: function(e) {
            return t.onAttributeChange("name", e)
          },
          style: {
            width: "150px",
            marginLeft: "10px"
          },
          placeholder: "请输入"
        }) : _react.default.createElement("div", {
          className: "property-normal-label",
          title: n.name
        }, n.name)), _react.default.createElement("div", {
          className: "template-type-name"
        }, _react.default.createElement("div", {
          className: "property-label-name"
        }, "设备类型："), _react.default.createElement("div", {
          className: "property-normal-label",
          title: r.name
        }, r.name)), _react.default.createElement("div", {
          className: "template-basic-model"
        }, _react.default.createElement("div", {
          className: "property-label-name"
        }, "型号："), _react.default.createElement("div", {
          className: "property-normal-label",
          title: r.model
        }, r.model)), _react.default.createElement("div", {
          className: "template-basic-catalog"
        }, _react.default.createElement("div", {
          className: "property-label-name"
        }, "设备类别："), _react.default.createElement("div", {
          className: "property-normal-label",
          title: (0, _DeviceLang.stringUtil)(_DeviceEnum.deviceCategoryEnum, r.type)
        }, (0, _DeviceLang.stringUtil)(_DeviceEnum.deviceCategoryEnum, r.type))), _react.default.createElement("div", {
          className: "template-basic-industry"
        }, _react.default.createElement("div", {
          className: "property-label-name"
        }, "所属行业："), _react.default.createElement("div", {
          className: "property-normal-label",
          title: r.equipTemplateIndustry.name
        }, r.equipTemplateIndustry.name)), _react.default.createElement("div", {
          className: "template-basic-descr"
        }, _react.default.createElement("div", {
          className: "property-label-name"
        }, "设备描述："), a ? _react.default.createElement(_amosFramework.Input, {
          value: n.descr,
          onChange: function(e) {
            return t.onAttributeChange("descr", e)
          },
          style: {
            width: "150px"
          },
          placeholder: "请输入"
        }) : _react.default.createElement("div", {
          className: "property-normal-label",
          title: n.descr
        }, n.descr)))
      }
    }]), o
  }();
DeviceBasicInfo.displayName = "DeviceBasicInfo", DeviceBasicInfo.propTypes = {
  device: _propTypes.default.object,
  equipment: _propTypes.default.object,
  updateBasicInfo: _propTypes.default.func,
  setImgFile: _propTypes.default.func,
  enable: _propTypes.default.bool
}, DeviceBasicInfo.defaultProps = {
  enable: !0
};
var _default = DeviceBasicInfo;
exports.default = DeviceBasicInfo, module.exports = exports.default;
