"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.FORM = void 0;
exports["default"] = _default;
exports.useRenderYearPicker = exports.useRenderWeekPicker = exports.useRenderVtxUpload = exports.useRenderVoiceUpload = exports.useRenderVideoUpload = exports.useRenderVacancy = exports.useRenderTreeSelect = exports.useRenderTime = exports.useRenderTextArea = exports.useRenderSwitch = exports.useRenderSlider = exports.useRenderSelect = exports.useRenderRate = exports.useRenderRangeYearPicker = exports.useRenderRangeWeekPicker = exports.useRenderRangeQuarterPicker = exports.useRenderRangePickerTime = exports.useRenderRangePicker = exports.useRenderRangeMonthPicker = exports.useRenderRadio = exports.useRenderQuarterPicker = exports.useRenderPointMap = exports.useRenderNumber = exports.useRenderMonthPicker = exports.useRenderMapLocation = exports.useRenderInput = exports.useRenderImgUpload = exports.useRenderFileUpload = exports.useRenderDatePicker = exports.useRenderCheckBox = exports.useRenderCascade = exports.useRenderBlank = exports.renderUploadButton = void 0;
var _react = _interopRequireWildcard(require("react"));
var _vtxInput = _interopRequireDefault(require("@vtx/components/lib/vtx-input"));
var _vtxSelect = _interopRequireDefault(require("@vtx/components/lib/vtx-select"));
var _vtxFormLayout = _interopRequireDefault(require("@vtx/components/lib/vtx-form-layout"));
var _vtxUpload = _interopRequireDefault(require("@vtx/components/lib/vtx-upload"));
var _vtxZtreeSelect = _interopRequireDefault(require("@vtx/components/lib/vtx-ztree-select"));
var _inputNumber = _interopRequireDefault(require("antd/lib/input-number"));
var _switch = _interopRequireDefault(require("antd/lib/switch"));
var _datePicker = _interopRequireDefault(require("antd/lib/date-picker"));
var _timePicker = _interopRequireDefault(require("antd/lib/time-picker"));
var _radio = _interopRequireDefault(require("antd/lib/radio"));
var _checkbox = _interopRequireDefault(require("antd/lib/checkbox"));
var _slider = _interopRequireDefault(require("antd/lib/slider"));
var _upload = _interopRequireDefault(require("antd/lib/upload"));
var _button = _interopRequireDefault(require("antd/lib/button"));
var _modal = _interopRequireDefault(require("antd/lib/modal"));
var _cascader = _interopRequireDefault(require("antd/lib/cascader"));
var _input = _interopRequireDefault(require("antd/lib/input"));
var _space = _interopRequireDefault(require("antd/lib/space"));
var _message = _interopRequireDefault(require("antd/lib/message"));
var _PlusOutlined = _interopRequireDefault(require("@ant-design/icons/PlusOutlined"));
var _UploadOutlined = _interopRequireDefault(require("@ant-design/icons/UploadOutlined"));
var _ModalPictureGallery = _interopRequireDefault(require("../ModalPictureGallery"));
var _PublicService = _interopRequireDefault(require("../../_mapUtil/PublicService"));
var _mime = _interopRequireDefault(require("../../_mapUtil/mime.json"));
var _getUrlParam = _interopRequireDefault(require("@vtx/utils/lib/getUrlParam"));
require("./index.less");
var _MyIcon = _interopRequireDefault(require("../MyIcon"));
var _lodash = require("lodash");
var _config = _interopRequireDefault(require("../../_mapUtil/config"));
var _excluded = ["options", "showTitle"];
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _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(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
var classnames = function classnames(name) {
  if (name) {
    return "ol-map-FormItem-".concat(name);
  }
  return "ol-map-FormItem";
};

// 文件上传验证
function verticalFile(file, vertic) {
  var ErrorMsg = '上传的文件不合格！';
  var _vertic$maxSize = vertic.maxSize,
    maxSize = _vertic$maxSize === void 0 ? null : _vertic$maxSize,
    types = vertic.type;
  // 判断文件格式
  var _types = Array.isArray(types) ? types.flat(Infinity) : types;
  var fileType = file.name.split('.').reverse()[0];
  if (_types && (_types.indexOf(fileType) < 0 || _types.indexOf(fileType.toLowerCase()) < 0)) {
    _message["default"].error("".concat(ErrorMsg, ", \u8BF7\u4E0A\u4F20").concat(_types, "\u683C\u5F0F\u7684\u6587\u4EF6"));
    return _upload["default"].LIST_IGNORE;
  }

  // 判断文件大小
  if (Array.isArray(maxSize)) {
    for (var i = 0; i < types.length; i++) {
      if (types[i].indexOf(file.name.split('.')[1]) >= 0) {
        maxSize = maxSize[i];
        break;
      }
    }
  }
  if (maxSize > 0 && file.size > maxSize) {
    _message["default"].error("".concat(ErrorMsg, ": \u6587\u4EF6\u5927\u5C0F\u9519\u8BEF"));
    return _upload["default"].LIST_IGNORE;
  }
}

// 渲染自定义表单
var useRenderBlank = exports.useRenderBlank = function useRenderBlank(props) {
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, props.content);
};
var useRenderInput = exports.useRenderInput = function useRenderInput(props) {
  var _props$itemProps = props.itemProps,
    itemProps = _props$itemProps === void 0 ? {} : _props$itemProps;
  var onChange = itemProps.onChange;
  function handleChange(val) {
    onChange && onChange(val);
  }
  return /*#__PURE__*/_react["default"].createElement(_vtxInput["default"], _extends({
    placeholder: "\u8BF7\u8F93\u5165",
    specialCharactersFilter: false
  }, itemProps, {
    onChange: handleChange
  }));
};

