"use strict";
((typeof self !== 'undefined' ? self : this)["webpackChunklib"] = (typeof self !== 'undefined' ? self : this)["webpackChunklib"] || []).push([[896],{

/***/ 1462:
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7658);
/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _utils_eventbus__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6587);
/* harmony import */ var _utils_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7623);
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3288);
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(ramda__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8180);





const baseMixin = {
  data() {
    return {
      updateValue: 0,
      widgetId: "widget-" + Math.random().toString(15).slice(2, 15)
    };
  },
  mixins: [_utils_common__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z],
  props: {
    field: {
      type: Object,
      default: () => ({})
    },
    schema: {
      type: Object,
      default: () => ({})
    },
    values: {
      type: Object,
      default: () => ({})
    },
    colors: {
      type: Object,
      default: () => ({})
    },
    fieldErrors: {
      type: Object,
      default: () => ({})
    },
    hideFields: {
      type: Object,
      default: () => ({})
    },
    isDark: {
      type: Boolean,
      default: false
    },
    form: {
      type: Object,
      default: () => ({})
    }
  },
  inject: ["formId", "dependencies", "regExpFields", "isDeepValues", "flatFields", "context"],
  computed: {
    value: {
      get() {
        this.updateValue++; // 强制更新
        let friendValue = {
          value: this.isDeepValues ? this.deepPick(this.field.name.split("."), this.values) : this.friendValue()
        };
        return friendValue.value;
      },
      set(value) {
        let emitValue = this.beforeChange(value);
        this.changeValue(emitValue);
      }
    }
  },
  created() {
    this.load();
  },
  methods: {
    actionEmit(type, arg) {
      if (arg) {
        let msg = {
          type,
          arg
        };
        _utils_eventbus__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.$emit(`${this.formId}:action`, msg);
      }
    },
    load() {
      this.setFieldAttr();
      this.pickHideFields();
      this.pickDependencies();
      this.pickRegExp();
      this.loadCompleteDispatch();
      this.pickFlatField();
    },
    pickFlatField() {
      if (!this.field.name) return;
      this.flatFields[this.field.name] = this.field;
    },
    loadCompleteDispatch() {
      // 隐藏字段需要立马派发，不然视觉体验不友好
      for (let key in this.hideFields) this.dispatchHide(key);
      // 等所有字段都渲染完成在派发options依赖
      if (this.context.loadDebounce) clearTimeout(this.context.loadDebounce);
      this.context.loadDebounce = setTimeout(() => {
        for (let key in this.dependencies) this.dispatchOptions(key);
        this.context.loadCompleted = true;
      }, 500);
    },
    setFieldAttr() {
      const defaultFieldAttr = this.defaultFieldAttr();
      let fieldAttr = (0,ramda__WEBPACK_IMPORTED_MODULE_3__.mergeDeepRight)(defaultFieldAttr, this.field);
      for (const [key, value] of Object.entries(fieldAttr)) this.field[key] = value;
    },
    defaultFieldAttr() {
      return {};
    },
    beforeChange(value) {
      return this.schema.type == "number" ? parseFloat(value) ? parseFloat(value) : value : value;
    },
    changeValue(value) {
      this.updateValue++;
      this.$emit('changeValue', this.field.name, this.schema, value, this.field);
    },
    friendValue() {
      // 做一些友好值处理
      let friendValue = null;
      let value = this.values[this.field.name];
      try {
        switch (this.schema.type) {
          case "array":
            friendValue = Array.isArray(value) ? value : (0,_utils__WEBPACK_IMPORTED_MODULE_4__/* .strToObj */ .Vq)(value);
            break;
          case "number":
            friendValue = (0,ramda__WEBPACK_IMPORTED_MODULE_3__.type)(value) == "Number" ? value : parseFloat(value);
            break;
          case "datetime":
            friendValue = new Date(value);
            break;
          case "boolean":
            friendValue = (0,ramda__WEBPACK_IMPORTED_MODULE_3__.type)(value) == "Boolean" ? value : value ? Boolean(value) : false;
            break;
          case "integer":
            friendValue = (0,ramda__WEBPACK_IMPORTED_MODULE_3__.type)(value) == "Number" ? value : value ? parseInt(value) : value;
            break;
        }
        if (friendValue) this.values[this.field.name] = friendValue; // 有友好值，需要更新
      } catch (e) {
        console.error(`转换友好值错了：${e}`);
      }
      return friendValue || value;
    },
    // 字段依赖隐藏
    pickHideFields() {
      const hideRely = this.field.hideRely;
      if (!hideRely) return; // 若不存在依赖，则无需收集
      const hideFields = Array.isArray(hideRely) ? hideRely : (0,ramda__WEBPACK_IMPORTED_MODULE_3__.type)(hideRely) == "String" ? [hideRely] : [];
      hideFields.map(hideItem => {
        let splitHideExp = hideItem.split("==");
        if (splitHideExp.length != 2) return;
        let relyKey = splitHideExp[0].trim();
        let relyValue = splitHideExp[1].trim();
        if (!this.hideFields[relyKey]) this.hideFields[relyKey] = [];
        // 必须全部遍历，以应对依赖先后关系
        for (let key in this.hideFields) {
          // 已存在则不需要重新收集
          let hasExit = this.hideFields[key].find(item => {
            if (item.key == relyKey && item.value == relyValue && item.name == this.field.name) {
              // 必须重新赋值，因为form的地址已经变了
              item.field = this.field;
              return true;
            }
          });
          if (hasExit) return;
        }
        this.hideFields[relyKey].push({
          name: this.field.name,
          key: relyKey,
          value: relyValue,
          field: this.field
        });
      });
    },
    // 收集依赖关系
    async pickDependencies() {
      if (!this.field.hasOwnProperty("dict") || this.field.length == 0) return;
      if (typeof this.field.dict == "string" && (0,_utils__WEBPACK_IMPORTED_MODULE_4__/* .isUrl */ .CB)(this.field.dict)) {
        // dict字段是url则直接获取数据，并赋值给options     
        const {
          method,
          respProp,
          params,
          pickValues
        } = this.field.dictConfig;
        pickValues.map(key => {
          if (this.values[key] != undefined) params[key] = this.values[key];
        });
        const response = await (0,_utils__WEBPACK_IMPORTED_MODULE_4__/* .axios */ .od)(this.field.dict, params, method);
        const options = this.deepPick(respProp.split("."), response);
        if (Array.isArray(options) && options.length > 0) this.field.options = options;
        if (this.field.defaultOption >= 0 && this.field.options.length > 0) {
          let option = options[this.field.defaultOption];
          this.values[this.field.name] = typeof option == "object" ? option[this.field.defaultProp.value] : option;
        }
      } else if (Object.keys(this.field.dict).length > 0) {
        for (let key in this.field.dict) {
          let dictItem = this.field.dict[key];
          let dictKeyVal = key.split("==");
          let relyKey = dictKeyVal[0].trim();
          let relyValue = dictKeyVal[1].trim();
          // 赋值初始值
          if (!this.dependencies[relyKey]) this.dependencies[relyKey] = [];
          // 已存在就无需重复添加
          let hasExit = this.dependencies[relyKey].find(item => {
            if (item.keyValue == relyValue && item.name == this.field.name) {
              // 必须重新赋值，因为form的地址已经变了
              item.field = this.field;
              return true;
            }
          });
          if (!hasExit) {
            this.dependencies[relyKey].push({
              name: this.field.name,
              beRelyKey: relyKey,
              keyValue: relyValue,
              dictValue: dictItem,
              field: this.field,
              type: this.schema.type,
              options: JSON.parse(JSON.stringify(this.field.options))
            });
          }
        }
      }
    },
    // 收集表达式依赖
    pickRegExp() {
      const regExp = this.field.regExp;
      if (!regExp) return;
      regExp.map(regItem => {
        const {
          relyName
        } = regItem;
        if (!this.regExpFields[relyName]) this.regExpFields[relyName] = [];
        if (this.regExpFields[relyName].find(item => item.childrenName == this.field.name && item.relyName == regItem.relyName)) return; // 确保只收取一个表达式，
        // 正式收集
        this.regExpFields[relyName].push({
          ...regItem,
          childrenName: this.field.name,
          field: this.field
        });
      });
    }
  }
};
/* harmony default export */ __webpack_exports__.Z = (baseMixin);

