"use strict";
Object.defineProperty(exports, "__esModule", {
  value: !0
}), exports.default = void 0;
var _react = _interopRequireWildcard(require("react")),
  _propTypes = _interopRequireDefault(require("prop-types")),
  _amosAntd = require("amos-antd"),
  _amosFramework = require("amos-framework"),
  _rayValidate = require("ray-validate"),
  _processor = require("../../../../utils/processor"),
  _urlConsts = require("../../../../consts/urlConsts"),
  _DeviceEnum = require("./../../common/DeviceEnum"),
  _DeviceLang = require("./../../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 a, r, n = {},
    l = Object.defineProperty && Object.getOwnPropertyDescriptor;
  for (a in e) Object.prototype.hasOwnProperty.call(e, a) && ((r = l ? Object.getOwnPropertyDescriptor(e, a) : null) && (r.get || r.set) ? Object.defineProperty(n, a, r) : n[a] = e[a]);
  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 _toConsumableArray(e) {
  return _arrayWithoutHoles(e) || _iterableToArray(e) || _unsupportedIterableToArray(e) || _nonIterableSpread()
}

function _nonIterableSpread() {
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
}

function _unsupportedIterableToArray(e, t) {
  if (e) {
    if ("string" == typeof e) return _arrayLikeToArray(e, t);
    var a = Object.prototype.toString.call(e).slice(8, -1);
    return "Object" === a && e.constructor && (a = e.constructor.name), "Map" === a || "Set" === a ? Array.from(e) : "Arguments" === a || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a) ? _arrayLikeToArray(e, t) : void 0
  }
}

function _iterableToArray(e) {
  if ("undefined" != typeof Symbol && Symbol.iterator in Object(e)) return Array.from(e)
}

function _arrayWithoutHoles(e) {
  if (Array.isArray(e)) return _arrayLikeToArray(e)
}

function _arrayLikeToArray(e, t) {
  (null == t || t > e.length) && (t = e.length);
  for (var a = 0, r = new Array(t); a < t; a++) r[a] = e[a];
  return r
}

function _extends() {
  return (_extends = Object.assign || function(e) {
    for (var t = 1; t < arguments.length; t++) {
      var a, r = arguments[t];
      for (a in r) Object.prototype.hasOwnProperty.call(r, a) && (e[a] = r[a])
    }
    return e
  }).apply(this, arguments)
}

function _classCallCheck(e, t) {
  if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}

function _defineProperties(e, t) {
  for (var a = 0; a < t.length; a++) {
    var r = t[a];
    r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
  }
}