// export const useRenderTextArea = function (props) {
//   let { itemProps = {} } = props;
//   return <VtxInput.TextArea placeholder="请输入" {...itemProps} />;
// };
var useRenderTextArea = exports.useRenderTextArea = function useRenderTextArea(props) {
  var textArea = (0, _react.useRef)();
  var _props$itemProps2 = props.itemProps,
    itemProps = _props$itemProps2 === void 0 ? {} : _props$itemProps2;
  var onChange = itemProps.onChange,
    onFocus = itemProps.onFocus,
    init = itemProps.init;
  (0, _react.useEffect)(function () {
    init && init(textArea && textArea.current);
  }, []);
  function handleChange(val) {
    onChange && onChange(val, textArea && textArea.current);
  }
  function handleFocus(val) {
    onFocus && onFocus(val, textArea && textArea.current);
  }
  return /*#__PURE__*/_react["default"].createElement(_vtxInput["default"].TextArea, _extends({
    ref: textArea,
    placeholder: "\u8BF7\u8F93\u5165"
  }, itemProps, {
    onChange: handleChange,
    onFocus: handleFocus
  }));
};
var useRenderNumber = exports.useRenderNumber = function useRenderNumber(props) {
  var _props$itemProps3 = props.itemProps,
    itemProps = _props$itemProps3 === void 0 ? {} : _props$itemProps3;
  return /*#__PURE__*/_react["default"].createElement(_inputNumber["default"], _extends({
    placeholder: "\u8BF7\u8F93\u5165",
    style: {
      width: '100%'
    }
  }, itemProps));
};
var useRenderRadio = exports.useRenderRadio = function useRenderRadio(props) {
  var _props$itemProps4 = props.itemProps,
    itemProps = _props$itemProps4 === void 0 ? {} : _props$itemProps4;
  var _itemProps$options = itemProps.options,
    options = _itemProps$options === void 0 ? [] : _itemProps$options,
    _itemProps$inline = itemProps.inline,
    inline = _itemProps$inline === void 0 ? 'inline' : _itemProps$inline,
    onChange = itemProps.onChange,
    direction = itemProps.direction,
    _itemProps$directionO = itemProps.directionOpts,
    directionOpts = _itemProps$directionO === void 0 ? [] : _itemProps$directionO;
  var radioStyle = {
    display: inline,
    height: '30px',
    lineHeight: '30px'
  };
  function handleChange(val) {
    onChange && onChange(val);
    // if (formData) {
    //   formData[paramName] = val.target.value;
    // }
  }
  return /*#__PURE__*/_react["default"].createElement(_radio["default"].Group, _extends({}, itemProps, {
    onChange: handleChange
  }), direction ? /*#__PURE__*/_react["default"].createElement(_space["default"], {
    direction: direction
  }, (directionOpts === null || directionOpts === void 0 ? void 0 : directionOpts.length) > 0 && directionOpts.map(function (o, i) {
    return /*#__PURE__*/_react["default"].createElement(_radio["default"], {
      style: _objectSpread({}, radioStyle),
      key: "".concat(i, "-").concat(o.value),
      value: o.value
    }, o.label);
  })) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, (options === null || options === void 0 ? void 0 : options.length) > 0 && options.map(function (o, i) {
    return /*#__PURE__*/_react["default"].createElement(_radio["default"], {
      style: _objectSpread({}, radioStyle),
      key: "".concat(i, "-").concat(o.value),
      defaultValue: o.value
    }, o.label);
  })));
};
var useRenderCheckBox = exports.useRenderCheckBox = function useRenderCheckBox(props) {
  var _props$itemProps5 = props.itemProps,
    itemProps = _props$itemProps5 === void 0 ? {} : _props$itemProps5,
    indeterminate = props.indeterminate,
    onChangeCheckbox = props.onChangeCheckbox,
    paramName = props.paramName,
    _props$parentForm = props.parentForm,
    parentForm = _props$parentForm === void 0 ? {} : _props$parentForm;
  var setFieldsValue = parentForm.setFieldsValue;
  var _itemProps$options2 = itemProps.options,
    options = _itemProps$options2 === void 0 ? [] : _itemProps$options2,
    inline = itemProps.inline,
    _itemProps$group = itemProps.group,
    group = _itemProps$group === void 0 ? true : _itemProps$group,
    _onChange = itemProps.onChange,
    disabled = itemProps.disabled;
  var checkStyle = {
    display: inline,
    marginLeft: 0,
    marginRight: 8,
    height: '30px',
    lineHeight: '30px'
  };
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, group ? /*#__PURE__*/_react["default"].createElement(_checkbox["default"].Group, {
    defaultValue: props.initialValue,
    onChange: function onChange(checkedValue) {
      setFieldsValue && setFieldsValue(_defineProperty({}, paramName, checkedValue));
    }
  }, (options === null || options === void 0 ? void 0 : options.length) > 0 && options.map(function (o, i) {
    return /*#__PURE__*/_react["default"].createElement(_checkbox["default"], {
      style: _objectSpread({}, checkStyle),
      key: "".concat(i, "-").concat(o.value),
      value: o.value
    }, o.label);
  })) : /*#__PURE__*/_react["default"].createElement(_checkbox["default"], {
    defaultChecked: props.initialValue,
    onChange: function onChange(e) {
      _onChange && _onChange(e);
      onChangeCheckbox && onChangeCheckbox(e.target.checked);
    },
    indeterminate: indeterminate,
    disabled: props.disabled || disabled
  }, props.label));
};
var useRenderSwitch = exports.useRenderSwitch = function useRenderSwitch(props) {
  var _props$itemProps6 = props.itemProps,
    itemProps = _props$itemProps6 === void 0 ? {} : _props$itemProps6;
  return /*#__PURE__*/_react["default"].createElement(_switch["default"], itemProps);
};
var useRenderSlider = exports.useRenderSlider = function useRenderSlider(props) {
  var _props$itemProps7 = props.itemProps,
    itemProps = _props$itemProps7 === void 0 ? {} : _props$itemProps7;
  return /*#__PURE__*/_react["default"].createElement(_slider["default"], itemProps);
};
var useRenderRate = exports.useRenderRate = function useRenderRate(props) {
  var _props$itemProps8 = props.itemProps,
    itemProps = _props$itemProps8 === void 0 ? {} : _props$itemProps8;
  return /*#__PURE__*/_react["default"].createElement(Rate, itemProps);
};
var useRenderTime = exports.useRenderTime = function useRenderTime(props) {
  var _props$itemProps9 = props.itemProps,
    itemProps = _props$itemProps9 === void 0 ? {} : _props$itemProps9;
  return /*#__PURE__*/_react["default"].createElement(_timePicker["default"], _extends({
    hideDisabledOptions: true // 将不可选的选项隐藏
    ,
    format: 'HH:mm:ss'
  }, itemProps));
};
var useRenderRangePickerTime = exports.useRenderRangePickerTime = function useRenderRangePickerTime(props) {
  var _props$itemProps10 = props.itemProps,
    itemProps = _props$itemProps10 === void 0 ? {} : _props$itemProps10;
  return /*#__PURE__*/_react["default"].createElement(_timePicker["default"].RangePicker, itemProps);
};
var useRenderDatePicker = exports.useRenderDatePicker = function useRenderDatePicker(props) {
  var _props$itemProps11 = props.itemProps,
    itemProps = _props$itemProps11 === void 0 ? {} : _props$itemProps11;
  return /*#__PURE__*/_react["default"].createElement(_datePicker["default"], itemProps);
};
var useRenderWeekPicker = exports.useRenderWeekPicker = function useRenderWeekPicker(props) {
  var _props$itemProps12 = props.itemProps,
    itemProps = _props$itemProps12 === void 0 ? {} : _props$itemProps12;
  return /*#__PURE__*/_react["default"].createElement(_datePicker["default"], _extends({
    picker: "week"
  }, itemProps));
};
var useRenderMonthPicker = exports.useRenderMonthPicker = function useRenderMonthPicker(props) {
  var _props$itemProps13 = props.itemProps,
    itemProps = _props$itemProps13 === void 0 ? {} : _props$itemProps13;
  return /*#__PURE__*/_react["default"].createElement(_datePicker["default"], _extends({
    picker: "month"
  }, itemProps));
};
var useRenderQuarterPicker = exports.useRenderQuarterPicker = function useRenderQuarterPicker(props) {
  var _props$itemProps14 = props.itemProps,
    itemProps = _props$itemProps14 === void 0 ? {} : _props$itemProps14;
  return /*#__PURE__*/_react["default"].createElement(_datePicker["default"], _extends({
    picker: "quarter"
  }, itemProps));
};
var useRenderYearPicker = exports.useRenderYearPicker = function useRenderYearPicker(props) {
  var _props$itemProps15 = props.itemProps,
    itemProps = _props$itemProps15 === void 0 ? {} : _props$itemProps15;
  return /*#__PURE__*/_react["default"].createElement(_datePicker["default"], _extends({
    picker: "year"
  }, itemProps));
};
var useRenderRangePicker = exports.useRenderRangePicker = function useRenderRangePicker(props) {
  var _props$itemProps16 = props.itemProps,
    itemProps = _props$itemProps16 === void 0 ? {} : _props$itemProps16;
  return /*#__PURE__*/_react["default"].createElement(_datePicker["default"].RangePicker, itemProps);
};
var useRenderRangeWeekPicker = exports.useRenderRangeWeekPicker = function useRenderRangeWeekPicker(props) {
  var _props$itemProps17 = props.itemProps,
    itemProps = _props$itemProps17 === void 0 ? {} : _props$itemProps17;
  return /*#__PURE__*/_react["default"].createElement(_datePicker["default"].RangePicker, _extends({
    picker: "week"
  }, itemProps));
};
var useRenderRangeMonthPicker = exports.useRenderRangeMonthPicker = function useRenderRangeMonthPicker(props) {
  var _props$itemProps18 = props.itemProps,
    itemProps = _props$itemProps18 === void 0 ? {} : _props$itemProps18;
  return /*#__PURE__*/_react["default"].createElement(_datePicker["default"].RangePicker, _extends({
    picker: "month"
  }, itemProps));
};
var useRenderRangeQuarterPicker = exports.useRenderRangeQuarterPicker = function useRenderRangeQuarterPicker(props) {
  var _props$itemProps19 = props.itemProps,
    itemProps = _props$itemProps19 === void 0 ? {} : _props$itemProps19;
  return /*#__PURE__*/_react["default"].createElement(_datePicker["default"].RangePicker, _extends({
    picker: "quarter"
  }, itemProps));
};
var useRenderRangeYearPicker = exports.useRenderRangeYearPicker = function useRenderRangeYearPicker(props) {
  var _props$itemProps20 = props.itemProps,
    itemProps = _props$itemProps20 === void 0 ? {} : _props$itemProps20;
  return /*#__PURE__*/_react["default"].createElement(_datePicker["default"].RangePicker, _extends({
    picker: "year"
  }, itemProps));
};
var useRenderSelect = exports.useRenderSelect = function useRenderSelect(props) {
  var _selectOptions;
  var _props$itemProps21 = props.itemProps,
    itemProps = _props$itemProps21 === void 0 ? {} : _props$itemProps21,
    showAll = props.showAll,
    _props$options = props.options,
    propsOptions = _props$options === void 0 ? [] : _props$options;
  var _itemProps$options3 = itemProps.options,
    options = _itemProps$options3 === void 0 ? [] : _itemProps$options3,
    _itemProps$showTitle = itemProps.showTitle,
    showTitle = _itemProps$showTitle === void 0 ? false : _itemProps$showTitle,
    restProps = _objectWithoutProperties(itemProps, _excluded);
  var selectOptions = [].concat(_toConsumableArray(propsOptions), _toConsumableArray(options));
  if (showAll) {
    selectOptions = [{
      label: '全部',
      value: ''
    }].concat(_toConsumableArray(selectOptions));
  }
  return /*#__PURE__*/_react["default"].createElement(_vtxSelect["default"], _extends({
    allowClear: true
  }, restProps), ((_selectOptions = selectOptions) === null || _selectOptions === void 0 ? void 0 : _selectOptions.length) > 0 && selectOptions.map(function (option) {
    return /*#__PURE__*/_react["default"].createElement(_vtxSelect["default"].Option, {
      key: option.value,
      value: option.value,
      title: showTitle ? option.label : ''
    }, option.label);
  }));
};
var useRenderTreeSelect = exports.useRenderTreeSelect = function useRenderTreeSelect(props) {
  var _props$itemProps22 = props.itemProps,
    itemProps = _props$itemProps22 === void 0 ? {} : _props$itemProps22;
  var _itemProps$treeData = itemProps.treeData,
    treeData = _itemProps$treeData === void 0 ? [] : _itemProps$treeData,
    _onChange2 = itemProps.onChange;
  var data = _PublicService["default"].transformTreeData({
    data: treeData,
    needKey: true,
    justKey: false
  });
  return (
    /*#__PURE__*/
    // <TreeSelect
    //   style={{ width: '100%' }}
    //   dropdownStyle={{ maxHeight: 500 }}
    //   showSearch={false}
    //   treeNodeFilterProp={'label'}
    //   treeNodeLabelProp={'label'}
    //   {...itemProps}
    // />
    _react["default"].createElement(_vtxZtreeSelect["default"], _extends({}, itemProps, {
      data: data,
      style: {
        width: '100%'
      },
      onChange: function onChange(_ref) {
        var nodes = _ref.nodes,
          keys = _ref.keys,
          leafKeys = _ref.leafKeys,
          names = _ref.names;
        var result = '';
        if (itemProps.multiple || itemProps.treeCheckable) {
          result = keys;
        } else {
          result = keys[0];
        }
        _onChange2 && _onChange2(result, {
          nodes: nodes,
          keys: keys,
          leafKeys: leafKeys,
          names: names
        });
      }
    }))
  );
};