/***/ }),

/***/ 2896:
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// EXPORTS
__webpack_require__.d(__webpack_exports__, {
  "default": function() { return /* binding */ tree; }
});

// EXTERNAL MODULE: external "vue"
var external_vue_ = __webpack_require__(748);
;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js!./node_modules/ts-loader/index.js??clonedRuleSet-86.use[2]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[4]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/Richform/src/widgets/tree.vue?vue&type=template&id=75f3ed9d&ts=true

const _hoisted_1 = ["id"];
const _hoisted_2 = ["data", "onDblclick"];
const _hoisted_3 = {
  key: 0
};
const _hoisted_4 = ["id"];
const _hoisted_5 = {
  class: "tools"
};
const _hoisted_6 = {
  key: 0,
  class: "field-label"
};
const _hoisted_7 = {
  class: "dialog-footer"
};
function render(_ctx, _cache, $props, $setup, $data, $options) {
  const _component_ElInput = (0,external_vue_.resolveComponent)("ElInput");
  const _component_CirclePlus = (0,external_vue_.resolveComponent)("CirclePlus");
  const _component_ElIcon = (0,external_vue_.resolveComponent)("ElIcon");
  const _component_ElTooltip = (0,external_vue_.resolveComponent)("ElTooltip");
  const _component_Plus = (0,external_vue_.resolveComponent)("Plus");
  const _component_Edit = (0,external_vue_.resolveComponent)("Edit");
  const _component_Delete = (0,external_vue_.resolveComponent)("Delete");
  const _component_ElTree = (0,external_vue_.resolveComponent)("ElTree");
  const _component_ElButton = (0,external_vue_.resolveComponent)("ElButton");
  const _component_XModal = (0,external_vue_.resolveComponent)("XModal");
  return (0,external_vue_.openBlock)(), (0,external_vue_.createElementBlock)("div", {
    class: "perfect-tree-wrapper",
    id: _ctx.widgetId,
    style: (0,external_vue_.normalizeStyle)({
      '--theme': _ctx.field.theme
    })
  }, [_ctx.field.isShowSearch ? ((0,external_vue_.openBlock)(), (0,external_vue_.createBlock)(_component_ElInput, {
    key: 0,
    placeholder: "输入关键字进行过滤",
    modelValue: $data.filterText,
    "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => $data.filterText = $event)
  }, null, 8, ["modelValue"])) : (0,external_vue_.createCommentVNode)("", true), _ctx.field.showAddTemplate ? ((0,external_vue_.openBlock)(), (0,external_vue_.createBlock)(_component_ElInput, {
    key: 1,
    size: "default",
    placeholder: "新增模板",
    type: "textarea",
    modelValue: _ctx.field.template,
    "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => _ctx.field.template = $event)
  }, null, 8, ["modelValue"])) : (0,external_vue_.createCommentVNode)("", true), (0,external_vue_.createVNode)(_component_ElTree, {
    data: $options.treeValue,
    "node-key": _ctx.field.nodeKey,
    "default-expand-all": _ctx.field.isExpandAll,
    "expand-on-click-node": false,
    "filter-node-method": $options.filterNode,
    draggable: _ctx.field.draggable,
    "show-checkbox": _ctx.field.isShowCheckbox,
    "default-checked-keys": $options.defaultCheckedKeys,
    onCheckChange: $options.onCheckedNode,
    onNodeClick: $options.onNodeClick
  }, {
    default: (0,external_vue_.withCtx)(({
      node,
      data
    }) => [(0,external_vue_.createElementVNode)("span", {
      class: (0,external_vue_.normalizeClass)(['perfect-tree-node', `perfect-tree-node_${data[_ctx.field.nodeKey]}`]),
      data: data[_ctx.field.nodeKey],
      onDblclick: $event => $options.editNodeTitle(data, node, $event)
    }, [(0,external_vue_.createElementVNode)("div", {
      class: (0,external_vue_.normalizeClass)(['title-wrapper', $options.onActiveNode(data) ? 'active-node' : ''])
    }, [_ctx.field.isShowIcon ? ((0,external_vue_.openBlock)(), (0,external_vue_.createElementBlock)("span", _hoisted_3, [node.childNodes.length > 0 ? ((0,external_vue_.openBlock)(), (0,external_vue_.createElementBlock)("i", {
      key: 0,
      class: (0,external_vue_.normalizeClass)([node.expanded ? _ctx.field.expandIcon : _ctx.field.narrowIcon])
    }, null, 2)) : ((0,external_vue_.openBlock)(), (0,external_vue_.createElementBlock)("i", {
      key: 1,
      class: (0,external_vue_.normalizeClass)(['node-icon', _ctx.field.leafIcon])
    }, null, 2))])) : (0,external_vue_.createCommentVNode)("", true), (0,external_vue_.createElementVNode)("span", {
      class: "title",
      ref: 'perfect-tree-node-input_' + data[_ctx.field.nodeKey],
      id: 'perfect-tree-node-input_' + data[_ctx.field.nodeKey]
    }, (0,external_vue_.toDisplayString)(data.label || data[_ctx.field.defaultProps.label]), 9, _hoisted_4)], 2), (0,external_vue_.createElementVNode)("span", _hoisted_5, [node.level == 1 && _ctx.field.addSibling ? ((0,external_vue_.openBlock)(), (0,external_vue_.createBlock)(_component_ElTooltip, {
      key: 0,
      "popper-class": "perfect-tree-tool-tip",
      "open-delay": 200,
      content: "添加兄弟点",
      enterable: false,
      placement: "top-end",
      effect: "light"
    }, {
      default: (0,external_vue_.withCtx)(() => [(0,external_vue_.createVNode)(_component_ElIcon, {
        onClick: _cache[2] || (_cache[2] = $event => $options.addSibling()),
        class: "tool-item"
      }, {
        default: (0,external_vue_.withCtx)(() => [(0,external_vue_.createVNode)(_component_CirclePlus)]),
        _: 1
      })]),
      _: 1
    })) : (0,external_vue_.createCommentVNode)("", true), _ctx.field.addable ? ((0,external_vue_.openBlock)(), (0,external_vue_.createBlock)(_component_ElTooltip, {
      key: 1,
      "popper-class": "perfect-tree-tool-tip",
      "open-delay": 200,
      content: "添加",
      enterable: false,
      placement: "top-end",
      effect: "light"
    }, {
      default: (0,external_vue_.withCtx)(() => [(0,external_vue_.createVNode)(_component_ElIcon, {
        onClick: $event => $options.addNodeModal(data, node),
        class: "tool-item"
      }, {
        default: (0,external_vue_.withCtx)(() => [(0,external_vue_.createVNode)(_component_Plus)]),
        _: 2
      }, 1032, ["onClick"])]),
      _: 2
    }, 1024)) : (0,external_vue_.createCommentVNode)("", true), _ctx.field.editable ? ((0,external_vue_.openBlock)(), (0,external_vue_.createBlock)(_component_ElTooltip, {
      key: 2,
      "popper-class": "perfect-tree-tool-tip",
      "open-delay": 200,
      content: "编辑",
      enterable: false,
      placement: "top-end",
      effect: "light"
    }, {
      default: (0,external_vue_.withCtx)(() => [(0,external_vue_.createVNode)(_component_ElIcon, {
        onClick: $event => $options.editNodeModal(data, node, $event),
        class: "tool-item"
      }, {
        default: (0,external_vue_.withCtx)(() => [(0,external_vue_.createVNode)(_component_Edit)]),
        _: 2
      }, 1032, ["onClick"])]),
      _: 2
    }, 1024)) : (0,external_vue_.createCommentVNode)("", true), _ctx.field.deletable ? ((0,external_vue_.openBlock)(), (0,external_vue_.createBlock)(_component_ElTooltip, {
      key: 3,
      "popper-class": "perfect-tree-tool-tip",
      "open-delay": 200,
      content: "删除",
      enterable: false,
      placement: "top-end",
      effect: "light"
    }, {
      default: (0,external_vue_.withCtx)(() => [(0,external_vue_.createVNode)(_component_ElIcon, {
        onClick: $event => $options.onRemoveNode(data, node),
        class: "tool-item"
      }, {
        default: (0,external_vue_.withCtx)(() => [(0,external_vue_.createVNode)(_component_Delete)]),
        _: 2
      }, 1032, ["onClick"])]),
      _: 2
    }, 1024)) : (0,external_vue_.createCommentVNode)("", true)])], 42, _hoisted_2)]),
    _: 1
  }, 8, ["data", "node-key", "default-expand-all", "filter-node-method", "draggable", "show-checkbox", "default-checked-keys", "onCheckChange", "onNodeClick"]), (0,external_vue_.createVNode)(_component_XModal, {
    modelValue: $data.isModal,
    "onUpdate:modelValue": _cache[4] || (_cache[4] = $event => $data.isModal = $event),
    showFooter: true,
    title: $data.modalTitle,
    resize: "",
    width: 600,
    zIndex: 90
  }, {
    footer: (0,external_vue_.withCtx)(() => [(0,external_vue_.createElementVNode)("span", _hoisted_7, [(0,external_vue_.createVNode)(_component_ElButton, {
      onClick: _cache[3] || (_cache[3] = $event => $data.isModal = false),
      size: "default"
    }, {
      default: (0,external_vue_.withCtx)(() => [(0,external_vue_.createTextVNode)("取 消")]),
      _: 1
    }), (0,external_vue_.createVNode)(_component_ElButton, {
      type: "primary",
      size: "default",
      onClick: $options.onSureBtn
    }, {
      default: (0,external_vue_.withCtx)(() => [(0,external_vue_.createTextVNode)("确 定")]),
      _: 1
    }, 8, ["onClick"])])]),
    default: (0,external_vue_.withCtx)(() => [((0,external_vue_.openBlock)(true), (0,external_vue_.createElementBlock)(external_vue_.Fragment, null, (0,external_vue_.renderList)(Object.keys($data.template), (key, index) => {
      return (0,external_vue_.openBlock)(), (0,external_vue_.createElementBlock)("div", {
        key: index,
        class: "field-row"
      }, [key != 'children' ? ((0,external_vue_.openBlock)(), (0,external_vue_.createElementBlock)("label", _hoisted_6, (0,external_vue_.toDisplayString)(key) + ":", 1)) : (0,external_vue_.createCommentVNode)("", true), key != 'children' ? ((0,external_vue_.openBlock)(), (0,external_vue_.createBlock)(_component_ElInput, {
        key: 1,
        size: "default",
        modelValue: $data.template[key],
        "onUpdate:modelValue": $event => $data.template[key] = $event,
        required: ""
      }, null, 8, ["modelValue", "onUpdate:modelValue"])) : (0,external_vue_.createCommentVNode)("", true)]);
    }), 128))]),
    _: 1
  }, 8, ["modelValue", "title"])], 12, _hoisted_1);
}
;// CONCATENATED MODULE: ./src/components/Richform/src/widgets/tree.vue?vue&type=template&id=75f3ed9d&ts=true

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js
var es_array_push = __webpack_require__(7658);
// EXTERNAL MODULE: ./node_modules/vxy-table/dist/xtable.common.js
var xtable_common = __webpack_require__(6720);
// EXTERNAL MODULE: ./src/components/Richform/src/widgets/baseMixin.ts
var baseMixin = __webpack_require__(1462);
// EXTERNAL MODULE: ./node_modules/@element-plus/icons-vue/dist/index.js
var dist = __webpack_require__(5781);
// EXTERNAL MODULE: external "element-plus"
var external_element_plus_ = __webpack_require__(5224);
;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js!./node_modules/ts-loader/index.js??clonedRuleSet-86.use[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/Richform/src/widgets/tree.vue?vue&type=script&lang=ts





/* harmony default export */ var treevue_type_script_lang_ts = ({
  mixins: [baseMixin/* default */.Z],
  components: {
    XModal: xtable_common.XModal,
    ElInput: external_element_plus_.ElInput,
    ElButton: external_element_plus_.ElButton,
    ElTree: external_element_plus_.ElTree,
    ElTooltip: external_element_plus_.ElTooltip,
    ElIcon: external_element_plus_.ElIcon,
    CirclePlus: dist.CirclePlus,
    Plus: dist.Plus,
    Edit: dist.Edit,
    Delete: dist.Delete
  },
  methods: {
    defaultFieldAttr() {
      return {
        options: [],
        nodeKey: "id",
        defaultProps: {
          // 字段对应关系
          label: "label",
          value: "value"
        },
        isExpandAll: true,
        isShowCheckbox: false,
        checkedKeys: [],
        onlyCheckedKeys: false,
        isShowSearch: false,
        isShowIcon: true,
        onlyClickLeaf: true,
        editable: false,
        deletable: false,
        addable: false,
        draggable: false,
        addSibling: false,
        theme: "#409eff",
        expandIcon: "el-icon-folder-opened",
        narrowIcon: "el-icon-folder",
        leafIcon: "el-icon-document",
        template: `{ "id": null, "label": "", "value": ""}`,
        showAddTemplate: false,
        defaultCheckedKeys: [] // 默认勾选的值
      };
    },

    onActiveNode(data) {
      if (this.field.isShowCheckbox || this.field.options.length == 0) return false;else if (data[this.field.nodeKey] == this.value) return true;
      return false;
    },
    editNodeTitle() {},
    // 点击节点，即单选时使用
    onNodeClick(data) {
      if (this.field.isShowCheckbox || this.field.options.length == 0) return;
      this.changeValue(data[this.field.nodeKey]);
    },
    onCheckedNode() {
      // 当是多选框时，返回id
      // 方法一： https://www.cnblogs.com/qing619/p/8144584.html
      // 方法二： https://www.bilibili.com/read/cv5259145/
      const treeRef = this.$refs["pefectTree"];
      let getCheckedKeys = treeRef.getCheckedKeys();
      if (!this.field.onlyCheckedKeys) {
        let getHalfCheckedKeys = treeRef.getHalfCheckedKeys();
        getHalfCheckedKeys.map(item => {
          if (!getCheckedKeys.includes(item)) getCheckedKeys.push(item);
        });
      }
      this.changeValue(getCheckedKeys);
    },
    filterNode(value, data) {
      if (!value) return true;
      return data[this.field.defaultProps.label].indexOf(value) !== -1;
    },
    onRemoveNode(data, node) {
      if (this.treeValue.length == 1) return;
      external_element_plus_.ElMessageBox.confirm("此操作将永久删除节点, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        const parent = node.parent;
        const children = parent.data.children || parent.data;
        const index = children.findIndex(item => item[this.field.nodeKey] === data[this.field.nodeKey]);
        children.splice(index, 1);
      }).catch(() => {});
    },
    onSureBtn() {
      switch (this.modalType) {
        case "add":
          this.addNode();
          break;
        case "edit":
          this.editNode();
          break;
        case "addSibling":
          this.addSiblingNode();
          break;
      }
    },
    uuid() {
      return Math.random().toString(16).slice(2, 12);
    },
    addNodeModal(data, node) {
      this.isModal = true;
      this.modalTitle = "新增";
      this.modalType = "add";
      this.clickNode = {
        data,
        node
      };
      this.template = JSON.parse(this.field.template);
      this.template[this.field.nodeKey] = this.uuid();
    },
    addNode() {
      let {
        data,
        node
      } = this.clickNode;
      if (!data.children) {
        data.children = [];
      }
      data.children.push(this.template);
      this.isModal = false;
    },
    editNodeModal(data, node) {
      this.isModal = true;
      this.modalTitle = "编辑";
      this.modalType = "edit";
      this.clickNode = {
        data,
        node
      };
      this.template = JSON.parse(JSON.stringify(data));
    },
    editNode() {
      for (let key in this.template) {
        this.clickNode.data[key] = this.template[key];
      }
      this.isModal = false;
    },
    addSibling() {
      this.isModal = true;
      this.dialogEditModel = false;
      this.modalTitle = "新增兄弟节点";
      this.modalType = "addSibling";
      this.values.pid = 0;
      this.template = JSON.parse(this.field.template);
      this.template[this.field.nodeKey] = Math.random().toString(16).slice(2, 12);
    },
    addSiblingNode() {
      this.treeValue.push(this.template);
      this.isModal = false;
    }
  },
  data() {
    return {
      isModal: false,
      modalTitle: "",
      modalType: "",
      clickNode: {},
      template: {},
      filterText: "",
      activeNode: "" // 
    };
  },

  watch: {
    checkedKeys() {
      this.$refs.pefectTree.setCheckedKeys(this.checkedKeys);
    },
    filterText(val) {
      this.$refs.pefectTree.filter(val);
    }
  },
  computed: {
    treeValue() {
      let {
        label,
        value
      } = this.field.defaultProps;
      return this.field.options.length > 0 ? this.field.options : Array.isArray(this.value) ? this.value : [{
        [this.field.nodeKey]: this.uuid(),
        [label]: this.value,
        [value]: this.value
      }];
    },
    defaultCheckedKeys() {
      let defaultCheckedKeys = [];
      if (Array.isArray(this.value)) {
        defaultCheckedKeys = defaultCheckedKeys.concat(this.value);
      }
      defaultCheckedKeys = defaultCheckedKeys.concat(this.field.defaultCheckedKeys);
      return defaultCheckedKeys;
    }
  }
});
;// CONCATENATED MODULE: ./src/components/Richform/src/widgets/tree.vue?vue&type=script&lang=ts
 
;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-67.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-67.use[1]!./node_modules/vue-loader/dist/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-67.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-67.use[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/Richform/src/widgets/tree.vue?vue&type=style&index=0&id=75f3ed9d&lang=scss
// extracted by mini-css-extract-plugin

;// CONCATENATED MODULE: ./src/components/Richform/src/widgets/tree.vue?vue&type=style&index=0&id=75f3ed9d&lang=scss

// EXTERNAL MODULE: ./node_modules/vue-loader/dist/exportHelper.js
var exportHelper = __webpack_require__(3744);
;// CONCATENATED MODULE: ./src/components/Richform/src/widgets/tree.vue




;


const __exports__ = /*#__PURE__*/(0,exportHelper/* default */.Z)(treevue_type_script_lang_ts, [['render',render]])

/* harmony default export */ var tree = (__exports__);

/***/ })

}]);