function _createClass(e, t, a) {
  return t && _defineProperties(e.prototype, t), a && _defineProperties(e, a), 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(a) {
  var r = _isNativeReflectConstruct();
  return function() {
    var e, t = _getPrototypeOf(a);
    return _possibleConstructorReturn(this, r ? (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, a) {
  return t in e ? Object.defineProperty(e, t, {
    value: a,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : e[t] = a, e
}
var RadioGroup = _amosAntd.Radio.Group,
  Option = _amosFramework.Select.Option,
  FormItem = _amosAntd.Form.Item,
  dataTypeOption = (0, _DeviceLang.enums2array)(_DeviceEnum.dataTypeEnum).map(function(e) {
    return _react.default.createElement(Option, {
      key: e.key,
      value: "".concat(e.key)
    }, e.label)
  }),
  classifyOption = (0, _DeviceLang.enums2array)(_DeviceEnum.capacatyclassifyEnum).map(function(e) {
    return _react.default.createElement(_amosAntd.Radio, {
      key: e.key,
      value: "".concat(e.key)
    }, e.label)
  }),
  formItemLayout = {
    labelCol: {
      xs: {
        span: 24
      },
      sm: {
        span: 5
      }
    },
    wrapperCol: {
      xs: {
        span: 24
      },
      sm: {
        span: 16
      }
    }
  },
  fieldNames = ["name", "type", "displayName", "dataType", "unit", "descr", "isRequired"],
  AddEditCapacityProperty = function() {
    _inherits(a, _react.Component);
    var t = _createSuper(a);

    function a(e) {
      var T;
      return _classCallCheck(this, a), _defineProperty(_assertThisInitialized(T = t.call(this, e)), "onEnumRangeChange", function(e) {
        T.setState({
          currentenumRange: e.target.value
        })
      }), _defineProperty(_assertThisInitialized(T), "getDynamicCode", function() {
        var e = T.props.propertyInfo,
          t = e.valueStr,
          a = e.enumRange,
          r = e.minValue,
          n = e.maxValue,
          l = e.precision,
          o = void 0 === T.state.currentenumRange ? null === a ? "" : a : T.state.currentenumRange,
          u = T.props.form,
          s = u.getFieldProps,
          i = u.getFieldValue,
          d = i("dataType"),
          c = i("type"),
          p = s("defaultAppointedInt", {
            initialValue: t ? parseInt(t) : "",
            rules: [{
              required: !0,
              message: "常量值不能为空！"
            }, {
              validator: T.checkInt
            }]
          }),
          m = s("defaultAppointedFloat", {
            initialValue: t ? parseFloat(t) : "",
            rules: [{
              required: !0,
              message: "常量值不能为空！"
            }, {
              validator: T.checkFloat
            }]
          }),
          f = s("defaultAppointedString", {
            initialValue: t || "",
            rules: [{
              required: !0,
              min: 0,
              max: 255,
              message: "最大长度255！"
            }]
          }),
          _ = s("defaultAppointedBoolean", {
            initialValue: t,
            rules: [{
              required: !0,
              message: "常量值不能为空！"
            }]
          }),
          y = s("defaultAppointedPwd", {
            initialValue: t || "",
            rules: [{
              required: !0,
              min: 0,
              max: 255,
              message: "最大长度255！"
            }]
          }),
          h = s("enumRange", {
            initialValue: o,
            rules: [{
              required: !0,
              message: "枚举范围不能为空！"
            }]
          }),
          I = s("defaultIntValue", {
            initialValue: t ? parseInt(t) : "",
            rules: [{
              required: !1,
              message: "默认值不能为空！"
            }, {
              validator: T.checkIntExcludeNull
            }]
          }),
          b = s("minIntValue", {
            initialValue: r,
            rules: [{
              validator: T.checkInt
            }]
          }),
          E = s("maxIntValue", {
            initialValue: n,
            rules: [{
              validator: T.checkInt
            }]
          }),
          x = s("defaultFloatValue", {
            initialValue: t ? parseFloat(t) : "",
            rules: [{
              required: !1,
              message: "默认值不能为空！"
            }, {
              validator: T.checkFloatExcludeNull
            }]
          }),
          F = s("minFloatValue", {
            initialValue: r,
            rules: [{
              validator: T.checkFloat
            }]
          }),
          g = s("maxFloatValue", {
            initialValue: n,
            rules: [{
              validator: T.checkFloat
            }]
          }),
          v = s("defaultEnumValue", {
            rules: [{
              required: !1,
              message: "默认值不能为空！"
            }]
          }),
          k = s("defaultStringValue", {
            initialValue: t || "",
            rules: [{
              required: !1,
              min: 0,
              max: 255,
              message: "最大长度255！"
            }]
          }),
          A = s("defaultPwdValue", {
            initialValue: t || "",
            rules: [{
              required: !1,
              min: 0,
              max: 255,
              message: "最大长度255！"
            }]
          }),
          e = s("defaultBoolean", {
            initialValue: t,
            rules: [{
              required: !1,
              message: "默认值不能为空！"
            }]
          }),
          a = s("precision", {
            initialValue: void 0 === l ? 2 : l,
            rules: []
          }),
          u = s("minIntOutput", {
            initialValue: r,
            rules: [{
              validator: T.checkIntExcludeNull
            }]
          }),
          i = s("maxIntOutput", {
            initialValue: n,
            rules: [{
              validator: T.checkIntExcludeNull
            }]
          }),
          t = s("precisionOutput", {
            initialValue: void 0 === l ? 2 : l,
            rules: []
          }),
          l = s("minFloatOutput", {
            initialValue: r,
            rules: [{
              validator: T.checkFloatExcludeNull
            }]
          }),
          r = s("maxFloatOutput", {
            initialValue: n,
            rules: [{
              validator: T.checkFloatExcludeNull
            }]
          }),
          n = s("enumRangeOutput", {
            initialValue: o,
            rules: [{
              required: !1,
              message: "枚举范围不能为空！"
            }]
          }),
          s = [];
        if ("1" === d) "1" === c ? (s.push(_react.default.createElement(FormItem, _extends({}, formItemLayout, {
          hasFeedback: !0,
          label: "最小值: "
        }), _react.default.createElement(_amosAntd.Input, _extends({}, b, {
          placeholder: "最小值"
        })))), s.push(_react.default.createElement(FormItem, _extends({}, formItemLayout, {
          hasFeedback: !0,
          label: "最大值: "
        }), _react.default.createElement(_amosAntd.Input, _extends({}, E, {
          placeholder: "最大值"
        })))), s.push(_react.default.createElement(FormItem, _extends({}, formItemLayout, {
          hasFeedback: !0,
          label: "默认值: "
        }), _react.default.createElement(_amosAntd.Input, _extends({}, I, {
          placeholder: "默认值"
        }))))) : "2" === c ? s.push(_react.default.createElement(FormItem, _extends({}, formItemLayout, {
          hasFeedback: !0,
          label: "数值: "
        }), _react.default.createElement(_amosAntd.Input, _extends({}, p, {
          placeholder: "(数值)最多支持32位整型数据"
        })))) : "4" === c && (s.push(_react.default.createElement(FormItem, _extends({}, formItemLayout, {
          hasFeedback: !0,
          label: "最小值: "
        }), _react.default.createElement(_amosAntd.Input, _extends({}, u, {
          placeholder: "最小值"
        })))), s.push(_react.default.createElement(FormItem, _extends({}, formItemLayout, {
          hasFeedback: !0,
          label: "最大值: "
        }), _react.default.createElement(_amosAntd.Input, _extends({}, i, {
          placeholder: "最大值"
        })))));
        else if ("3" === d) "1" === c ? s.push(_react.default.createElement(FormItem, _extends({}, formItemLayout, {
          hasFeedback: !0,
          label: "默认值: "
        }), _react.default.createElement(RadioGroup, e, _react.default.createElement(_amosAntd.Radio, {
          key: "1",
          value: "1"
        }, "true"), _react.default.createElement(_amosAntd.Radio, {
          key: "0",
          value: "0"
        }, "false")))) : "2" === c && s.push(_react.default.createElement(FormItem, _extends({}, formItemLayout, {
          hasFeedback: !0,
          label: "值: "
        }), _react.default.createElement(RadioGroup, _, _react.default.createElement(_amosAntd.Radio, {
          key: "1",
          value: "1"
        }, "true"), _react.default.createElement(_amosAntd.Radio, {
          key: "0",
          value: "0"
        }, "false"))));
        else if ("4" === d)
          if ("1" === c) {
            s.push(_react.default.createElement(FormItem, _extends({}, formItemLayout, {
              hasFeedback: !0,
              label: "枚举范围: "
            }), _react.default.createElement(_amosAntd.Input, _extends({}, h, {
              placeholder: "由中文英文及字符组成，字符之间以一个半角逗号作为间隔",
              onChange: T.onEnumRangeChange
            }))));
            for (var P = o.split(","), V = [], O = 0; O < P.length; O++) {
              var C = P[O];
              "" !== C && V.push(_react.default.createElement(Option, {
                key: O,
                value: "".concat(C)
              }, C))
            }
            s.push(_react.default.createElement(FormItem, _extends({}, formItemLayout, {
              hasFeedback: !0,
              label: "默认值: "
            }), _react.default.createElement(_amosFramework.Select, _extends({
              style: {
                width: "100%",
                height: "32px"
              }
            }, v, {
              placeholder: "请先输入枚举范围"
            }), V)))
          } else "2" === c ? s.push(_react.default.createElement(FormItem, _extends({}, formItemLayout, {
            hasFeedback: !0,
            label: "枚举范围: "
          }), _react.default.createElement(_amosAntd.Input, _extends({}, h, {
            placeholder: "由中文英文及字符组成，字符之间以一个半角逗号作为间隔"
          })))) : "4" === c && s.push(_react.default.createElement(FormItem, _extends({}, formItemLayout, {
            hasFeedback: !0,
            label: "枚举范围: "
          }), _react.default.createElement(_amosAntd.Input, _extends({}, n, {
            placeholder: "由中文英文及字符组成，字符之间以一个半角逗号作为间隔"
          }))));
        else "5" === d ? "1" === c ? s.push(_react.default.createElement(FormItem, _extends({}, formItemLayout, {
          hasFeedback: !0,
          label: "默认值: "
        }), _react.default.createElement(_amosAntd.Input, _extends({}, k, {
          placeholder: "默认值"
        })))) : "2" === c && s.push(_react.default.createElement(FormItem, _extends({}, formItemLayout, {
          hasFeedback: !0,
          label: "默认值: "
        }), _react.default.createElement(_amosAntd.Input, _extends({}, f, {
          placeholder: "默认值"
        })))) : "6" === d ? "1" === c ? s.push(_react.default.createElement(FormItem, _extends({}, formItemLayout, {
          hasFeedback: !0,
          label: "默认值: "
        }), _react.default.createElement(_amosAntd.Input, _extends({}, A, {
          type: "password",
          placeholder: "默认值"
        })))) : "2" === c && s.push(_react.default.createElement(FormItem, _extends({}, formItemLayout, {
          hasFeedback: !0,
          label: "默认值: "
        }), _react.default.createElement(_amosAntd.Input, _extends({}, y, {
          type: "password",
          placeholder: "默认值"
        })))) : "2" === d && ("1" === c ? (s.push(_react.default.createElement(FormItem, _extends({}, formItemLayout, {
          hasFeedback: !0,
          label: "精度: "
        }), _react.default.createElement("label", null, "小数点后"), _react.default.createElement(_amosAntd.InputNumber, _extends({
          min: 0,
          max: 32,
          defaultValue: 0
        }, a)), _react.default.createElement("label", null, "位"))), s.push(_react.default.createElement(FormItem, _extends({}, formItemLayout, {
          hasFeedback: !0,
          label: "最小值: "
        }), _react.default.createElement(_amosAntd.Input, _extends({}, F, {
          placeholder: "最小值"
        })))), s.push(_react.default.createElement(FormItem, _extends({}, formItemLayout, {
          hasFeedback: !0,
          label: "最大值: "
        }), _react.default.createElement(_amosAntd.Input, _extends({}, g, {
          placeholder: "最大值"
        })))), s.push(_react.default.createElement(FormItem, _extends({}, formItemLayout, {
          hasFeedback: !0,
          label: "默认值: "
        }), _react.default.createElement(_amosAntd.Input, _extends({}, x, {
          placeholder: "默认值"
        }))))) : "2" === c ? s.push(_react.default.createElement(FormItem, _extends({}, formItemLayout, {
          hasFeedback: !0,
          label: "数值: "
        }), _react.default.createElement(_amosAntd.Input, _extends({}, m, {
          placeholder: "(数值)最多支持小数点前后32位浮点型数据"
        })))) : "4" === c && (s.push(_react.default.createElement(FormItem, _extends({}, formItemLayout, {
          hasFeedback: !0,
          label: "精度: "
        }), _react.default.createElement("label", null, "小数点后"), _react.default.createElement(_amosAntd.InputNumber, _extends({
          min: 0,
          max: 32,
          defaultValue: 0
        }, t)), _react.default.createElement("label", null, "位"))), s.push(_react.default.createElement(FormItem, _extends({}, formItemLayout, {
          hasFeedback: !0,
          label: "最小值: "
        }), _react.default.createElement(_amosAntd.Input, _extends({}, l, {
          placeholder: "最小值"
        })))), s.push(_react.default.createElement(FormItem, _extends({}, formItemLayout, {
          hasFeedback: !0,
          label: "最大值: "
        }), _react.default.createElement(_amosAntd.Input, _extends({}, r, {
          placeholder: "最大值"
        }))))));
        return s
      }), _defineProperty(_assertThisInitialized(T), "getDynamicCodeName", function() {
        var e = T.props.form.getFieldValue,
          t = e("dataType"),
          a = e("type"),
          e = [];
        return "1" === t ? "1" === a ? (e.push("minIntValue"), e.push("maxIntValue"), e.push("defaultIntValue")) : "2" === a ? e.push("defaultAppointedInt") : "4" === a && (e.push("minIntOutput"), e.push("maxIntOutput")) : "3" === t ? "1" === a ? e.push("defaultBoolean") : "2" === a && e.push("defaultAppointedBoolean") : "4" === t ? "1" === a ? (e.push("enumRange"), e.push("defaultEnumValue")) : "2" === a ? e.push("enumRange") : "4" === a && e.push("enumRangeOutput") : "5" === t ? "1" === a ? e.push("defaultStringValue") : "2" === a && e.push("defaultAppointedString") : "6" === t ? "1" === a ? e.push("defaultPwdValue") : "2" === a && e.push("defaultAppointedPwd") : "2" === t && ("1" === a ? (e.push("precision"), e.push("minFloatValue"), e.push("maxFloatValue"), e.push("defaultFloatValue")) : "2" === a ? e.push("defaultAppointedFloat") : "4" === a && (e.push("precisionOutput"), e.push("minFloatOutput"), e.push("maxFloatOutput"))), e
      }), _defineProperty(_assertThisInitialized(T), "handleSubmit", function(e) {
        e.preventDefault();
        e = [].concat(fieldNames, _toConsumableArray(T.getDynamicCodeName()));
        T.props.form.validateFields(e, {}, function(e, t) {
          e || T.handleSave(t)
        })
      }), _defineProperty(_assertThisInitialized(T), "handleSave", function(e) {
        var t, a = T.props.propertyInfo,
          r = 0,
          n = 0,
          l = "",
          o = "",
          u = 0;
        for (t in e) e.hasOwnProperty(t) && t.startsWith("min") ? r = e[t] : e.hasOwnProperty(t) && t.startsWith("max") ? n = e[t] : e.hasOwnProperty(t) && t.startsWith("default") ? l = String(e[t]) : e.hasOwnProperty(t) && t.startsWith("enumRange") ? o = e[t] : e.hasOwnProperty(t) && t.startsWith("precision") && (u = e[t]);
        var s = (new Date).getTime();
        _extends(e, {
          minValue: r,
          maxValue: n,
          valueStr: l = null === l ? "" : l,
          enumRange: o,
          precision: u,
          key: s
        });
        s = [{
          key: s,
          name: e.name,
          type: e.type,
          dataType: e.dataType
        }];
        void 0 === T.props.deviceId ? (T.props.addCapacityProperty(e), T.props.autoCardCalculate(s), T.props.form.resetFields(), T.props.callBack()) : (a.id && (e.id = a.id), T.saveCapacityProperty(e))
      }), _defineProperty(_assertThisInitialized(T), "handleCancel", function(e) {
        T.props.form.resetFields(), T.props.callBack()
      }), _defineProperty(_assertThisInitialized(T), "checkInt", function(e, t, a) {
        var r;
        "" === t || null == t || (0, _rayValidate.isInt)(parseInt(t)) && 0 <= (r = t.toString().length) && r < 33 ? a() : a("最多支持32位整型数据")
      }), _defineProperty(_assertThisInitialized(T), "checkFloat", function(e, t, a) {
        var r;
        "" === t || null == t || (0, _rayValidate.isNum)(parseInt(t)) && 0 < (r = t.toString().length) && r < 33 ? a() : a("最多支持小数点前后32位浮点型数据")
      }), _defineProperty(_assertThisInitialized(T), "checkIntExcludeNull", function(e, t, a) {
        var r;
        "" === t || null == t || (0, _rayValidate.isInt)(parseInt(t)) && 0 < (r = t.toString().length) && r < 33 ? a() : a("最多支持32位整型数据")
      }), _defineProperty(_assertThisInitialized(T), "checkFloatExcludeNull", function(e, t, a) {
        var r;
        "" === t || null == t || (0, _rayValidate.isNum)(parseInt(t)) && 0 < (r = t.toString().length) && r < 33 ? a() : a("最多支持小数点前后32位浮点型数据")
      }), _defineProperty(_assertThisInitialized(T), "saveCapacityProperty", function(e) {
        var t = T.props.deviceId;
        _extends(e, {
          cpblId: T.props.capacityId
        }), _processor.AmosFetch.post(_urlConsts.OltSerUrl.capacityPropertyUpdate, {
          data: e
        }).then(function(e) {
          if (e.ok) return e.json();
          throw new Error("从服务端获取数据失败！")
        }).then(function(e) {
          "SUCCESS" === e.result ? _amosFramework.message.success("新增属性成功！") : _amosFramework.message.danger("新增属性失败！"), T.props.getDeviceInfoById(t), T.props.form.resetFields(), T.props.callBack()
        })
      }), T.state = {
        currentenumRange: void 0
      }, T
    }
    return _createClass(a, [{
      key: "componentDidMount",
      value: function() {}
    }, {
      key: "render",
      value: function() {
        var e = this.props,
          t = e.form,
          a = e.propertyInfo,
          r = a.name,
          n = a.type,
          l = a.displayName,
          o = a.dataType,
          u = a.unit,
          e = a.descr,
          t = t.getFieldProps,
          r = t("name", {
            initialValue: r || "",
            rules: [{
              required: !0,
              min: 1,
              max: 50,
              message: "支持1-20位非空格字符！"
            }]
          }),
          n = t("type", {
            initialValue: "".concat(n),
            rules: [{
              required: !0,
              message: "分类不能为空！"
            }]
          }),
          l = t("displayName", {
            initialValue: l || "",
            rules: [{
              required: !0,
              min: 1,
              max: 20,
              message: "支持1-20位非空格字符！"
            }]
          }),
          o = t("dataType", {
            initialValue: "".concat(o),
            rules: [{
              required: !0,
              message: "数据类型不能为空！"
            }]
          }),
          u = t("unit", {
            initialValue: u || "",
            rules: [{
              required: !1,
              min: 1,
              max: 20,
              message: "支持1-20位非空格字符！"
            }]
          }),
          e = t("descr", {
            initialValue: e || "",
            rules: [{
              required: !1,
              message: "描述不能为空！"
            }]
          }),
          a = t("isRequired", {
            initialValue: !!a && a.isRequired,
            valuePropName: "checked",
            rules: []
          });
        return _react.default.createElement("div", {
          className: "device-interface-add-modal"
        }, _react.default.createElement(_amosAntd.Form, {
          horizontal: !0,
          onSubmit: this.handleSubmit
        }, _react.default.createElement(FormItem, _extends({}, formItemLayout, {
          hasFeedback: !0,
          label: "属性名: "
        }), _react.default.createElement(_amosAntd.Input, _extends({}, r, {
          placeholder: "属性名（支持1-20位非空格字符）"
        }))), _react.default.createElement(FormItem, _extends({}, formItemLayout, {
          hasFeedback: !0,
          label: "分类: "
        }), _react.default.createElement(RadioGroup, n, classifyOption)), _react.default.createElement(FormItem, _extends({}, formItemLayout, {
          hasFeedback: !0,
          label: "显示名称: "
        }), _react.default.createElement(_amosAntd.Input, _extends({}, l, {
          placeholder: "属性名（支持1-20位非空格字符）"
        }))), _react.default.createElement(FormItem, _extends({}, formItemLayout, {
          hasFeedback: !0,
          label: "数据类型："
        }), _react.default.createElement(_amosFramework.Select, _extends({
          style: {
            width: "100%",
            height: "32px"
          }
        }, o), dataTypeOption)), _react.default.createElement("div", null, this.getDynamicCode()), _react.default.createElement(FormItem, _extends({}, formItemLayout, {
          hasFeedback: !0,
          label: "单位: "
        }), _react.default.createElement(_amosAntd.Input, _extends({}, u, {
          placeholder: "单位（支持1-20位非空格字符）"
        }))), _react.default.createElement(FormItem, _extends({}, formItemLayout, {
          hasFeedback: !0,
          label: "描述: "
        }), _react.default.createElement(_amosAntd.Input, e)), _react.default.createElement(FormItem, _extends({}, formItemLayout, {
          hasFeedback: !0,
          label: "是否必填: "
        }), _react.default.createElement(_amosAntd.Checkbox, _extends({}, a, {
          style: {
            "line-height": "31px",
            float: "left",
            "margin-left": "7px"
          }
        }))), _react.default.createElement(FormItem, {
          wrapperCol: {
            xs: {
              span: 24,
              offset: 0
            },
            sm: {
              span: 24,
              offset: 0
            }
          }
        }, _react.default.createElement(_amosAntd.Row, null, _react.default.createElement(_amosAntd.Col, {
          span: 3,
          offset: 14
        }, _react.default.createElement(_amosAntd.Button, {
          type: "primary",
          htmlType: "submit"
        }, "提交")), _react.default.createElement(_amosAntd.Col, {
          span: 3,
          offset: 1
        }, _react.default.createElement(_amosAntd.Button, {
          onClick: this.handleCancel
        }, "取消"))))))
      }
    }]), a
  }();
AddEditCapacityProperty.displayName = "AddEditCapacityProperty", AddEditCapacityProperty.propTypes = {
  form: _propTypes.default.any,
  callBack: _propTypes.default.func,
  addCapacityProperty: _propTypes.default.func,
  autoCardCalculate: _propTypes.default.func,
  deviceId: _propTypes.default.number,
  capacityId: _propTypes.default.number,
  getDeviceInfoById: _propTypes.default.func,
  propertyInfo: _propTypes.default.any
}, AddEditCapacityProperty.defaultProps = {
  propertyInfo: {
    type: "1",
    dataType: "1",
    enumRange: ""
  }
};
var _default = AddEditCapacityProperty;
exports.default = AddEditCapacityProperty, module.exports = exports.default;