// 渲染级联
var useRenderCascade = exports.useRenderCascade = function useRenderCascade(props) {
  var _props$itemProps23 = props.itemProps,
    itemProps = _props$itemProps23 === void 0 ? {} : _props$itemProps23;
  return /*#__PURE__*/_react["default"].createElement(_cascader["default"], itemProps);
};

// 图片上传
var useRenderImgUpload = exports.useRenderImgUpload = function useRenderImgUpload(props) {
  var parentForm = props.parentForm;
  var setFieldsValue = parentForm.setFieldsValue;
  var uploadImg = (0, _react.useRef)();
  var _useState = (0, _react.useState)([]),
    _useState2 = _slicedToArray(_useState, 2),
    imgList = _useState2[0],
    setImgList = _useState2[1];
  var _useState3 = (0, _react.useState)(false),
    _useState4 = _slicedToArray(_useState3, 2),
    previewVisible = _useState4[0],
    setVisible = _useState4[1];
  var _useState5 = (0, _react.useState)({
      previewList: [],
      previewIndex: 0
    }),
    _useState6 = _slicedToArray(_useState5, 2),
    previewConfig = _useState6[0],
    setConfig = _useState6[1];
  var _props$itemProps24 = props.itemProps,
    itemProps = _props$itemProps24 === void 0 ? {} : _props$itemProps24,
    _props$uploadConfig = props.uploadConfig,
    uploadConfig = _props$uploadConfig === void 0 ? {} : _props$uploadConfig,
    disabled = props.disabled,
    _props$initialValue = props.initialValue,
    initialValue = _props$initialValue === void 0 ? null : _props$initialValue,
    onChange = props.onChange,
    paramName = props.paramName,
    formData = props.formData;
  (0, _react.useEffect)(function () {
    if (initialValue && initialValue.length > 0) {
      var _initialValue = [];
      initialValue.map(function (v, vI) {
        _initialValue.push({
          uid: v.id || v,
          id: v.id || v,
          name: v.name || v.fileName || "image".concat(vI, ".png"),
          status: 'done',
          url: "".concat(_config["default"].fileViewUrl, "/").concat(v.id || v, "?openmode=inline&token=").concat(_PublicService["default"].getToken())
        });
      });
      setImgList(_initialValue);
    }
  }, [initialValue]);
  (0, _react.useEffect)(function () {
    setFieldsValue && setFieldsValue(_defineProperty({}, paramName, imgList));
  }, [imgList]);
  var list = imgList;
  var _itemProps = itemProps,
    maxSize = _itemProps.maxSize,
    _itemProps$maxLength = _itemProps.maxLength,
    maxLength = _itemProps$maxLength === void 0 ? 5 : _itemProps$maxLength,
    type = _itemProps.type,
    inline = _itemProps.inline;
  disabled = disabled || inline;
  var _accept = type && type.map(function (item) {
    return _mime["default"][item];
  }) || null;
  var vertic = {
    maxSize: maxSize,
    type: type,
    accept: _accept
  };
  function handleChange(_ref2) {
    var fileList = _ref2.fileList,
      file = _ref2.file;
    if (fileList !== null && fileList !== void 0 && fileList.length) {
      fileList.map(function (item) {
        var _item$response = item.response,
          response = _item$response === void 0 ? {} : _item$response;
        if (String(response === null || response === void 0 ? void 0 : response.result) === '0' && response.data) {
          item.id = response.data[0].id;
          item.uid = response.data[0].id;
          item.name = response.data[0].name || response.data[0].fileName;
          item.url = "".concat(_config["default"].fileViewUrl, "/").concat(response.data[0].id, "?openmode=inline&token=").concat(_PublicService["default"].getToken());
        }
      });
    }
    setImgList(fileList);
    onChange && onChange(file);
  }
  function handlePreview(file) {
    var _uploadImg$current$fi = uploadImg.current.fileList,
      fileList = _uploadImg$current$fi === void 0 ? [] : _uploadImg$current$fi;
    var index = fileList.findIndex(function (i) {
      return i.url === file.url;
    });
    setVisible(true);
    previewConfig.previewIndex = index;
    previewConfig.previewList = _PublicService["default"].getDataByKey(fileList, 'url');
    setConfig(_objectSpread({}, previewConfig));
  }
  function onRemove(val) {
    var _formData$paramName;
    var imgList = list.filter(function (item) {
      return item.id !== val.id;
    });
    setImgList(imgList);
    if ((_formData$paramName = formData[paramName]) !== null && _formData$paramName !== void 0 && _formData$paramName.length) {
      formData[paramName] = formData[paramName].filter(function (item) {
        return item.id !== val.id;
      });
    }
    onChange && onChange(val);
  }
  if (maxLength && list.length >= maxLength || disabled || inline) {
    itemProps = _objectSpread(_objectSpread({}, itemProps), {}, {
      className: classnames('imgUploadDis')
    });
  }
  // if (
  //   (maxLength && list.length > maxLength) ||
  //   disabled ||
  //   inline ||
  //   formData?.[paramName]?.length >= maxLength
  // ) {

  // }

  var _previewConfig$previe = previewConfig.previewList,
    previewList = _previewConfig$previe === void 0 ? [] : _previewConfig$previe,
    previewIndex = previewConfig.previewIndex;
  return /*#__PURE__*/_react["default"].createElement(_upload["default"], _extends({
    ref: uploadImg,
    action: _accept && String(_accept) || 'image/*',
    listType: "picture-card",
    onChange: handleChange,
    beforeUpload: function beforeUpload(file) {
      return verticalFile(file, vertic);
    },
    onPreview: handlePreview,
    onRemove: onRemove,
    showUploadList: {
      showPreviewIcon: true,
      showRemoveIcon: disabled ? false : true,
      showDownloadIcon: false
    }
  }, itemProps, uploadConfig, {
    fileList: imgList
  }), /*#__PURE__*/_react["default"].createElement(_PlusOutlined["default"], null), /*#__PURE__*/_react["default"].createElement("div", {
    onClick: function onClick(e) {
      return e.stopPropagation();
    }
  }, previewVisible && /*#__PURE__*/_react["default"].createElement(_ModalPictureGallery["default"], {
    width: document.body.clientWidth - 200,
    visible: previewVisible,
    pictures: previewList,
    currentIndex: previewIndex,
    onCancel: function onCancel() {
      return setVisible(false);
    }
  })));
};
var renderUploadButton = exports.renderUploadButton = function renderUploadButton(disabled, mesg) {
  if (!disabled) {
    return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_button["default"], {
      disabled: disabled
    }, /*#__PURE__*/_react["default"].createElement(_UploadOutlined["default"], null), " \u4E0A\u4F20"), /*#__PURE__*/_react["default"].createElement("span", {
      style: {
        fontSize: 12,
        color: '#999',
        paddingLeft: 10
      }
    }, mesg));
  }
};
var useRenderFileUpload = exports.useRenderFileUpload = function useRenderFileUpload(props) {
  var parentForm = props.parentForm;
  var setFieldsValue = parentForm.setFieldsValue;
  var _useState7 = (0, _react.useState)([]),
    _useState8 = _slicedToArray(_useState7, 2),
    fileList = _useState8[0],
    setFileList = _useState8[1];
  var _props$itemProps25 = props.itemProps,
    itemProps = _props$itemProps25 === void 0 ? {} : _props$itemProps25,
    _props$uploadConfig2 = props.uploadConfig,
    uploadConfig = _props$uploadConfig2 === void 0 ? {} : _props$uploadConfig2,
    disabled = props.disabled,
    paramName = props.paramName,
    _props$initialValue2 = props.initialValue,
    initialValue = _props$initialValue2 === void 0 ? [] : _props$initialValue2;
  var _itemProps2 = itemProps,
    _itemProps2$maxLength = _itemProps2.maxLength,
    maxLength = _itemProps2$maxLength === void 0 ? 5 : _itemProps2$maxLength,
    _itemProps2$maxSize = _itemProps2.maxSize,
    maxSize = _itemProps2$maxSize === void 0 ? 0 : _itemProps2$maxSize,
    _itemProps2$mesg = _itemProps2.mesg,
    mesg = _itemProps2$mesg === void 0 ? '' : _itemProps2$mesg,
    type = _itemProps2.type,
    itemDisabled = _itemProps2.disabled,
    inline = _itemProps2.inline,
    handleFlies = _itemProps2.handleFlies;
  (0, _react.useEffect)(function () {
    if (initialValue && initialValue.length > 0) {
      var _initialValue = [];
      initialValue.map(function (v, vI) {
        _initialValue.push({
          uid: v.id || v,
          id: v.id || v,
          name: v.name || v.fileName || "file".concat(vI),
          status: 'done',
          url: "".concat(_config["default"].fileViewUrl, "/").concat(v.id || v, "?openmode=attachment&token=").concat(_PublicService["default"].getToken())
        });
      });
      setFileList(_initialValue);
    }
  }, [initialValue]);
  (0, _react.useEffect)(function () {
    setFieldsValue && setFieldsValue(_defineProperty({}, paramName, fileList));
    if (fileList && fileList.length) {
      handleFlies && handleFlies(fileList);
    }
  }, [fileList]);
  var list = fileList;
  disabled = itemDisabled || disabled || inline;
  function handleChange(info) {
    var _info$fileList;
    if ((_info$fileList = info.fileList) !== null && _info$fileList !== void 0 && _info$fileList.length) {
      info.fileList.map(function (item) {
        var _item$response2 = item.response,
          response = _item$response2 === void 0 ? {} : _item$response2;
        if (String(response === null || response === void 0 ? void 0 : response.result) === '0' && response.data) {
          item.id = response.data[0].id;
          item.uid = response.data[0].id;
          item.name = response.data[0].name || response.data[0].fileName;
          item.url = "".concat(_config["default"].fileViewUrl, "/").concat(response.data[0].id, "?openmode=attachment&token=").concat(_PublicService["default"].getToken());
        }
      });
    }
    setFileList(info.fileList);
  }
  var _accept = type && type.flat(Infinity).map(function (item) {
    return _mime["default"][item];
  }) || null;
  var vertic = {
    maxSize: maxSize,
    type: type,
    accept: _accept
  };
  if (maxLength && list.length >= maxLength || disabled || inline) {
    itemProps = _objectSpread(_objectSpread({}, itemProps), {}, {
      openFileDialogOnClick: false,
      className: classnames('imgUploadDis')
    });
  }
  function onDownLoad(file) {
    if (file) {
      var x = new XMLHttpRequest();
      x.open('GET', "".concat(_config["default"].fileViewUrl, "/").concat(file.id, "?openmode=attachment&token=").concat(_PublicService["default"].getToken()), true);
      x.responseType = 'blob';
      x.onload = function (e) {
        var url = window.URL.createObjectURL(x.response);
        var a = document.createElement('a');
        a.href = url;
        a.download = file.name;
        a.click();
      };
      x.send();
    } else {
      _message["default"].error('缺少文件地址');
    }
  }
  return /*#__PURE__*/_react["default"].createElement(_upload["default"], _extends({
    maxLength: maxLength,
    accept: _accept && String(_accept) || '*',
    beforeUpload: function beforeUpload(file) {
      return verticalFile(file, vertic);
    },
    onChange: handleChange,
    onError: function onError(e) {
      return console.log(e);
    }
    //onRemove={onRemove}
    ,
    showUploadList: {
      showRemoveIcon: !disabled
    },
    onPreview: function onPreview(file) {
      onDownLoad(file);
    }
  }, itemProps, uploadConfig, {
    fileList: fileList
  }), maxLength && maxLength > list.length && renderUploadButton(disabled, mesg));
};
var useRenderVideoUpload = exports.useRenderVideoUpload = function useRenderVideoUpload(props) {
  var parentForm = props.parentForm;
  var setFieldsValue = parentForm.setFieldsValue;
  var _useState9 = (0, _react.useState)([]),
    _useState10 = _slicedToArray(_useState9, 2),
    videoList = _useState10[0],
    setVideoList = _useState10[1];
  var _useState11 = (0, _react.useState)({
      previewVideoVisible: false,
      previewVideo: ''
    }),
    _useState12 = _slicedToArray(_useState11, 2),
    previewConfig = _useState12[0],
    setConfig = _useState12[1];
  var _props$itemProps26 = props.itemProps,
    itemProps = _props$itemProps26 === void 0 ? {} : _props$itemProps26,
    _props$uploadConfig3 = props.uploadConfig,
    uploadConfig = _props$uploadConfig3 === void 0 ? {} : _props$uploadConfig3,
    disabled = props.disabled,
    paramName = props.paramName,
    _props$initialValue3 = props.initialValue,
    initialValue = _props$initialValue3 === void 0 ? [] : _props$initialValue3;
  var _itemProps3 = itemProps,
    _itemProps3$maxLength = _itemProps3.maxLength,
    maxLength = _itemProps3$maxLength === void 0 ? 5 : _itemProps3$maxLength,
    _itemProps3$maxSize = _itemProps3.maxSize,
    maxSize = _itemProps3$maxSize === void 0 ? 0 : _itemProps3$maxSize,
    type = _itemProps3.type,
    itemDisabled = _itemProps3.disabled,
    inline = _itemProps3.inline;
  (0, _react.useEffect)(function () {
    if (initialValue && initialValue.length > 0) {
      var _initialValue = [];
      initialValue.map(function (v) {
        _initialValue.push({
          uid: v.id,
          id: v.id,
          name: v.name,
          status: 'done',
          url: "".concat(_config["default"].videoViewUrl, "/").concat(v.id)
        });
      });
      setVideoList(_initialValue);
    }
  }, [initialValue]);
  (0, _react.useEffect)(function () {
    setFieldsValue && setFieldsValue(_defineProperty({}, paramName, videoList));
  }, [videoList]);
  var list = videoList;
  disabled = itemDisabled || disabled || inline;
  var vertic = {
    maxSize: maxSize,
    type: type
  };
  var _accept = type && type.map(function (item) {
    return _mime["default"][item];
  }) || null;
  function handleChange(info) {
    setVideoList(info.fileList);
  }
  function onPreview(file) {
    var _file$response = file.response,
      response = _file$response === void 0 ? {} : _file$response;
    if (response.data && response.data.length) {
      var downloadPath = response.data[0].downloadPath;
      previewConfig.previewVideoVisible = true;
      previewConfig.previewVideo = downloadPath;
      setConfig(_objectSpread({}, previewConfig));
    } else if (file && file.url) {
      previewConfig.previewVideoVisible = true;
      previewConfig.previewVideo = file.url;
      setConfig(_objectSpread({}, previewConfig));
    }
  }
  function onRemove(val) {
    var videoList = list.filter(function (item) {
      return item.id !== val.id;
    });
    setVideoList(videoList);
  }
  if (maxLength && list.length || disabled) {
    itemProps = _objectSpread(_objectSpread({}, itemProps), {}, {
      openFileDialogOnClick: false,
      className: classnames('imgUploadDis')
    });
  }
  var previewVideoVisible = previewConfig.previewVideoVisible,
    previewVideo = previewConfig.previewVideo;
  return /*#__PURE__*/_react["default"].createElement(_upload["default"], _extends({
    accept: _accept && String(_accept) || 'video/*',
    beforeUpload: function beforeUpload(file) {
      return verticalFile(file, vertic);
    },
    onChange: handleChange,
    onPreview: onPreview,
    onRemove: onRemove
  }, itemProps, uploadConfig, {
    fileList: videoList
  }), renderUploadButton(disabled), /*#__PURE__*/_react["default"].createElement(_modal["default"], {
    width: 700,
    visible: previewVideoVisible,
    footer: null,
    destroyOnClose: true,
    onCancel: function onCancel(e) {
      e.stopPropagation();
      previewConfig.previewVideoVisible = false;
      setConfig(_objectSpread({}, previewConfig));
    }
  }, /*#__PURE__*/_react["default"].createElement("video", {
    autoPlay: true,
    controls: true,
    src: previewVideo,
    style: {
      width: '100%',
      height: 400
    }
  })));
};
var useRenderVoiceUpload = exports.useRenderVoiceUpload = function useRenderVoiceUpload(props) {
  var _this = this;
  var _useState13 = (0, _react.useState)(null),
    _useState14 = _slicedToArray(_useState13, 2),
    voiceList = _useState14[0],
    setVoiceList = _useState14[1];
  var _useState15 = (0, _react.useState)({
      previewVoiceVisible: false,
      previewVoice: ''
    }),
    _useState16 = _slicedToArray(_useState15, 2),
    previewConfig = _useState16[0],
    setConfig = _useState16[1];
  var _props$itemProps27 = props.itemProps,
    itemProps = _props$itemProps27 === void 0 ? {} : _props$itemProps27,
    disabled = props.disabled,
    _props$initialValue4 = props.initialValue,
    initialValue = _props$initialValue4 === void 0 ? [] : _props$initialValue4;
  var list = voiceList || initialValue;
  var _itemProps4 = itemProps,
    maxLength = _itemProps4.maxLength,
    maxSize = _itemProps4.maxSize,
    type = _itemProps4.type;
  var vertic = {
    maxSize: maxSize,
    type: type
  };
  var _accept = type && type.map(function (item) {
    return _mime["default"][item];
  }) || null;
  if (maxLength && list.length >= maxLength || disabled) {
    itemProps = _objectSpread(_objectSpread({}, itemProps), {}, {
      openFileDialogOnClick: false,
      className: classnames('imgUploadDis')
    });
  }
  function handleChange(info) {
    setVoiceList(info.fileList);
  }
  function onPreview(file) {
    var _file$response2 = file.response,
      response = _file$response2 === void 0 ? {} : _file$response2;
    if (response.ret) {
      var _response$ret = response.ret,
        seaWeedfsMasterUrl = _response$ret.seaWeedfsMasterUrl,
        fid = _response$ret.fid;
      var local_url = "".concat(seaWeedfsMasterUrl).concat(fid);
      previewConfig.previewVoiceVisible = true;
      previewConfig.previewVoice = file.picurl || file.url || local_url;
      setConfig(_objectSpread({}, previewConfig));
    }
  }
  function onRemove(val) {
    var audioList = list.filter(function (item) {
      return item.id !== val.id;
    });
    setVoiceList(audioList);
  }
  var previewVoiceVisible = previewConfig.previewVoiceVisible,
    previewVoice = previewConfig.previewVoice;
  return /*#__PURE__*/_react["default"].createElement(_upload["default"], {
    name: "multipartFile",
    accept: _accept && String(_accept) || 'audio/*',
    beforeUpload: function beforeUpload(file) {
      return verticalFile(file, vertic);
    },
    onChange: handleChange,
    onPreview: onPreview,
    onRemove: onRemove
  }, renderUploadButton(disabled), /*#__PURE__*/_react["default"].createElement(_modal["default"], {
    height: 300,
    visible: previewVoiceVisible,
    footer: null,
    destroyOnClose: true,
    onCancel: function onCancel(e) {
      e.stopPropagation();
      return _this.setState({
        previewVoiceVisible: false
      });
    }
  }, /*#__PURE__*/_react["default"].createElement("audio", {
    controls: true,
    style: {
      width: '100%',
      height: 45,
      margin: '30px 0px'
    },
    controlsList: "nodownload"
  }, /*#__PURE__*/_react["default"].createElement("source", {
    src: previewVoice,
    type: "audio/mpeg"
  }), "\u60A8\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 audio \u6807\u7B7E\u3002")));
};
var useRenderVacancy = exports.useRenderVacancy = function useRenderVacancy(props) {
  return props.content;
};

