"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")), _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 _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 i in e) if ("default" !== i && Object.prototype.hasOwnProperty.call(e, i)) {
    var n = l ? Object.getOwnPropertyDescriptor(e, i) : null;
    n && (n.get || n.set) ? Object.defineProperty(r, i, n) : r[i] = e[i];
  }
  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 TextArea = _amosFramework.Input.TextArea, DeviceBasicInfo = function(e) {
  (0, _inherits2.default)(a, e);
  var t = _createSuper(a);
  function a(e) {
    var r;
    (0, _classCallCheck2.default)(this, a), r = t.call(this, e), (0, _defineProperty2.default)((0, 
    _assertThisInitialized2.default)(r), "onAttributeChange", (function(e, t) {
      var a = r.state.deviceBasicParam, l = r.props.updateBasicInfo;
      a[e] = t.target.value, l(a), r.setState({
        deviceBasicParam: a
      });
    }));
    var l = r.props, i = l.updateBasicInfo, n = l.equipment, c = l.device, u = {
      name: n ? n.name : "",
      descr: n ? n.descr : "",
      type: n ? n.type : "",
      eqpTmplId: c.id
    };
    return i(u), r.state = {
      deviceBasicParam: u
    }, r;
  }
  return (0, _createClass2.default)(a, [ {
    key: "componentWillMount",
    value: function() {}
  }, {
    key: "componentDidMount",
    value: function() {}
  }, {
    key: "componentWillReceiveProps",
    value: function(e) {}
  }, {
    key: "componentWillUnmount",
    value: function() {}
  }, {
    key: "render",
    value: function() {
      var e = this, t = this.props, a = t.device, r = (t.setImgFile, t.equipment, t.enable), l = this.state.deviceBasicParam, i = "".concat(_urlConsts.default.fetchDeviceImg, "/").concat(a.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: i,
        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"
      }, "设备名称："), r ? _react.default.createElement(_amosFramework.Input, {
        value: l.name,
        onChange: function(t) {
          return e.onAttributeChange("name", t);
        },
        style: {
          width: "150px",
          marginLeft: "10px"
        },
        placeholder: "请输入"
      }) : _react.default.createElement("div", {
        className: "property-normal-label",
        title: l.name
      }, l.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: a.name
      }, a.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: a.model
      }, a.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, a.type)
      }, (0, _DeviceLang.stringUtil)(_DeviceEnum.deviceCategoryEnum, a.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: a.equipTemplateIndustry.name
      }, a.equipTemplateIndustry.name)), _react.default.createElement("div", {
        className: "template-basic-descr"
      }, _react.default.createElement("div", {
        className: "property-label-name"
      }, "设备描述："), r ? _react.default.createElement(_amosFramework.Input, {
        value: l.descr,
        onChange: function(t) {
          return e.onAttributeChange("descr", t);
        },
        style: {
          width: "150px"
        },
        placeholder: "请输入"
      }) : _react.default.createElement("div", {
        className: "property-normal-label",
        title: l.descr
      }, l.descr)));
    }
  } ]), a;
}(_react.Component);

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 = _default;