// 渲染伏泰上传组件
/**
  * 变更点:
    默认验证文件大小不能超过 5M，否则无法上传
    添加上传最大文件数量，达到时隐藏上传按钮
    添加查看模式
    添加单文件和多文件模式
    添加文件和视频预览
    保存数据在原来 id,name 的基础上添加 type 字段，否则预览会有问题
  * 文件预览兼容性:
      目前只支持PDF,EXCEL,WORD
  * 视频预览兼容性:
    PC Web 端支持直接播放 mp4 视频，播放 HLS、FLV、MPEG-DASH 需要浏览器支持 Media Source Extensions
    iOS 系统 Web 场景支持直接播放 mp4 和 HLS，不支持播放 FLV、MPEG-DASH
    安卓系统 Web 场景支持直接播放 mp4 和 HLS，播放 FLV、MPEG-DASH 需要浏览器支持 Media Source Extensions
  -------
    isDragger = false, //是否拖拽模式
    draggerConfig = {}, //拖动配置
    accept, //接受上传的文件类型
    mode = 'multiple', //单文件模式or多文件模式
    viewMode, //是否查看模式（隐藏上传按钮）
    showUploadList, //是否展示文件列表
    customizedButton, //自定义上传文字描述
    listType = 'text', //上传列表的样式
    onSuccess, //上传成功
    onError, //上传失败
    onRemove, //删除
    maxFileSize = 5 * 1024 * 1024, //文件大小限制，默认最大5M
    beforeUpload, //上传前回调
    maxNum, //最多上传的文件数量
    flag, //同步数据标记
*/
var useRenderVtxUpload = exports.useRenderVtxUpload = function useRenderVtxUpload(props) {
  var _form$current;
  var _props$itemProps28 = props.itemProps,
    itemProps = _props$itemProps28 === void 0 ? {} : _props$itemProps28,
    _props$uploadConfig4 = props.uploadConfig,
    uploadConfig = _props$uploadConfig4 === void 0 ? {} : _props$uploadConfig4,
    _props$initialValue5 = props.initialValue,
    initialValue = _props$initialValue5 === void 0 ? [] : _props$initialValue5,
    paramName = props.paramName,
    parentForm = props.parentForm,
    form = props.form;
  var _ref3 = parentForm || (form === null || form === void 0 || (_form$current = form.current) === null || _form$current === void 0 || (_form$current = _form$current.myForm) === null || _form$current === void 0 || (_form$current = _form$current.current) === null || _form$current === void 0 ? void 0 : _form$current.form),
    setFieldsValue = _ref3.setFieldsValue;
  var maxSize = itemProps.maxSize,
    _itemProps$maxLength2 = itemProps.maxLength,
    maxLength = _itemProps$maxLength2 === void 0 ? 5 : _itemProps$maxLength2,
    type = itemProps.type,
    disabled = itemProps.disabled,
    inline = itemProps.inline,
    _itemProps$isDragger = itemProps.isDragger,
    isDragger = _itemProps$isDragger === void 0 ? false : _itemProps$isDragger,
    _itemProps$listType = itemProps.listType,
    listType = _itemProps$listType === void 0 ? 'picture-card' : _itemProps$listType,
    _itemProps$fileType = itemProps.fileType,
    fileType = _itemProps$fileType === void 0 ? 'image/*' : _itemProps$fileType,
    _itemProps$draggerCon = itemProps.draggerConfig,
    draggerConfig = _itemProps$draggerCon === void 0 ? {} : _itemProps$draggerCon;
  var _useState17 = (0, _react.useState)([]),
    _useState18 = _slicedToArray(_useState17, 2),
    fileList = _useState18[0],
    setFileList = _useState18[1];
  var _useState19 = (0, _react.useState)(1),
    _useState20 = _slicedToArray(_useState19, 2),
    flag = _useState20[0],
    setFlag = _useState20[1];
  (0, _react.useEffect)(function () {
    if (initialValue && initialValue.length > 0) {
      var _initialValue = [];
      initialValue.map(function (v, vI) {
        var id = v.cloudFileId || v.id || v;
        var uid = v.id || v;
        var url = "".concat(_config["default"].fileViewUrl, "/").concat(id, "?openmode=inline&token=").concat(_PublicService["default"].getToken());
        var name = v.name || v.fileName || "image-".concat(vI);
        var fileType = 'image/*';

        // 文件地址
        if (listType !== 'picture' && listType !== 'picture-card') {
          url = "".concat(_config["default"].fileViewUrl, "/").concat(id, "?openmode=attachment&token=").concat(_PublicService["default"].getToken());
          name = v.name || v.fileName || "file-".concat(vI);
          fileType = 'application/*';
        }
        _initialValue.push({
          uid: uid,
          id: id,
          cloudFileId: v.cloudFileId || v.id || v,
          name: name,
          url: url,
          type: fileType
        });
      });
      setFileList(_initialValue);
      setFlag(flag + 1);
    }
  }, [initialValue]);
  (0, _react.useEffect)(function () {
    setFieldsValue && setFieldsValue(_defineProperty({}, paramName, fileList));
  }, [fileList]);
  var useThumbnail = itemProps.useThumbnail && (listType === 'picture' || listType === 'picture-card');
  var _accept = type && type.map(function (item) {
    return _mime["default"][item];
  }) || null;
  var vertic = {
    maxSize: maxSize,
    type: type,
    accept: _accept
  };
  var _draggerConfig = _objectSpread({
    img: '',
    mainText: '',
    subText: ''
  }, draggerConfig);
  var params = _objectSpread(_objectSpread({
    fileList: fileList,
    action: _accept && String(_accept) || 'image/*',
    isDragger: isDragger,
    draggerConfig: _draggerConfig,
    listType: listType,
    // picture-card: 图片、text: 文件/视频并预览
    beforeUpload: function beforeUpload(file) {
      return verticalFile(file, vertic);
    },
    onSuccess: function onSuccess(file) {
      var _file$response3 = file.response,
        response = _file$response3 === void 0 ? {} : _file$response3;
      var fileItem = {
        id: file.id,
        name: file.name,
        type: file.type
      };
      if (String(response === null || response === void 0 ? void 0 : response.result) === '0' && response.data) {
        fileItem.id = response.data[0].id;
        fileItem.cloudFileId = response.data[0].id;
        fileItem.uid = response.data[0].id;
        fileItem.name = response.data[0].fileName;
        fileItem.url = "".concat(_config["default"].fileViewUrl, "/").concat(response.data[0].id, "?openmode=inline&token=").concat(_PublicService["default"].getToken());
        // 文件地址
        if (listType !== 'picture' && listType !== 'picture-card') {
          fileItem.url = "".concat(_config["default"].fileViewUrl, "/").concat(response.data[0].id, "?openmode=attachment&token=").concat(_PublicService["default"].getToken());
        }
      }
      var result = [].concat(_toConsumableArray(fileList), [fileItem]);
      setFileList(result);
    },
    onError: function onError(e) {
      console.log(e);
    },
    onRemove: function onRemove(file) {
      var arr = fileList.filter(function (item) {
        return item.id !== file.id;
      });
      setFileList(arr);
    },
    maxNum: props.disabled ? fileList.length : maxLength,
    maxFileSize: maxSize,
    disabled: disabled || inline,
    showUploadList: {
      showRemoveIcon: !disabled
    },
    viewMode: disabled || props.disabled,
    useThumbnail: useThumbnail,
    flag: flag
  }, itemProps), uploadConfig);
  return /*#__PURE__*/_react["default"].createElement(_vtxUpload["default"], params);
};

// 渲染地址选择
var useRenderMapLocation = exports.useRenderMapLocation = function useRenderMapLocation(props) {
  var _useState21 = (0, _react.useState)({}),
    _useState22 = _slicedToArray(_useState21, 2),
    geometryVal = _useState22[0],
    setGeometryVal = _useState22[1];
  var _useState23 = (0, _react.useState)(undefined),
    _useState24 = _slicedToArray(_useState23, 2),
    location = _useState24[0],
    setLocation = _useState24[1];
  var _useState25 = (0, _react.useState)(false),
    _useState26 = _slicedToArray(_useState25, 2),
    mapLocationShow = _useState26[0],
    setMapLocationShow = _useState26[1];
  var size = props.size,
    lonlatParamName = props.lonlatParamName,
    lonlatPlaceholder = props.lonlatPlaceholder,
    paramName = props.paramName,
    initialValue = props.initialValue,
    _props$itemProps29 = props.itemProps,
    itemProps = _props$itemProps29 === void 0 ? {} : _props$itemProps29,
    _props$parentForm2 = props.parentForm,
    parentForm = _props$parentForm2 === void 0 ? {} : _props$parentForm2,
    showType = props.showType,
    _props$buttonLabel = props.buttonLabel,
    buttonLabel = _props$buttonLabel === void 0 ? '去地图' : _props$buttonLabel,
    _props$drawType = props.drawType,
    drawType = _props$drawType === void 0 ? 'Point' : _props$drawType,
    _props$mapTitle = props.mapTitle,
    mapTitle = _props$mapTitle === void 0 ? '点位选择' : _props$mapTitle,
    _props$searchShow = props.searchShow,
    searchShow = _props$searchShow === void 0 ? true : _props$searchShow,
    showAddress = props.showAddress,
    defaultValue = props.defaultValue;
  var disabled = itemProps.disabled || props.disabled;
  var setFieldsValue = parentForm.setFieldsValue,
    getFieldValue = parentForm.getFieldValue;
  (0, _react.useEffect)(function () {
    var _ref4 = defaultValue && defaultValue.split(',') || getFieldValue && getFieldValue("".concat(paramName)) && getFieldValue("".concat(paramName)).split(',') || [],
      _ref5 = _slicedToArray(_ref4, 2),
      lon = _ref5[0],
      lat = _ref5[1];
    geometryVal.location = {
      lat: Number(lat),
      lon: Number(lon)
    };
    setLocation(defaultValue);
    setFieldsValue && setFieldsValue(_defineProperty({}, paramName, "".concat(lon, ",").concat(lat)));
  }, [defaultValue]);
  var onShowLocation = function onShowLocation() {
    if (drawType === 'Point') {
      if (geometryVal.location && geometryVal.location.lon && geometryVal.location.lat) {
        setMapLocationShow(true);
      } else {
        var _ref6 = initialValue && initialValue.split(',') || getFieldValue && getFieldValue("".concat(paramName)) && getFieldValue("".concat(paramName)).split(',') || [],
          _ref7 = _slicedToArray(_ref6, 2),
          lon = _ref7[0],
          lat = _ref7[1];
        geometryVal.location = {
          lat: Number(lat),
          lon: Number(lon)
        };
        setMapLocationShow(true);
        setGeometryVal(_objectSpread({}, geometryVal));
      }
    } else {
      // 面绘制回显
      if (geometryVal !== null && geometryVal !== void 0 && geometryVal.length) {
        setMapLocationShow(true);
      } else {
        var _geometryVal = [];
        var geometryData = initialValue && initialValue.split(';') || getFieldValue && getFieldValue("".concat(paramName)) && getFieldValue("".concat(paramName)).split(';') || [];
        geometryData && geometryData.length && geometryData.map(function (item) {
          var points = item.split(',') || [];
          if (points !== null && points !== void 0 && points.length && (points === null || points === void 0 ? void 0 : points[0]) != 'undefined' && (points === null || points === void 0 ? void 0 : points[1]) != 'undefined') {
            _geometryVal.push([Number(points === null || points === void 0 ? void 0 : points[0]), Number(points === null || points === void 0 ? void 0 : points[1])]);
          }
        });
        setGeometryVal(_geometryVal && _geometryVal.length ? [_geometryVal] : {});
        setMapLocationShow(true);
      }
    }
  };
  var getGeometry = function getGeometry(val) {
    if (val && val.location) {
      var _val$location = val.location,
        lat = _val$location.lat,
        lon = _val$location.lon;
      if (showAddress) {
        // MapService.lonLatSearch({ lon, lat })
        //   .then(data => {
        //     const address = data?.formatted_address || undefined;
        //     setFieldsValue({ [showAddress]: address });
        //   })
        //   .catch(() => '');
      }
      setFieldsValue(_defineProperty({}, paramName, "".concat(lon, ",").concat(lat)));
      setLocation("".concat(lon, ",").concat(lat));
      setGeometryVal(_objectSpread({}, val));
    } else if (val && drawType !== 'Point') {
      var lonlats = handlePoints(val);
      setFieldsValue(_defineProperty({}, paramName, "".concat(lonlats)));
      setGeometryVal(val);
    }
  };

  // 整理面数据
  var handlePoints = function handlePoints(val) {
    var poitnStr = '';
    if (val && val.length) {
      poitnStr = val === null || val === void 0 ? void 0 : val[0].join(';');
    }
    return poitnStr;
  };
  var gemoetryInputChange = function gemoetryInputChange() {
    var val = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
    if (!val) {
      setGeometryVal({});
      setLocation(undefined);
      return;
    }
    var geometryInfo = val.indexOf(',') !== -1 && val.split(',') || [];
    var _geometryInfo = _slicedToArray(geometryInfo, 2),
      lon = _geometryInfo[0],
      lat = _geometryInfo[1];
    if (geometryInfo && (!geometryInfo.length || geometryInfo.length > 2) || !Number(lat) || !Number(lon)) {
      _message["default"].warning('请填写正确格式经纬度信息！例如：119.000439,29.071891');
      return;
    }
    geometryVal.location = {
      lon: Number(lon),
      lat: Number(lat)
    };
    setGeometryVal(_objectSpread({}, geometryVal));
  };
  return /*#__PURE__*/_react["default"].createElement(_input["default"].Group, {
    compact: true
  }, showType === 'button' ? /*#__PURE__*/_react["default"].createElement(_button["default"], {
    disabled: disabled,
    type: "primary",
    onClick: onShowLocation
  }, buttonLabel) : null, /*#__PURE__*/_react["default"].createElement(_input["default"], _extends({
    disabled: disabled,
    size: size,
    value: location,
    style: showType === 'button' ? {
      opacity: 0,
      width: '0px'
    } : {},
    addonBefore: !disabled && /*#__PURE__*/_react["default"].createElement(_MyIcon["default"], {
      title: '选取地址',
      style: {
        cursor: 'pointer',
        fontSize: 20,
        color: '#3997f7'
      },
      type: 'icon-public-zuobiaoshiqu',
      onClick: onShowLocation
    })
  }, itemProps, {
    onChange: function onChange(e) {
      return gemoetryInputChange(e.target.value);
    }
  })), lonlatParamName && /*#__PURE__*/_react["default"].createElement(_input["default"], _extends({
    size: size,
    style: {
      width: 180
    },
    disabled: disabled
  }, itemProps, {
    placeholder: lonlatPlaceholder
  })));
};
// 渲染关联管点
var useRenderPointMap = exports.useRenderPointMap = function useRenderPointMap(props) {
  var _useState27 = (0, _react.useState)(''),
    _useState28 = _slicedToArray(_useState27, 2),
    feature = _useState28[0],
    setFeature = _useState28[1];
  var _useState29 = (0, _react.useState)(false),
    _useState30 = _slicedToArray(_useState29, 2),
    mapLocationShow = _useState30[0],
    setMapLocationShow = _useState30[1];
  var _props$itemProps30 = props.itemProps,
    itemProps = _props$itemProps30 === void 0 ? {} : _props$itemProps30,
    initialValue = props.initialValue;
  var _itemProps$options4 = itemProps.options,
    options = _itemProps$options4 === void 0 ? [] : _itemProps$options4,
    pointType = itemProps.pointType,
    params = itemProps.params;
  var disabled = itemProps.disabled || props.disabled;
  var onShowLocation = function onShowLocation() {
    setMapLocationShow(true);
  };
  return /*#__PURE__*/_react["default"].createElement(_input["default"].Group, {
    compact: true
  }, !disabled && /*#__PURE__*/_react["default"].createElement(_MyIcon["default"], {
    title: '选择管点',
    style: {
      cursor: 'pointer',
      fontSize: 20,
      color: '#3997f7',
      position: 'absolute',
      zIndex: 999
    },
    type: 'icon-public-zuobiaoshiqu',
    onClick: onShowLocation
  }), /*#__PURE__*/_react["default"].createElement(_vtxSelect["default"], {
    style: disabled ? {} : {
      paddingLeft: 20
    },
    onChange: function onChange(e) {
      setFeature(e);
      itemProps.onPointChange && itemProps.onPointChange(e);
    },
    value: feature || initialValue
  }, (options === null || options === void 0 ? void 0 : options.length) > 0 && options.map(function (option) {
    return /*#__PURE__*/_react["default"].createElement(_vtxSelect["default"].Option, {
      key: option.value,
      value: option.value,
      title: option.label
    }, option.label);
  })));
};
var FORM = exports.FORM = {
  blank: useRenderBlank,
  // 自定义
  input: useRenderInput,
  // 输入框
  textArea: useRenderTextArea,
  // 多行输入
  number: useRenderNumber,
  // 数值
  radio: useRenderRadio,
  // 单选
  checkbox: useRenderCheckBox,
  // 多选
  rate: useRenderRate,
  // 打分
  "switch": useRenderSwitch,
  // 开关
  slider: useRenderSlider,
  // 开关
  timePicker: useRenderTime,
  // 时间选择器
  rangePickerTime: useRenderRangePickerTime,
  // 时间段选择器

  datePicker: useRenderDatePicker,
  // 日期选择器
  weekPicker: useRenderWeekPicker,
  // 星期选择器
  monthPicker: useRenderMonthPicker,
  // 月选择器
  quarterPicker: useRenderQuarterPicker,
  // 月选择器
  yearPicker: useRenderYearPicker,
  // 年选择器

  rangePicker: useRenderRangePicker,
  // 时间段选择器
  rangeWeekPicker: useRenderRangeWeekPicker,
  // 时间段选择器
  rangeMonthPicker: useRenderRangeMonthPicker,
  // 月区间选择器
  rangeQuarterPicker: useRenderRangeQuarterPicker,
  // 月区间选择器
  rangeYearPicker: useRenderRangeYearPicker,
  // 月区间选择器
  select: useRenderSelect,
  // 下拉选
  treeSelect: useRenderTreeSelect,
  // 树下拉
  cascade: useRenderCascade,
  // 级联下拉
  imgUpload: useRenderImgUpload,
  // 图片上传
  fileUpload: useRenderFileUpload,
  // 文件上传
  videoUpload: useRenderVideoUpload,
  // 视频上传
  voiceUpload: useRenderVoiceUpload,
  // 语音上传
  vacancy: useRenderVacancy,
  // 占位
  vtxUpload: useRenderVtxUpload // vtx上传
};
var CUSTOM_FORM = {
  mapLocation: useRenderMapLocation,
  // 地图打点器
  pointMap: useRenderPointMap // 地图关联管点
};
var selectMode = function selectMode(formData, itemProps, paramName) {
  var itemNames = [],
    item = [];
  if (formData && formData[paramName] && formData[paramName].length) formData[paramName].map(function (val) {
    var _item$;
    item = itemProps.options.filter(function (item) {
      return String(item.value) === String(val);
    });
    itemNames.push((_item$ = item[0]) === null || _item$ === void 0 ? void 0 : _item$.label);
  });
  itemNames = itemNames.join(',');
  return itemNames;
};
function recursionGet(setValues, valueId) {
  var value = [];
  for (var index = 0; index < setValues.length; index += 1) {
    if (setValues[index].value === valueId || valueId instanceof Array && valueId.length && valueId.includes(setValues[index].value)) {
      value.push(setValues[index].label);
    }
    if (setValues[index].children instanceof Array && setValues[index].children.length > 0) {
      var text = recursionGet(setValues[index].children, valueId);
      if (text) return text;
    }
  }
  return value.join('，');
}
function transformItem(_ref8) {
  var Item = _ref8.Item,
    formItemLayout = _ref8.formItemLayout,
    disabled = _ref8.disabled,
    itemProps = _ref8.itemProps,
    formData = _ref8.formData,
    type = _ref8.type,
    paramName = _ref8.paramName;
  var formItem = Item;
  if (!['imgUpload', 'fileUpload', 'videoUpload', 'voiceUpload', 'vtxUpload'].includes(type)) {
    if (disabled || formItemLayout.inline) {
      if (['select', 'switch', 'radio'].includes(type)) {
        if (itemProps !== null && itemProps !== void 0 && itemProps.showInitialValue) {
          formItem = itemProps.showInitialValue;
        } else if (itemProps !== null && itemProps !== void 0 && itemProps.options && itemProps.options.length) {
          if (_typeof(formData[paramName]) == 'object') {
            var itemNames = selectMode(formData, itemProps, paramName);
            formItem = itemNames;
          } else {
            var _item$2;
            var item = itemProps.options.filter(function (item) {
              return String(item.value) === String(formData[paramName]);
            });
            formItem = ((_item$2 = item[0]) === null || _item$2 === void 0 ? void 0 : _item$2.label) || formData['formulaCode'];
          }
        } else {
          formItem = formData[paramName];
        }
      } else if (['treeSelect'].includes(type)) {
        if (itemProps !== null && itemProps !== void 0 && itemProps.showInitialValue) {
          formItem = itemProps.showInitialValue;
        } else if (itemProps !== null && itemProps !== void 0 && itemProps.treeData && itemProps.treeData.length) {
          formItem = recursionGet(itemProps.treeData, formData[paramName]);
        }
      } else if (['editor'].includes(type)) {
        if (formData[paramName] && (0, _lodash.isObject)(formData[paramName])) {
          var htmlStr = formData[paramName].toHTML();
          formItem = /*#__PURE__*/_react["default"].createElement("div", {
            className: classnames('editorDiv'),
            dangerouslySetInnerHTML: {
              __html: htmlStr
            }
          });
        } else {
          formItem = /*#__PURE__*/_react["default"].createElement("div", {
            className: classnames('editorDiv'),
            dangerouslySetInnerHTML: {
              __html: formData[paramName]
            }
          });
        }
      } else if (['mapLocation'].includes(type)) {
        // 地图查询
        var drawType = (itemProps === null || itemProps === void 0 ? void 0 : itemProps.drawType) || 'Point';
        var geometryInfo = {},
          geometryData = [],
          _geometryData = [];
        if (drawType === 'Point') {
          var _geometryInfo2;
          geometryInfo = formData === null || formData === void 0 ? void 0 : formData.geometryInfo;
          geometryData = (_geometryInfo2 = geometryInfo) === null || _geometryInfo2 === void 0 || (_geometryInfo2 = _geometryInfo2.lngLats) === null || _geometryInfo2 === void 0 ? void 0 : _geometryInfo2.split(',');
          if (geometryData && geometryData.length) {
            var _geometryData2, _geometryData3;
            _geometryData = [Number((_geometryData2 = geometryData) === null || _geometryData2 === void 0 ? void 0 : _geometryData2[0]), Number((_geometryData3 = geometryData) === null || _geometryData3 === void 0 ? void 0 : _geometryData3[1])];
          }
        } else {
          var _geometryInfo3;
          geometryInfo = formData === null || formData === void 0 ? void 0 : formData.geometryAreaInfo;
          geometryData = (_geometryInfo3 = geometryInfo) === null || _geometryInfo3 === void 0 ? void 0 : _geometryInfo3.split(';');
          if (geometryData && geometryData.length) {
            geometryData.map(function (val) {
              var points = (val === null || val === void 0 ? void 0 : val.split(',')) || [];
              if (points && points.length) {
                _geometryData.push([Number(points === null || points === void 0 ? void 0 : points[0]), Number(points === null || points === void 0 ? void 0 : points[1])]);
              }
            });
          }
        }

        // formItem = (
        //   <GeometryDraw
        //     key={String(geometryData)}
        //     drawType={drawType}
        //     height={200}
        //     maxLength={1}
        //     disabled={true}
        //     searchShow={false}
        //     geometryData={drawType === 'Point' ? _geometryData : [_geometryData]}
        //   />
        // );
      } else if (!['vacancy'].includes(type)) {
        formItem = (formItemLayout === null || formItemLayout === void 0 ? void 0 : formItemLayout.initialValue) || formData && formData[paramName];
      }
    }
  }
  return {
    Item: formItem || '--',
    formItemLayout: formItemLayout
  };
}
function _default(props) {
  var _newProps$type;
  var formWrap = props.formWrap,
    type = props.type,
    paramName = props.paramName,
    label = props.label,
    rules = props.rules,
    required = props.required,
    weights = props.weights,
    _props$formItemLayout = props.formItemLayout,
    formItemLayout = _props$formItemLayout === void 0 ? {} : _props$formItemLayout,
    disabled = props.disabled,
    itemProps = props.itemProps,
    _props$formData = props.formData,
    formData = _props$formData === void 0 ? {} : _props$formData,
    _props$tooltip = props.tooltip,
    tooltip = _props$tooltip === void 0 ? '' : _props$tooltip;
  var _rules = _toConsumableArray(rules || []);
  var _formItemLayout = formItemLayout,
    initialValue = _formItemLayout.initialValue;
  var token = _PublicService["default"].getToken();
  if (required) {
    _rules.push(_config["default"].reg.required);
  }
  var uploadConfig = {
    name: 'file',
    action: '/zuul/cloudFile/common/uploadFile',
    downloadUrl: '/cloudFile/common/downloadFile?id=',
    headers: {
      Authorization: "Bearer ".concat(token)
    }
  };
  var newProps = _objectSpread(_objectSpread({}, props), {}, {
    uploadConfig: uploadConfig,
    initialValue: initialValue
  });
  if ((newProps === null || newProps === void 0 || (_newProps$type = newProps.type) === null || _newProps$type === void 0 ? void 0 : _newProps$type.indexOf('rangePicker')) === -1) {
    // 选择型控件
    var text = ['timePicker', 'datePicker', 'yearPicker', 'monthPicker', 'select', 'treeSelect', 'cascade'].includes(type) ? '请选择' : '请输入';
    newProps.itemProps = _objectSpread({
      placeholder: "".concat(text).concat(newProps.label)
    }, newProps.itemProps);
  }
  var Item = CUSTOM_FORM[type] ? CUSTOM_FORM[type] : FORM[type];
  var result = transformItem({
    Item: Item,
    initialValue: initialValue,
    formItemLayout: formItemLayout,
    disabled: disabled,
    itemProps: itemProps,
    formData: formData,
    type: type,
    paramName: paramName
  });
  Item = result.Item;
  formItemLayout = result.formItemLayout;
  if (disabled || formItemLayout.inline) {
    formItemLayout.required = false;
    label = label ? /*#__PURE__*/_react["default"].createElement("span", null, label, "\uFF1A") : '';
  }
  if (type === 'checkbox' && itemProps && !itemProps.group || type === 'switch') {
    formItemLayout.valuePropName = 'checked';
  }
  if (['imgUpload', 'fileUpload', 'videoUpload', 'voiceUpload'].includes(type)) {
    // formItemLayout.valuePropName = 'fileList';
    formItemLayout.getValueFromEvent = function (_ref9) {
      var fileList = _ref9.fileList;
      var list = [];
      fileList.map(function (file) {
        var fileItem = _objectSpread({}, file);
        if (file.response && file.response.data) {
          var _file$response$data = file.response.data,
            id = _file$response$data.id,
            fileUrl = _file$response$data.fileUrl;
          fileItem.id = id;
          fileItem.url = fileUrl;
        }
        list.push(fileItem);
      });
      return list;
    };
  }
  if (['treeSelect'].includes(type)) {
    formItemLayout.getValueFromEvent = function (_ref10) {
      var keys = _ref10.keys;
      if (itemProps.multiple || itemProps.treeCheckable) {
        return keys;
      }
      return keys[0];
    };
  }
  if (disabled && ['mapLocation'].includes(type)) {
    weights = 3;
  }
  var Wrap = formWrap === 'Vtx' ? _vtxFormLayout["default"].FormItem : Form.Item;
  return /*#__PURE__*/_react["default"].createElement(Wrap, _extends({
    name: paramName,
    label: label,
    rules: _rules,
    tooltip: tooltip,
    weights: weights
  }, formItemLayout), disabled && !['imgUpload', 'fileUpload', 'videoUpload', 'voiceUpload', 'vtxUpload'].includes(type) ? Item : Item(newProps));
}
//# sourceMappingURL=index.js.map
