/******/ (function() { // webpackBootstrap
/******/ 	"use strict";
/******/ 	// The require scope
/******/ 	var __webpack_require__ = {};
/******/ 	
/************************************************************************/
/******/ 	/* webpack/runtime/compat get default export */
/******/ 	!function() {
/******/ 		// getDefaultExport function for compatibility with non-harmony modules
/******/ 		__webpack_require__.n = function(module) {
/******/ 			var getter = module && module.__esModule ?
/******/ 				function() { return module['default']; } :
/******/ 				function() { return module; };
/******/ 			__webpack_require__.d(getter, { a: getter });
/******/ 			return getter;
/******/ 		};
/******/ 	}();
/******/ 	
/******/ 	/* webpack/runtime/define property getters */
/******/ 	!function() {
/******/ 		// define getter functions for harmony exports
/******/ 		__webpack_require__.d = function(exports, definition) {
/******/ 			for(var key in definition) {
/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ 				}
/******/ 			}
/******/ 		};
/******/ 	}();
/******/ 	
/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
/******/ 	!function() {
/******/ 		__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
/******/ 	}();
/******/ 	
/******/ 	/* webpack/runtime/make namespace object */
/******/ 	!function() {
/******/ 		// define __esModule on exports
/******/ 		__webpack_require__.r = function(exports) {
/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 			}
/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
/******/ 		};
/******/ 	}();
/******/ 	
/************************************************************************/
var __webpack_exports__ = {};
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

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

;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./packages/candidate/src/main.vue?vue&type=template&id=62833212&
var render = function render() {
  var _vm = this,
    _c = _vm._self._c;
  return _c("div", {
    staticClass: "jdf-candidate"
  }, [_c("div", {
    staticClass: "tree-content"
  }, [_vm.showTodo || !_vm.showRead ? [_c("single-tree", {
    ref: "todo",
    class: _vm.showRead ? "width-half" : "width-full",
    attrs: {
      id: "todo",
      "tree-data": _vm.todoTree,
      "tree-title": _vm.showPathName ? _vm.todoHandler.nextNodeName : "",
      "tree-class": _vm.treeClass,
      "show-checkbox": _vm.showCheckbox,
      "highlight-current": _vm.highlightCurrent,
      "choose-type": _vm.todoChooseType,
      "disable-check": _vm.todoDisableCheck,
      async: _vm.todoHandler.async,
      "async-key": _vm.todoHandler.asyncKey,
      search: _vm.search,
      "default-checked-keys": _vm.todoDefaultCheckedKeys,
      "default-expanded-keys": _vm.todoDefaultExpandedKeys,
      transfer: _vm.transfer,
      "multiple-select-remove-left": _vm.multipleSelectRemoveLeft,
      "expand-level": _vm.todoHandler.expandLevel
    },
    on: {
      customNodeCheck: _vm.customNodeCheck
    },
    model: {
      value: _vm.selectedTodoList,
      callback: function callback($$v) {
        _vm.selectedTodoList = $$v;
      },
      expression: "selectedTodoList"
    }
  })] : _vm._e(), _vm.showRead ? [_c("single-tree", {
    ref: "toread",
    staticClass: "read-tree-area",
    class: _vm.showTodo ? "width-half" : "width-full",
    attrs: {
      id: "toread",
      "tree-class": "".concat(_vm.treeClass, "-read"),
      "tree-data": _vm.toreadTree,
      "tree-title": _vm.showPathName ? _vm.toreadCandidateTitle : "",
      "show-checkbox": _vm.showCheckbox,
      "highlight-current": _vm.highlightCurrent,
      "choose-type": _vm.toreadChooseType,
      "disable-check": _vm.toreadDisableCheck,
      async: _vm.readHandler.async,
      "async-key": _vm.readHandler.asyncKey,
      search: _vm.search,
      "default-checked-keys": _vm.readDefaultCheckedKeys,
      "default-expanded-keys": _vm.toreadDefaultExpandedKeys,
      transfer: _vm.transfer,
      "multiple-select-remove-left": _vm.multipleSelectRemoveLeft,
      "expand-level": _vm.readHandler.expandLevel
    },
    model: {
      value: _vm.selectedReadList,
      callback: function callback($$v) {
        _vm.selectedReadList = $$v;
      },
      expression: "selectedReadList"
    }
  })] : _vm._e()], 2)]);
};
var staticRenderFns = [];
render._withStripped = true;

;// CONCATENATED MODULE: ./packages/candidate/src/main.vue?vue&type=template&id=62833212&

;// CONCATENATED MODULE: external "@babel/runtime/helpers/defineProperty"
var defineProperty_namespaceObject = require("@babel/runtime/helpers/defineProperty");
var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty_namespaceObject);
;// CONCATENATED MODULE: external "@babel/runtime/helpers/toConsumableArray"
var toConsumableArray_namespaceObject = require("@babel/runtime/helpers/toConsumableArray");
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray_namespaceObject);
;// CONCATENATED MODULE: external "lodash/cloneDeep"
var cloneDeep_namespaceObject = require("lodash/cloneDeep");
var cloneDeep_default = /*#__PURE__*/__webpack_require__.n(cloneDeep_namespaceObject);
;// CONCATENATED MODULE: external "lodash/partition"
var partition_namespaceObject = require("lodash/partition");
var partition_default = /*#__PURE__*/__webpack_require__.n(partition_namespaceObject);
;// CONCATENATED MODULE: external "lodash/map"
var map_namespaceObject = require("lodash/map");
var map_default = /*#__PURE__*/__webpack_require__.n(map_namespaceObject);
;// CONCATENATED MODULE: external "lodash/isEmpty"
var isEmpty_namespaceObject = require("lodash/isEmpty");
var isEmpty_default = /*#__PURE__*/__webpack_require__.n(isEmpty_namespaceObject);
;// CONCATENATED MODULE: external "jdf-jssdk"
var external_jdf_jssdk_namespaceObject = require("jdf-jssdk");
;// CONCATENATED MODULE: external "lodash/flatMap"
var flatMap_namespaceObject = require("lodash/flatMap");
var flatMap_default = /*#__PURE__*/__webpack_require__.n(flatMap_namespaceObject);
;// CONCATENATED MODULE: ./src/utils/tools/flat.js
/*
 * @Author: lirl
 * @Date: 2023-02-26 21:04:51
 * @Description: file content
 */
/*
 * @Author: lirl
 * @Date: 2023-02-26 20:39:53
 * @Description: 将多层嵌套菜单转换为一层.
 */

function flat(array) {
  return flatMap_default()(array, function (item) {
    return item.isLeaf ? item : flat(item.children);
  });
}
;// CONCATENATED MODULE: ./src/utils/tools/getAllNonLeafNodes.js


function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { defineProperty_default()(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
/*
 * @Author: lirl
 * @Date: 2023-02-26 20:42:16
 * @Description: 获取所有非叶子节点
 */

function getAllNonLeafNodes(array) {
  var deep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
  var fn = function fn(arr, index) {
    return flatMap_default()(arr, function (t) {
      if (t.isLeaf) {
        return null;
      }
      return index < deep ? [_objectSpread(_objectSpread({}, t), {}, {
        level: index
      })].concat(toConsumableArray_default()(fn(t.children, index + 1))) : [_objectSpread(_objectSpread({}, t), {}, {
        level: index
      })];
    });
  };
  return fn(array, 0).filter(function (v) {
    return v;
  });
}
;// CONCATENATED MODULE: external "lodash/isNil"
var isNil_namespaceObject = require("lodash/isNil");
var isNil_default = /*#__PURE__*/__webpack_require__.n(isNil_namespaceObject);
;// CONCATENATED MODULE: ./src/utils/tools/getDefaultExpandKeys.js
/*
 * @Author: lirl
 * @Date: 2023-02-26 21:06:49
 * @Description: 获取默认展开的节点
 */



function getDefaultExpandKeys(treeData, expandLevel) {
  if (isNil_default()(expandLevel)) {
    return [];
  }
  if (expandLevel === 0) {
    return map_default()(treeData, 'id');
  }
  // 获取所有非叶子节点
  var nonLeafNodes = getAllNonLeafNodes(treeData, expandLevel);
  return map_default()(nonLeafNodes.filter(function (t) {
    return t.level <= Number(expandLevel);
  }), 'id');
}
;// CONCATENATED MODULE: ./src/utils/tools/getAllUserNodes.js
/*
 * @Author: lirl
 * @Date: 2023-02-26 20:43:22
 * @Description: 获取所有人员
 */

var fn = function fn(array) {
  return flatMap_default()(array, function (item) {
    var _item$children;
    return item.type === 'IDENTITY' ? item : fn((_item$children = item.children) !== null && _item$children !== void 0 ? _item$children : []);
  });
};
function getAllUserNodes(array) {
  return fn(array);
}
;// CONCATENATED MODULE: ./src/utils/tools/setNodeDisabled.js

function setNodeDisabled_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function setNodeDisabled_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? setNodeDisabled_ownKeys(Object(source), !0).forEach(function (key) { defineProperty_default()(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : setNodeDisabled_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
/*
 * @Author: lirl
 * @Date: 2023-02-26 20:44:56
 * @Description: 将待办/待阅候选人 type=nodeType的数据添加disabled属性
 */


var setNodeDisabled_fn = function fn(datas, nodeTypes) {
  var callback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
    return true;
  };
  return map_default()(datas, function (item) {
    if (nodeTypes.includes(item.type)) {
      if (callback(item)) {
        var data = setNodeDisabled_objectSpread({}, item);
        // 设置disabled为true，即不可选择组织
        data.disabled = true;
        !isEmpty_default()(item.children) && (data.children = fn(item.children, nodeTypes, callback));
        return data;
      }
      return item;
    }
    if (!isEmpty_default()(item.children)) {
      var _data = setNodeDisabled_objectSpread({}, item);
      _data.children = fn(item.children, nodeTypes, callback);
      return _data;
    }
    return item;
  });
};
function setNodeDisabled(datas, nodeTypes) {
  var callback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
    return true;
  };
  return setNodeDisabled_fn(datas, nodeTypes, callback);
}
;// CONCATENATED MODULE: ./src/utils/tools/dealTree.js
/*
 * @Author: lirl
 * @Date: 2023-03-13 14:16:50
 * @Description: file content
 */





/**
 * 构建候选人树
 * @param {Array} handler 候选人列表
 * @param {CandidateChooseTypeEnum} chooseType 候选人选择类型
 */
var dealTree = function dealTree(handler, chooseType) {
  var ORG = external_jdf_jssdk_namespaceObject.OrgResultTypeEnum.ORG,
    IDENTITY = external_jdf_jssdk_namespaceObject.OrgResultTypeEnum.IDENTITY;
  if (isEmpty_default()(handler)) {
    return [];
  }
  // 如果节点选择类型是全选，则禁用选择
  if (chooseType === external_jdf_jssdk_namespaceObject.CandidateChooseTypeEnum.ALL) {
    return setNodeDisabled(handler, [ORG, IDENTITY]);
  }
  // 如果为单选或部门限选一人，并且显示复选框，则将部门设置为不可选
  return [external_jdf_jssdk_namespaceObject.CandidateChooseTypeEnum.SINGLE, external_jdf_jssdk_namespaceObject.CandidateChooseTypeEnum.ORG_SINGLE].includes(chooseType) ? setNodeDisabled(handler, [ORG]) : handler;
};
/* harmony default export */ var tools_dealTree = (dealTree);
;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./packages/candidate/src/SingleTree.vue?vue&type=template&id=47834744&
var SingleTreevue_type_template_id_47834744_render = function render() {
  var _vm = this,
    _c = _vm._self._c;
  return _c("div", {
    staticClass: "jdf-simple-tree jdf-transfer"
  }, [_c("div", {
    staticClass: "tree-title"
  }, [_vm._v(_vm._s(_vm.treeTitle))]), _c("div", {
    staticClass: "tree-div"
  }, [_c("div", {
    staticClass: "candidate-area"
  }, [_c("div", {
    staticClass: "title-text"
  }, [_c("span", [_vm._v(_vm._s(_vm.leftTitle))]), _c("el-link", {
    directives: [{
      name: "show",
      rawName: "v-show",
      value: _vm.showCheckAll,
      expression: "showCheckAll"
    }],
    staticClass: "all-text jdf-fr jdf-mr10 blue",
    attrs: {
      underline: false,
      type: "primary"
    },
    on: {
      click: _vm.chooseAllNodes
    }
  }, [_vm._v("全选")])], 1), _vm.async ? _c("div", {
    staticClass: "jdf-tree-content"
  }, [_vm.search ? _c("div", {
    staticClass: "search-content",
    on: {
      click: function click($event) {
        $event.stopPropagation();
      },
      keyup: function keyup($event) {
        $event.stopPropagation();
      }
    }
  }, [_c("el-form", {
    attrs: {
      model: _vm.searchObj
    },
    nativeOn: {
      submit: function submit($event) {
        $event.preventDefault();
      }
    }
  }, [_c("el-form-item", {
    attrs: {
      label: ""
    }
  }, [_c("el-input", _vm._b({
    attrs: {
      size: "small",
      clearable: ""
    },
    on: {
      change: _vm.lazyFilter,
      input: _vm.lazyFilter
    },
    model: {
      value: _vm.searchObj.lazyFilterText,
      callback: function callback($$v) {
        _vm.$set(_vm.searchObj, "lazyFilterText", $$v);
      },
      expression: "searchObj.lazyFilterText"
    }
  }, "el-input", _vm.searchInputAttrs, false))], 1)], 1)], 1) : _vm._e(), _c("el-tree", {
    ref: "tree",
    staticClass: "jdf-tree candidate-tree",
    class: _vm.treeClass,
    attrs: {
      "node-key": "id",
      props: _vm.props,
      "show-checkbox": _vm.showCheckbox,
      "check-on-click-node": _vm.showCheckbox,
      "highlight-current": _vm.highlightCurrent,
      lazy: "",
      load: _vm.lazyLoad,
      "default-expanded-keys": _vm.asyncDefaultExpandedKeys,
      "filter-node-method": _vm.filterLeft
    },
    on: {
      check: _vm.check,
      "node-click": _vm.nodeClick
    },
    scopedSlots: _vm._u([{
      key: "default",
      fn: function fn(_ref) {
        var data = _ref.data;
        return [_c("span", {
          staticClass: "custom-tree-node-title jdf-node-name",
          class: _vm.leftNodeClass(data),
          attrs: {
            title: data.name
          }
        }, [_vm._v(_vm._s(data.name))])];
      }
    }], null, false, 409888253)
  })], 1) : _c("div", {
    staticClass: "jdf-tree-content"
  }, [_vm.search ? _c("div", {
    staticClass: "search-content"
  }, [_c("el-input", _vm._b({
    attrs: {
      size: "small",
      clearable: ""
    },
    on: {
      change: _vm.filterLeftTree,
      input: _vm.filterLeftTree,
      focus: _vm.blurFilter
    },
    model: {
      value: _vm.searchObj.filterText,
      callback: function callback($$v) {
        _vm.$set(_vm.searchObj, "filterText", $$v);
      },
      expression: "searchObj.filterText"
    }
  }, "el-input", _vm.searchInputAttrs, false))], 1) : _vm._e(), _c("el-tree", {
    ref: "tree",
    staticClass: "jdf-tree candidate-tree",
    class: _vm.treeClass,
    attrs: {
      "node-key": "id",
      props: _vm.props,
      data: _vm.treeData,
      "show-checkbox": _vm.showCheckbox,
      "check-on-click-node": _vm.showCheckbox,
      "default-checked-keys": _vm.defaultCheckedKeys,
      "highlight-current": _vm.highlightCurrent,
      "filter-node-method": _vm.filterLeft,
      "default-expanded-keys": _vm.defaultExpandedKeys,
      "expand-on-click-node": false
    },
    on: {
      check: _vm.check,
      "node-click": _vm.nodeClick,
      "node-expand": _vm.expandNode
    },
    scopedSlots: _vm._u([{
      key: "default",
      fn: function fn(_ref2) {
        var data = _ref2.data;
        return [_c("span", {
          staticClass: "custom-tree-node-title jdf-node-name",
          class: _vm.leftNodeClass(data),
          attrs: {
            title: data.name
          }
        }, [_vm._v(_vm._s(data.name))])];
      }
    }])
  })], 1)]), _c("div", {
    directives: [{
      name: "show",
      rawName: "v-show",
      value: _vm.transfer,
      expression: "transfer"
    }],
    staticClass: "flex-center transfer-col"
  }, [_c("div", {
    staticClass: "transfer-btn"
  }, [_c("div", {
    staticClass: "btn-top"
  }, [_c("el-button", {
    attrs: {
      type: "primary",
      icon: "el-icon-arrow-right",
      size: "mini"
    }
  })], 1), _c("div", {
    staticClass: "btn-bottom"
  }, [_c("el-button", {
    attrs: {
      size: "mini",
      icon: "el-icon-arrow-left"
    }
  })], 1)])]), _c("div", {
    staticClass: "choosed-area"
  }, [_c("div", {
    staticClass: "title-text"
  }, [_c("span", [_vm._v(_vm._s(_vm.rightTitle) + "（" + _vm._s(_vm.selectedList.length) + "）")]), !_vm.disableCheck ? _c("el-link", {
    staticClass: "empty-text jdf-fr jdf-mr10",
    class: _vm.selectedList.length !== 0 ? "blue" : "gray",
    attrs: {
      underline: false,
      type: "info"
    },
    on: {
      click: _vm.emptyAll
    }
  }, [_vm._v("清空")]) : _vm._e()], 1), _c("div", {
    staticClass: "jdf-tree-content"
  }, [_vm.search ? _c("div", {
    staticClass: "search-content"
  }, [_c("el-input", _vm._b({
    attrs: {
      size: "small",
      clearable: ""
    },
    on: {
      change: _vm.filterRightTree,
      input: _vm.filterRightTree
    },
    model: {
      value: _vm.searchObj.filterChooseText,
      callback: function callback($$v) {
        _vm.$set(_vm.searchObj, "filterChooseText", $$v);
      },
      expression: "searchObj.filterChooseText"
    }
  }, "el-input", _vm.searchInputAttrs, false))], 1) : _vm._e(), _c("el-tree", {
    ref: "ctree",
    staticClass: "jdf-tree",
    attrs: {
      "node-key": "id",
      props: _vm.props,
      data: _vm.selectedList,
      "highlight-current": "",
      "filter-node-method": _vm.filterNode,
      "empty-text": ""
    },
    on: {
      "node-click": _vm.removeFormRight
    }
  })], 1)])])]);
};
var SingleTreevue_type_template_id_47834744_staticRenderFns = [];
SingleTreevue_type_template_id_47834744_render._withStripped = true;

;// CONCATENATED MODULE: ./packages/candidate/src/SingleTree.vue?vue&type=template&id=47834744&

;// CONCATENATED MODULE: external "@babel/runtime/helpers/asyncToGenerator"
var asyncToGenerator_namespaceObject = require("@babel/runtime/helpers/asyncToGenerator");
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator_namespaceObject);
;// CONCATENATED MODULE: external "@babel/runtime/regenerator"
var regenerator_namespaceObject = require("@babel/runtime/regenerator");
var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator_namespaceObject);
;// CONCATENATED MODULE: external "lodash/uniqBy"
var uniqBy_namespaceObject = require("lodash/uniqBy");
var uniqBy_default = /*#__PURE__*/__webpack_require__.n(uniqBy_namespaceObject);
;// CONCATENATED MODULE: external "@babel/runtime/helpers/slicedToArray"
var slicedToArray_namespaceObject = require("@babel/runtime/helpers/slicedToArray");
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray_namespaceObject);
;// CONCATENATED MODULE: external "globalthis/implementation"
var implementation_namespaceObject = require("globalthis/implementation");
;// CONCATENATED MODULE: external "lodash/toLower"
var toLower_namespaceObject = require("lodash/toLower");
var toLower_default = /*#__PURE__*/__webpack_require__.n(toLower_namespaceObject);
;// CONCATENATED MODULE: external "lodash/intersectionWith"
var intersectionWith_namespaceObject = require("lodash/intersectionWith");
var intersectionWith_default = /*#__PURE__*/__webpack_require__.n(intersectionWith_namespaceObject);
;// CONCATENATED MODULE: external "lodash/differenceBy"
var differenceBy_namespaceObject = require("lodash/differenceBy");
var differenceBy_default = /*#__PURE__*/__webpack_require__.n(differenceBy_namespaceObject);
;// CONCATENATED MODULE: external "lodash/sortBy"
var sortBy_namespaceObject = require("lodash/sortBy");
var sortBy_default = /*#__PURE__*/__webpack_require__.n(sortBy_namespaceObject);
;// CONCATENATED MODULE: ./src/utils/tools/setOrderToData.js

function setOrderToData_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function setOrderToData_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? setOrderToData_ownKeys(Object(source), !0).forEach(function (key) { defineProperty_default()(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : setOrderToData_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
/*
 * @Author: lirl
 * @Date: 2023-05-11 19:57:13
 * @Description: 将排序序号放到data数据中
 */
function setOrderToData(data, node) {
  var _data$nodeOrder;
  return setOrderToData_objectSpread(setOrderToData_objectSpread({}, data), {}, {
    nodeOrder: (_data$nodeOrder = data.nodeOrder) !== null && _data$nodeOrder !== void 0 ? _data$nodeOrder : node.id
  });
}
;// CONCATENATED MODULE: ./src/utils/tools/getTreeVisibleLeafNodes.js
/*
 * @Author: lirl
 * @Date: 2023-02-26 21:23:51
 * @Description: 获取tree的节点中所有显示的叶子节点
 */


function getTreeVisibleLeafNodes(treeNodes) {
  var fn = function fn(nodes) {
    return flatMap_default()(nodes, function (node) {
      if (node.visible) {
        var data = node.data;
        return data.isLeaf ? setOrderToData(data, node) : fn(node.childNodes);
      }
      return null;
    });
  };
  return fn(treeNodes).filter(function (t) {
    return t;
  });
}
;// CONCATENATED MODULE: ./src/utils/tools/setOrderToArrayData.js

function setOrderToArrayData_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function setOrderToArrayData_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? setOrderToArrayData_ownKeys(Object(source), !0).forEach(function (key) { defineProperty_default()(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : setOrderToArrayData_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }


/*
 * @Author: lirl
 * @Date: 2023-05-11 19:57:13
 * @Description: 将排序序号放到data数据中
 */
function setOrderToArrayData(nodesList) {
  return map_default()(nodesList, function (v) {
    var _v$data$nodeOrder;
    return setOrderToArrayData_objectSpread(setOrderToArrayData_objectSpread({}, v.data), {}, {
      nodeOrder: (_v$data$nodeOrder = v.data.nodeOrder) !== null && _v$data$nodeOrder !== void 0 ? _v$data$nodeOrder : v.id
    });
  });
}
;// CONCATENATED MODULE: ./src/mixins/treeNodeMixin.js



/*
 * @Author: lirl
 * @Date: 2023-01-14 20:54:13
 * @Description: 树节点操作相关混入
 */













var IDENTITY = external_jdf_jssdk_namespaceObject.OrgResultTypeEnum.IDENTITY;
var SINGLE = external_jdf_jssdk_namespaceObject.CandidateChooseTypeEnum.SINGLE,
  MULTIPLE = external_jdf_jssdk_namespaceObject.CandidateChooseTypeEnum.MULTIPLE,
  ORG_SINGLE = external_jdf_jssdk_namespaceObject.CandidateChooseTypeEnum.ORG_SINGLE,
  ALL = external_jdf_jssdk_namespaceObject.CandidateChooseTypeEnum.ALL;
/* harmony default export */ var treeNodeMixin = ({
  data: function data() {
    return {
      // 记录节点点击次数，区分单击和双击
      nodeClickCount: 0
    };
  },
  computed: {
    selectRemoveLeft: function selectRemoveLeft() {
      return this.multiple && this.multipleSelectRemoveLeft;
    }
  },
  methods: {
    /**
     * 节点是否被选中
     */
    isChecked: function isChecked(id) {
      return this.selectRemoveLeft ? false : this.selectedList.some(function (t) {
        return t.id === id;
      });
    },
    /**
     * 拖拽时判定目标节点能否被放置。
     * type 参数有三种情况：'prev'、'inner' 和 'next'，分别表示放置在目标节点前、插入至目标节点和放置在目标节点后
     * @param {Object} draggingNode 被拖拽的节点
     * @param {Object} dropNode 被放置的节点
     * @param {String} type 类型
     */
    allowDrop: function allowDrop(draggingNode, dropNode, type) {
      return type !== 'inner';
    },
    /**
     * 将列表中的数据去重并按照nodeOrder进行升序排序，并返回排序后的列表
     * @param {Array} list 要排序的列表
     */
    sortUniqList: function sortUniqList(list, uniqFn) {
      return sortBy_default()(uniqBy_default()(list, uniqFn), 'nodeOrder');
    },
    /**
     * 全选
     */
    chooseAll: function chooseAll(orgSingle) {
      // 获取左侧可选树的所有根节点
      var childNodes = this.$refs.tree.root.childNodes;
      // 获取所有当前展示的节点(排除常用分组，因常用分组中的人必须在组织树中才能被选中，所以此处只全选组织树中的人)
      var visibleNodes = getTreeVisibleLeafNodes(childNodes.filter(function (v) {
        return v.data.id !== 'common-group';
      }));
      // 去除disabled的节点
      var availableNodes = visibleNodes.filter(function (t) {
        return !t.disabled;
      });
      if (isEmpty_default()(availableNodes)) {
        return;
      }
      // 将节点放到已选列表，并去重
      // 如果是每个部门限选一人，则点击全选时，默认选中第一个人
      this.selectedList = this.sortUniqList(availableNodes, orgSingle ? 'orgCode' : function (v) {
        return "".concat(v.id);
      });
      // 如果设置了选中后，从左树中移除已选，则为选中的值添加隐藏节点的class
      this.selectRemoveLeft && this.addHideClassAll(availableNodes);
    },
    /**
     * 清空
     */
    clearAll: function clearAll() {
      var selectedList = this.selectedList;
      if (isEmpty_default()(selectedList)) {
        return;
      }
      this.selectedList = [];
      if (this.selectRemoveLeft) {
        this.removeHideClassAll();
      }
    },
    /**
     * 左节点样式
     */
    leftNodeClass: function leftNodeClass(data) {
      if (data.disabled) {
        return 'node-disabled';
      }
      if (this.selectRemoveLeft) {
        return "jdf-tree-node-".concat(data.id);
      }
      return {
        'node-disabled': this.isChecked(data.id)
      };
    },
    /**
     * 搜索左树
     * @param {String} value 搜索的字段
     * @param {Object} data 节点数据
     * @param {Object} node 节点对象
     */
    filterLeft: function filterLeft(value, data) {
      var show = this.filterNode(value, data);
      if (this.selectRemoveLeft) {
        return show && !this.selectedList.some(function (t) {
          return t.id === data.id;
        });
      }
      return show;
    },
    /**
     * 搜索树
     * @param {String} value 搜索的字段
     * @param {Object} data
     */
    filterNode: function filterNode(value, data) {
      var _data$loginName, _data$name;
      // 按照名称和code过滤，只过滤叶子节点
      if (!value) {
        return true;
      }
      var loginName = (_data$loginName = data.loginName) !== null && _data$loginName !== void 0 ? _data$loginName : '';
      if (loginName.includes('@')) {
        var _loginName$split = loginName.split('@');
        var _loginName$split2 = slicedToArray_default()(_loginName$split, 1);
        loginName = _loginName$split2[0];
      }
      return data.isLeaf && (((_data$name = data.name) === null || _data$name === void 0 ? void 0 : _data$name.includes(value)) || loginName.includes(toLower_default()(value)));
    },
    /**
     * 移除已选
     * @param {Object} data 选中的数据
     */
    removeRightItem: function removeRightItem(data) {
      if (this.disableCheck) {
        return;
      }
      var id = data.id;
      if (this.showCheckbox) {
        this.$refs.tree.setChecked(id, false, true);
      } else if (this.selectRemoveLeft) {
        // this.setNodeVisibleStatus(data, true);
        this.removeHideClass(data);
      }
      this.selectedList = this.selectedList.filter(function (v) {
        return v.id !== id;
      });
      this.$refs.ctree.remove(data);
    },
    /**
     * 节点被展开时触发的事件
     */
    expandNode: function expandNode(data, node) {
      this.selectRemoveLeft && this.addHideClassAll(intersectionWith_default()(this.selectedList, node.childNodes, function (a, b) {
        var _b$data;
        return "".concat(a.id) === "".concat((_b$data = b.data) === null || _b$data === void 0 ? void 0 : _b$data.id);
      }));
    },
    /**
     * 恢复左边已选值
     */
    removeHideClass: function removeHideClass(data) {
      var _this = this;
      this.$nextTick(function () {
        var nodes = implementation_namespaceObject.document.querySelectorAll(".".concat(_this.treeClass, " .jdf-tree-node-").concat(data.id));
        nodes.forEach(function (v) {
          v.parentNode.removeClass('jdf-hide');
        });
      });
    },
    /**
     * 恢复左边已选值
     */
    removeHideClassAll: function removeHideClassAll() {
      var _this2 = this;
      this.$nextTick(function () {
        var nodes = implementation_namespaceObject.document.querySelectorAll(".".concat(_this2.treeClass, " .jdf-hide"));
        nodes.forEach(function (v) {
          v.removeClass('jdf-hide');
        });
      });
    },
    /**
     * 移除左边已选值
     */
    addHideClass: function addHideClass(data) {
      var _this3 = this;
      this.$nextTick(function () {
        _this3.addClass(data.id);
      });
    },
    /**
     * 移除左边已选值
     */
    addHideClassAll: function addHideClassAll(datas) {
      var _this4 = this;
      if (!datas) {
        return;
      }
      this.$nextTick(function () {
        var addClass = _this4.addClass;
        datas.forEach(function (t) {
          addClass(t.id);
        });
      });
    },
    /**
     * 为节点添加class
     * @param {String} id 节点id
     */
    addClass: function addClass(id) {
      // 需要去除
      var nodes = implementation_namespaceObject.document.querySelectorAll(".".concat(this.treeClass, " .jdf-tree-node-").concat(id));
      nodes.forEach(function (v) {
        v.parentNode.addClass('jdf-hide');
      });
    },
    /**
     * 单击选人
     * @param {Object} data 选中的数据
     * @param {Object} node 点击的节点对象
     * @param {String} selectType 选择类型
     */
    selectFnSingleClick: function selectFnSingleClick(data, node, selectType) {
      var _this5 = this,
        _SINGLE$MULTIPLE$ORG_;
      return (_SINGLE$MULTIPLE$ORG_ = {}, defineProperty_default()(_SINGLE$MULTIPLE$ORG_, SINGLE, function () {
        _this5.selectedList = data ? [data] : [];
      }), defineProperty_default()(_SINGLE$MULTIPLE$ORG_, MULTIPLE, function () {
        // 如果选择的是常用分组中的人员，则根据数据的id，从可选树中获取该人员在组织树中的节点，以便获取该人员在组织树中的排序号
        var userNode = data.commonGroupUser ? _this5.$refs.tree.getNode(data.id) : node;
        _this5.selectedList = _this5.sortUniqList([].concat(toConsumableArray_default()(_this5.selectedList), [setOrderToData(data, userNode)]), 'id');
        if (_this5.multipleSelectRemoveLeft) {
          // 单击直接隐藏该节点
          _this5.addHideClass(data);
        }
      }), defineProperty_default()(_SINGLE$MULTIPLE$ORG_, ORG_SINGLE, function () {
        // 如果选择的是常用分组中的人员，则根据数据的id，从可选树中获取该人员在组织树中的节点，以便获取该人员在组织树中的排序号
        var userNode = data.commonGroupUser ? _this5.$refs.tree.getNode(data.id) : node;
        _this5.selectedList = _this5.sortUniqList([].concat(toConsumableArray_default()(differenceBy_default()(_this5.selectedList, [data], 'orgCode')), [setOrderToData(data, userNode)]), 'id');
      }), defineProperty_default()(_SINGLE$MULTIPLE$ORG_, ALL, function () {
        _this5.selectedList = _this5.sortUniqList([].concat(toConsumableArray_default()(_this5.selectedList), [setOrderToData(data, node)]), 'id');
      }), _SINGLE$MULTIPLE$ORG_)[selectType];
    },
    /**
     * 双击选人
     * 因要实现选择后，已选列表的顺序需要与组织树的顺序一致，但是人员信息中并没有人员在组织树中的全量排序号。
     * 所以在构建数据时将nodeOrder字段放到data对象中，在选择数据后，已选列表中按照nodeOrder进行全量排序。
     * @param {Object} data 选中的数据
     * @param {Object} node 点击的节点
     * @param {String} selectType 选择类型
     */
    selectFnDbClick: function selectFnDbClick(data, node, selectType) {
      var _this6 = this,
        _SINGLE$MULTIPLE$ORG_2;
      if (!node.childNodes) {
        return function () {};
      }
      // 子节点中未被禁用的人员类型节点
      var childNodes = node.childNodes.filter(function (t) {
        var d = t.data;
        return !d.disabled && d.type === IDENTITY;
      });
      return (_SINGLE$MULTIPLE$ORG_2 = {}, defineProperty_default()(_SINGLE$MULTIPLE$ORG_2, SINGLE, function () {
        var _childNodes = slicedToArray_default()(childNodes, 1),
          first = _childNodes[0];
        first && (_this6.selectedList = [first.data]);
      }), defineProperty_default()(_SINGLE$MULTIPLE$ORG_2, MULTIPLE, function () {
        var newList;
        // 如果双击的节点是常用分组，则遍历选中的常用分组下的人员节点，根据人员节点中数据的id，获取人员在组织树中的节点，
        // 以获取人员节点的排序号
        if (data.pid === 'common-group') {
          // 获取左侧可选树的ref对象
          var tree = _this6.$refs.tree;
          // 遍历选中的常用分组下的人员节点，根据节点中数据的id，从可选树中获取该人员在组织树中节点的id，赋值给数据的nodeOrder字段
          newList = map_default()(childNodes, function (v) {
            return setOrderToData(v.data, tree.getNode(v.data.id));
          });
        } else {
          // 将节点的id放入数据data的nodeOrder属性中，用来作为全量排序字段
          newList = setOrderToArrayData(childNodes);
        }
        // 将数据进行去重、并按nodeOrder字段进行排序
        _this6.selectedList = _this6.sortUniqList([].concat(toConsumableArray_default()(_this6.selectedList), toConsumableArray_default()(newList)), 'id');
        // 隐藏左侧可选列表中已选中的节点
        _this6.multipleSelectRemoveLeft && _this6.addHideClassAll(newList);
      }), defineProperty_default()(_SINGLE$MULTIPLE$ORG_2, ORG_SINGLE, function () {
        // 如果双击的是常用分组
        if (data.pid === 'common-group') {
          // 获取左侧可选树的ref对象
          var tree = _this6.$refs.tree;
          // 遍历选中的常用分组下的人员节点，根据节点中数据的id，从可选树中获取该人员在组织树中节点的id，赋值给数据的nodeOrder字段
          var newList = map_default()(childNodes, function (v) {
            return setOrderToData(v.data, tree.getNode(v.data.id));
          });
          // 将人员数据根据部门code进行去除，并按照nodeOrder排序
          _this6.selectedList = _this6.sortUniqList([].concat(toConsumableArray_default()(_this6.selectedList), toConsumableArray_default()(newList)), function (t) {
            return t.orgCode || "".concat(t.id);
          });
        } else if (!isEmpty_default()(childNodes)) {
          // 获取子节点列表中第一个节点中的数据
          var _childNodes2 = slicedToArray_default()(childNodes, 1),
            firstNode = _childNodes2[0];
          var nodeData = firstNode.data;
          // 将已选数据根据orgCode去重后，根据nodeOrder排序
          _this6.selectedList = _this6.sortUniqList([].concat(toConsumableArray_default()(differenceBy_default()(_this6.selectedList, [nodeData], 'orgCode')), [setOrderToData(nodeData, firstNode)]), 'id');
        }
      }), defineProperty_default()(_SINGLE$MULTIPLE$ORG_2, ALL, function () {
        _this6.selectedList = uniqBy_default()([].concat(toConsumableArray_default()(_this6.selectedList), [data]), 'id');
      }), _SINGLE$MULTIPLE$ORG_2)[selectType];
    },
    /**
     * 点击树的节点时选中数据
     * @param {Object} data 点击的节点数据
     * @param {Object} node 点击的环节对象
     * @param {Boolean} isSingleClick 是否为单击事件
     */
    selectFnCommon: function selectFnCommon(data, node, selectType) {
      var isSingleClick = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
      return isSingleClick ? this.selectFnSingleClick(data, node, selectType) : this.selectFnDbClick(data, node, selectType);
    },
    /**
     * 执行节点的单击、双击事件
     * @param {Object} data 当前双击的节点的数据
     * @param {Object} node 点击的节点
     */
    doNodeClick: function doNodeClick(data, node) {
      var _this7 = this;
      // 点击次数+1
      this.nodeClickCount += 1;
      // 如果当前点击次数=2，表示为双击，执行双击方法
      if (this.nodeClickCount >= 2) {
        this.selectFn(data, node, false)();
        this.customNodeClickEvent();
        // 200ms后再清零，否则会执行下面的setTimeout中的单击事件
        setTimeout(function () {
          // 双击后将点击次数清零
          _this7.nodeClickCount = 0;
        }, 300);
        return;
      }
      setTimeout(function () {
        // 等待200毫秒，如果点击次数小于2，表示没有执行双击，执行的是单击，此时操作节点展开收起
        if (_this7.nodeClickCount < 2) {
          node.expanded ? node.collapse() : node.expand();
          // 将点击次数清零
          _this7.nodeClickCount = 0;
        }
      }, 300);
    }
  }
});
;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/index.js??vue-loader-options!./packages/candidate/src/SingleTree.vue?vue&type=script&lang=js&




function SingleTreevue_type_script_lang_js_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function SingleTreevue_type_script_lang_js_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? SingleTreevue_type_script_lang_js_ownKeys(Object(source), !0).forEach(function (key) { defineProperty_default()(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : SingleTreevue_type_script_lang_js_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }





var SingleTreevue_type_script_lang_js_IDENTITY = external_jdf_jssdk_namespaceObject.OrgResultTypeEnum.IDENTITY;
var SingleTreevue_type_script_lang_js_SINGLE = external_jdf_jssdk_namespaceObject.CandidateChooseTypeEnum.SINGLE,
  SingleTreevue_type_script_lang_js_MULTIPLE = external_jdf_jssdk_namespaceObject.CandidateChooseTypeEnum.MULTIPLE,
  SingleTreevue_type_script_lang_js_ORG_SINGLE = external_jdf_jssdk_namespaceObject.CandidateChooseTypeEnum.ORG_SINGLE,
  SingleTreevue_type_script_lang_js_ALL = external_jdf_jssdk_namespaceObject.CandidateChooseTypeEnum.ALL;
/* harmony default export */ var SingleTreevue_type_script_lang_js_ = ({
  name: 'SingleTree',
  mixins: [treeNodeMixin],
  model: {
    prop: 'value',
    event: 'change'
  },
  props: {
    // 已选值
    value: {
      type: Array,
      default: function _default() {
        return [];
      }
    },
    // 数据
    treeData: {
      type: Array,
      default: function _default() {
        return [];
      }
    },
    // 树的标题
    treeTitle: String,
    // 左侧树标题
    leftTitle: {
      type: String,
      default: '可选列表'
    },
    // 右侧树标题
    rightTitle: {
      type: String,
      default: '已选列表'
    },
    // 是否显示复选框
    showCheckbox: {
      type: Boolean,
      default: false
    },
    // 高亮选中的行
    highlightCurrent: {
      type: Boolean,
      default: true
    },
    // 选择类型-single: 单选, multiple: 多选, orgSingle: 部门限选一人, all: 全选
    chooseType: String,
    // 是否禁用选择
    disableCheck: {
      type: Boolean,
      default: false
    },
    // 是否是异步
    async: {
      type: Boolean,
      default: false
    },
    // 异步的key
    asyncKey: String,
    // 是否搜索
    search: {
      type: Boolean,
      default: true
    },
    defaultCheckedKeys: {
      type: Array,
      default: function _default() {
        return [];
      }
    },
    defaultExpandedKeys: {
      type: Array,
      default: function _default() {
        return [];
      }
    },
    // 是否显示穿梭框
    transfer: {
      type: Boolean,
      default: true
    },
    multipleSelectRemoveLeft: {
      type: Boolean,
      default: true
    },
    expandLevel: {
      type: Number,
      default: 0
    },
    treeClass: {
      type: String,
      default: 'candidate-tree'
    }
  },
  inject: {
    searchInputAttrs: {
      default: {
        placeholder: '搜索：姓名（汉字/拼音）',
        'prefix-icon': 'el-icon-search'
      }
    }
  },
  data: function data() {
    return {
      // tree的属性
      props: {
        label: 'name',
        children: 'children',
        isLeaf: 'isLeaf',
        disabled: 'disabled'
      },
      searchObj: {
        filterText: '',
        filterChooseText: '',
        lazyFilterText: ''
      },
      asyncDefaultExpandedKeys: []
    };
  },
  watch: {
    treeData: {
      handler: function handler() {
        var _this = this;
        var value = this.value;
        if (this.selectRemoveLeft) {
          isEmpty_default()(value) ? this.removeHideClassAll() : this.addHideClassAll(value);
        }
        this.$nextTick(function () {
          var tree = _this.$refs.tree;
          // 获取所有没有nodeOrder字段的数据，赋值上nodeOrder
          _this.selectedList = map_default()(value, function (v) {
            var _tree$getNode;
            return SingleTreevue_type_script_lang_js_objectSpread(SingleTreevue_type_script_lang_js_objectSpread({}, v), {}, {
              nodeOrder: (_tree$getNode = tree.getNode(v.id)) === null || _tree$getNode === void 0 ? void 0 : _tree$getNode.id
            });
          });
        });
      },
      immediate: true
    }
  },
  computed: {
    /**
     * 全选按钮的展示条件
     * 1. 不是异步树
     * 2. 多选/部门限选一人
     * 3. 选择未禁用
     */
    showCheckAll: function showCheckAll() {
      return !this.async && [SingleTreevue_type_script_lang_js_MULTIPLE, SingleTreevue_type_script_lang_js_ORG_SINGLE].includes(this.chooseType) && !this.disableCheck;
    },
    // 已选数据
    selectedList: {
      get: function get() {
        return this.value;
      },
      set: function set(val) {
        this.$emit('change', val);
      }
    },
    selectRemoveLeft: function selectRemoveLeft() {
      return this.chooseType === SingleTreevue_type_script_lang_js_MULTIPLE && this.multipleSelectRemoveLeft;
    }
  },
  methods: {
    /**
     * 懒加载树
     */
    lazyLoad: function lazyLoad(node, resolve) {
      var _this2 = this;
      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee() {
        var treeData, data, _this2$asyncDefaultEx, children, _this2$asyncDefaultEx2, list;
        return regenerator_default().wrap(function _callee$(_context) {
          while (1) switch (_context.prev = _context.next) {
            case 0:
              if (!(node.level === 0)) {
                _context.next = 5;
                break;
              }
              treeData = _this2.treeData; // 如果展开层级大于等于0，则默认展开第一级
              _this2.expandLevel >= 0 && (_this2.asyncDefaultExpandedKeys = map_default()(treeData, 'id'));
              resolve(treeData);
              return _context.abrupt("return");
            case 5:
              data = node.data;
              if (!(data.id === 'common-group' || data.pid === 'common-group')) {
                _context.next = 12;
                break;
              }
              children = data.children;
              node.level <= _this2.expandLevel && (_this2$asyncDefaultEx = _this2.asyncDefaultExpandedKeys).push.apply(_this2$asyncDefaultEx, toConsumableArray_default()(map_default()(children, 'id')));
              resolve(children);
              _context.next = 17;
              break;
            case 12:
              _context.next = 14;
              return new external_jdf_jssdk_namespaceObject.ProcessService(_this2.$JDF.baseUrl).getCandidateTreeAsync(_this2.asyncKey, node.data.id);
            case 14:
              list = _context.sent;
              // 如果当前节点的层级小于等于要展开的层级，则展开当前节点
              node.level <= _this2.expandLevel && (_this2$asyncDefaultEx2 = _this2.asyncDefaultExpandedKeys).push.apply(_this2$asyncDefaultEx2, toConsumableArray_default()(map_default()(list, 'id')));
              resolve(map_default()(list, function (t) {
                return SingleTreevue_type_script_lang_js_objectSpread(SingleTreevue_type_script_lang_js_objectSpread({}, t), {}, {
                  disabled: !t.isLeaf
                });
              }));
            case 17:
              _this2.addHideClassAll(_this2.selectedList);
            case 18:
            case "end":
              return _context.stop();
          }
        }, _callee);
      }))();
    },
    /**
     * 过滤左侧树
     */
    filterLeftTree: function filterLeftTree() {
      this.$refs.tree.filter(this.searchObj.filterText);
    },
    /**
     * 过滤右侧树
     */
    filterRightTree: function filterRightTree() {
      this.$refs.ctree.filter(this.searchObj.filterChooseText);
    },
    /**
     * 懒加载过滤
     */
    lazyFilter: function lazyFilter() {
      // TODO: 目前没有后台查询接口
      this.$refs.tree.filter(this.searchObj.lazyFilterText);
    },
    /**
     * 点击复选框选中数据
     * @param {Object} data 传递给 data 属性的数组中该节点所对应的对象
     * @param {Boolean} checked 树目前的选中状态对象，包含 checkedNodes、checkedKeys、halfCheckedNodes、halfCheckedKeys 四个属性
     */
    check: function check(data, checked) {
      this.checkFn(data, checked.checkedKeys)();
      this.customNodeClickEvent();
    },
    /**
     * 点击选择
     * @param {Object} data 当前点击的节点的数据
     */
    nodeClick: function nodeClick(data, node) {
      /**
       * 以下情况不允许点击选择
       * 1. 组件禁用选择
       * 2. 显示复选框时
       * 3. 点击的节点不是叶子节点
       * 4. 点击的节点不是人员
       * 5. 节点被禁用
       */
      if (this.disableCheck || data.disabled || this.showCheckbox) {
        return;
      }
      // 如果点击的不是叶子节点并且不是人员节点，则判断是单击还是双击，如果是单击，则执行节点的展开收起，双击将节点下人员全选
      if (!(data.isLeaf || data.type === SingleTreevue_type_script_lang_js_IDENTITY)) {
        this.doNodeClick(data, node);
        return;
      }
      this.selectFn(data, node, true)();
      this.customNodeClickEvent();
    },
    /**
     * 点击checkbox时人员选择的方法
     * @param {Object} data 传递给 data 属性的数组中该节点所对应的对象
     * @param {Array} checkedKeys 选中的key的列表
     */
    checkFn: function checkFn(data, checkedKeys) {
      var _this3 = this,
        _SINGLE$MULTIPLE$ORG_;
      // 过滤后赋值方法
      var filterAssignment = function filterAssignment(id) {
        _this3.selectedList = _this3.selectedList.filter(function (t) {
          return "".concat(t.id) !== "".concat(id);
        });
      };
      var ref = this.$refs.tree;
      return (_SINGLE$MULTIPLE$ORG_ = {}, defineProperty_default()(_SINGLE$MULTIPLE$ORG_, SingleTreevue_type_script_lang_js_SINGLE, function () {
        if (data.type !== external_jdf_jssdk_namespaceObject.OrgResultTypeEnum.IDENTITY) {
          return;
        }
        var id = data.id;
        // 如果节点被选中
        if (checkedKeys.includes(id)) {
          // 设置当前树选中的key为当前选择的key，取消其他节点的选中状态
          ref.setCheckedKeys([id]);
          _this3.selectedList = [data];
        } else {
          // 从已选人中移除该数据
          filterAssignment(id);
        }
      }), defineProperty_default()(_SINGLE$MULTIPLE$ORG_, SingleTreevue_type_script_lang_js_MULTIPLE, function () {
        // 获取树的已选中数据，并过滤处人员
        var checkedNodes = ref.getCheckedNodes().filter(function (t) {
          return t.type === SingleTreevue_type_script_lang_js_IDENTITY;
        });
        _this3.selectedList = uniqBy_default()(checkedNodes, function (v) {
          return "".concat(v.id);
        });
      }), defineProperty_default()(_SINGLE$MULTIPLE$ORG_, SingleTreevue_type_script_lang_js_ORG_SINGLE, function () {
        if (data.type !== SingleTreevue_type_script_lang_js_IDENTITY) {
          return;
        }
        var id = data.id;
        // 如果节点被选中
        if (checkedKeys.includes(id)) {
          // 获取当前树已选中的人员
          var checkedNodes = ref.getCheckedNodes().filter(function (t) {
            return t.type === SingleTreevue_type_script_lang_js_IDENTITY;
          });
          // 从已选人员中, 去除跟当前节点部门相同的节点，并将当前节点加进去
          var nodes = [].concat(toConsumableArray_default()(checkedNodes.filter(function (t) {
            return t.orgCode !== data.orgCode;
          })), [data]);
          // 为已选人员赋值
          _this3.selectedList = nodes;
          // 设置树已选中状态
          ref.setCheckedKeys(map_default()(nodes, 'id'));
        } else {
          // 如果节点取消选中，则从已选人员中移除该数据
          filterAssignment(id);
        }
      }), defineProperty_default()(_SINGLE$MULTIPLE$ORG_, SingleTreevue_type_script_lang_js_ALL, function () {
        // 获取树的已选人员数据
        var checkedNodes = ref.getCheckedNodes().filter(function (t) {
          return t.type === SingleTreevue_type_script_lang_js_IDENTITY;
        });
        // 为已选人赋值
        _this3.selectedList = checkedNodes;
      }), _SINGLE$MULTIPLE$ORG_)[this.chooseType];
    },
    /**
     * 点击树的节点时选中数据
     * @param {Object} data 点击的节点数据
     * @param {Object} node 点击的节点对象
     * @param {Boolean} isSingleClick 是否为单击事件
     */
    selectFn: function selectFn(data, node, isSingleClick) {
      return this.selectFnCommon(data, node, this.chooseType, isSingleClick);
    },
    /**
     * 候选列表、已选列表节点点击事件
     */
    customNodeClickEvent: function customNodeClickEvent() {
      var _this4 = this;
      this.$nextTick(function () {
        _this4.$emit('customNodeCheck', _this4.selectedList);
      });
    },
    /**
     * 从右侧移除选中
     */
    removeFormRight: function removeFormRight(data) {
      this.removeRightItem(data);
      this.customNodeClickEvent();
    },
    /**
     * 全选
     */
    chooseAllNodes: function chooseAllNodes() {
      this.chooseAll(this.chooseType === SingleTreevue_type_script_lang_js_ORG_SINGLE);
      this.customNodeClickEvent();
    },
    /**
     * 清空全选
     */
    emptyAll: function emptyAll() {
      this.clearAll();
      this.customNodeClickEvent();
    }
  }
});
;// CONCATENATED MODULE: ./packages/candidate/src/SingleTree.vue?vue&type=script&lang=js&
 /* harmony default export */ var src_SingleTreevue_type_script_lang_js_ = (SingleTreevue_type_script_lang_js_); 
;// CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
/* globals __VUE_SSR_CONTEXT__ */

// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
// This module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle.

function normalizeComponent(
  scriptExports,
  render,
  staticRenderFns,
  functionalTemplate,
  injectStyles,
  scopeId,
  moduleIdentifier /* server only */,
  shadowMode /* vue-cli only */
) {
  // Vue.extend constructor export interop
  var options =
    typeof scriptExports === 'function' ? scriptExports.options : scriptExports

  // render functions
  if (render) {
    options.render = render
    options.staticRenderFns = staticRenderFns
    options._compiled = true
  }

  // functional template
  if (functionalTemplate) {
    options.functional = true
  }

  // scopedId
  if (scopeId) {
    options._scopeId = 'data-v-' + scopeId
  }

  var hook
  if (moduleIdentifier) {
    // server build
    hook = function (context) {
      // 2.3 injection
      context =
        context || // cached call
        (this.$vnode && this.$vnode.ssrContext) || // stateful
        (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
      // 2.2 with runInNewContext: true
      if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
        context = __VUE_SSR_CONTEXT__
      }
      // inject component styles
      if (injectStyles) {
        injectStyles.call(this, context)
      }
      // register component module identifier for async chunk inferrence
      if (context && context._registeredComponents) {
        context._registeredComponents.add(moduleIdentifier)
      }
    }
    // used by ssr in case component is cached and beforeCreate
    // never gets called
    options._ssrRegister = hook
  } else if (injectStyles) {
    hook = shadowMode
      ? function () {
          injectStyles.call(
            this,
            (options.functional ? this.parent : this).$root.$options.shadowRoot
          )
        }
      : injectStyles
  }

  if (hook) {
    if (options.functional) {
      // for template-only hot-reload because in that case the render fn doesn't
      // go through the normalizer
      options._injectStyles = hook
      // register for functional component in vue file
      var originalRender = options.render
      options.render = function renderWithStyleInjection(h, context) {
        hook.call(context)
        return originalRender(h, context)
      }
    } else {
      // inject component registration as beforeCreate hook
      var existing = options.beforeCreate
      options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
    }
  }

  return {
    exports: scriptExports,
    options: options
  }
}

;// CONCATENATED MODULE: ./packages/candidate/src/SingleTree.vue





/* normalize component */
;
var component = normalizeComponent(
  src_SingleTreevue_type_script_lang_js_,
  SingleTreevue_type_template_id_47834744_render,
  SingleTreevue_type_template_id_47834744_staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* harmony default export */ var SingleTree = (component.exports);
;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/index.js??vue-loader-options!./packages/candidate/src/main.vue?vue&type=script&lang=js&













var mainvue_type_script_lang_js_IDENTITY = external_jdf_jssdk_namespaceObject.OrgResultTypeEnum.IDENTITY;
var mainvue_type_script_lang_js_ALL = external_jdf_jssdk_namespaceObject.CandidateChooseTypeEnum.ALL;
/* harmony default export */ var mainvue_type_script_lang_js_ = ({
  name: 'JdfCandidate',
  components: {
    SingleTree: SingleTree
  },
  props: {
    // 待办人候选配置数据
    todoHandler: {
      type: Object,
      default: function _default() {}
    },
    // 待阅候选人配置数据
    readHandler: {
      type: Object,
      default: function _default() {}
    },
    // 下一环节code
    nextNodeKey: String,
    // 已选待办候选人
    selectedTodo: {
      type: Array,
      default: function _default() {
        return [];
      }
    },
    // 已选阅知候选人
    selectedRead: {
      type: Array,
      default: function _default() {
        return [];
      }
    },
    // 选择的路径信息
    path: {
      type: Object,
      default: function _default() {}
    },
    // 是否显示复选框
    showCheckbox: {
      type: Boolean,
      default: false
    },
    // 是否开启搜索功能
    search: {
      type: Boolean,
      default: true
    },
    // 高亮选中的行
    highlightCurrent: {
      type: Boolean,
      default: true
    },
    // 待办候选人树的标题
    todoTitle: {
      type: String,
      default: '可选列表'
    },
    // 待阅候选人树的标题
    toreadTitle: {
      type: String,
      default: '可选列表'
    },
    // 是否穿梭框样式
    transfer: {
      type: Boolean,
      default: false
    },
    multipleSelectRemoveLeft: {
      type: Boolean,
      default: true
    },
    // 常用群组树展开层级是否比候选人树展开层级少一级
    commonGroupTreeExpandLessThanOneLevel: {
      type: Boolean,
      default: false
    },
    showPathName: {
      type: Boolean,
      default: true
    },
    treeClass: {
      type: String,
      default: 'candidate-tree'
    }
  },
  data: function data() {
    return {
      isEmpty: (isEmpty_default()),
      // 待办树数据
      todoTree: [],
      // 待阅树数据
      toreadTree: [],
      // 已选的待阅候选人
      selectedReadList: [],
      // 已选待办候选人
      selectedTodoList: [],
      // 待办默认展开的key
      todoDefaultExpandedKeys: [],
      // 待阅默认展开的key
      toreadDefaultExpandedKeys: [],
      // 待办默认选中的key
      todoDefaultCheckedKeys: [],
      // 待阅默认选中的key
      readDefaultCheckedKeys: []
    };
  },
  computed: {
    /**
     * 是否显示待办
     */
    showTodo: function showTodo() {
      var _this$todoHandler;
      return !isEmpty_default()((_this$todoHandler = this.todoHandler) === null || _this$todoHandler === void 0 ? void 0 : _this$todoHandler.handler);
    },
    /**
     * 是否显示待阅
     */
    showRead: function showRead() {
      var _this$readHandler;
      return !isEmpty_default()((_this$readHandler = this.readHandler) === null || _this$readHandler === void 0 ? void 0 : _this$readHandler.handler);
    },
    /**
     * 是否退回
     */
    isReturn: function isReturn() {
      return this.path.type === external_jdf_jssdk_namespaceObject.PathTypeEnum.RETURN;
    },
    /**
     * 待办树是否多选
     */
    todoChooseType: function todoChooseType() {
      return this.todoHandler.chooseType;
    },
    /**
     * 待阅树是否多选
     */
    toreadChooseType: function toreadChooseType() {
      var _this$readHandler2;
      return (_this$readHandler2 = this.readHandler) === null || _this$readHandler2 === void 0 ? void 0 : _this$readHandler2.chooseType;
    },
    /**
     * 待办树是否禁用选择
     */
    todoDisableCheck: function todoDisableCheck() {
      return this.todoChooseType === mainvue_type_script_lang_js_ALL || this.isReturn;
    },
    /**
     * 待阅树是否默认全选
     */
    toreadDisableCheck: function toreadDisableCheck() {
      return this.toreadChooseType === mainvue_type_script_lang_js_ALL;
    },
    /**
     * 待阅树的标题
     */
    toreadCandidateTitle: function toreadCandidateTitle() {
      var _this$path$attrList$f, _this$path, _this$path$attrList, _this$path$attrList$f2;
      return (_this$path$attrList$f = (_this$path = this.path) === null || _this$path === void 0 ? void 0 : (_this$path$attrList = _this$path.attrList) === null || _this$path$attrList === void 0 ? void 0 : (_this$path$attrList$f2 = _this$path$attrList.find(function (t) {
        return t.attrCode === '.toreadTitle';
      })) === null || _this$path$attrList$f2 === void 0 ? void 0 : _this$path$attrList$f2.attrValue) !== null && _this$path$attrList$f !== void 0 ? _this$path$attrList$f : '阅知';
    }
  },
  watch: {
    /**
     * 监听待办候选人
     */
    todoHandler: {
      handler: function handler(val) {
        this.todoDefaultExpandedKeys = [];
        this.todoDefaultCheckedKeys = [];
        this.selectedTodoList = [];
        // 解决切换路径后如果没有候选人，候选人不清空的问题
        if (isEmpty_default()(val === null || val === void 0 ? void 0 : val.handler)) {
          this.todoTree = [];
        } else {
          this.initTodo(val);
        }
      },
      deep: true,
      immediate: true
    },
    /**
     * 监听待阅候选人
     */
    readHandler: {
      handler: function handler(val) {
        this.toreadDefaultExpandedKeys = [];
        this.readDefaultCheckedKeys = [];
        this.selectedReadList = [];
        if (isEmpty_default()(val === null || val === void 0 ? void 0 : val.handler)) {
          this.toreadTree = [];
        } else {
          this.initToRead(val);
        }
      },
      deep: true,
      immediate: true
    },
    selectedTodo: {
      handler: function handler(val) {
        if (val) {
          // this.selectedTodoList = cloneDeep(uniqueBy([...this.selectedTodoList, ...val], 'id'));
          this.selectedTodoList = cloneDeep_default()(val);
        }
        this.hideLeftNode(val);
      },
      deep: true
    }
  },
  methods: {
    /**
     * 初始化待办数据
     * @param {Object} data 待办配置数据
     */
    initTodo: function initTodo(data) {
      var handler = data.handler,
        chooseType = data.chooseType;
      var isReturn = this.isReturn,
        showCheckbox = this.showCheckbox;
      var type = isReturn ? mainvue_type_script_lang_js_ALL : chooseType;
      // 显示复选框，则设置禁用的复选框
      this.todoTree = showCheckbox ? tools_dealTree(handler, type) : handler;
      // 获取所有叶子节点
      var users = getAllUserNodes(handler.filter(function (t) {
        return t.id !== 'common-group';
      }));
      /**
       * 1. 设置是否全选
       */
      // 当待办选择类型是全选、或者候选人来源是“节点”，全选所有人
      // TODO: handlerValue.source === CandidateSourceEnum.NODE
      if (isReturn || data.chooseType === mainvue_type_script_lang_js_ALL || users.length === 1) {
        if (showCheckbox) {
          // 如果显示复选框，则选中所有候选人
          this.todoDefaultCheckedKeys = map_default()(users, 'id');
        }
        this.selectedTodoList = cloneDeep_default()(users);
      }

      /**
       * 2. 如果是退回路径，则默认展开所有节点
       */
      if (this.isReturn) {
        // 获取所有非叶子节点
        var nonLeafNodes = getAllNonLeafNodes(handler);
        // 展开所有节点
        this.todoDefaultExpandedKeys = map_default()(nonLeafNodes, 'id');
        return;
      }

      /**
       * 3. 设置默认展开的层级
       */
      !data.async && (this.todoDefaultExpandedKeys = this.getTreeExpandKeys(handler, data.expandLevel));
      /**
       * 4. 设置默认已选值
       */
      if (!isEmpty_default()(this.selectedTodo)) {
        this.selectedTodoList = cloneDeep_default()(this.selectedTodo);
      }
    },
    /**
     * 初始化待阅数据
     * @param {Object} data 待阅配置数据
     */
    initToRead: function initToRead(data) {
      var handler = data.handler,
        chooseType = data.chooseType,
        showCheckbox = data.showCheckbox;
      this.toreadTree = showCheckbox ? tools_dealTree(handler, chooseType, showCheckbox) : handler;
      /**
       * 1. 设置是否全选
       */
      // 全选所有人
      if (chooseType === mainvue_type_script_lang_js_ALL) {
        // 获取所有叶子节点
        var allDatas = flat(handler);
        if (showCheckbox) {
          // 如果显示复选框，则选中所有候选人
          this.readDefaultCheckedKeys = map_default()(allDatas, 'id');
        }
        this.selectedReadList = allDatas.filter(function (t) {
          return t.type === mainvue_type_script_lang_js_IDENTITY;
        });

        // // 获取所有非叶子节点
        // const nonLeafNodes = getAllNonLeafNodes(handler);
        // // 展开所有节点
        // this.toreadDefaultExpandedKeys = map(nonLeafNodes, 'id');
        // return;
      }

      !data.async && (this.toreadDefaultExpandedKeys = this.getTreeExpandKeys(handler, data.expandLevel));
      /**
       * 4. 设置默认已选值
       */
      if (!isEmpty_default()(this.selectedRead)) {
        this.selectedReadList = cloneDeep_default()(this.selectedRead);
      }
    },
    /**
     * 获取树展开的节点
     * @param {Array} treeData 树的数据
     */
    getTreeExpandKeys: function getTreeExpandKeys(treeData, expandLevel) {
      if (this.commonGroupTreeExpandLessThanOneLevel) {
        var partitions = partition_default()(treeData, function (t) {
          return t.id === 'common-group';
        });
        return [].concat(toConsumableArray_default()(getDefaultExpandKeys(partitions[0], expandLevel - 1)), toConsumableArray_default()(getDefaultExpandKeys(partitions[1], expandLevel)));
      }
      return getDefaultExpandKeys(treeData, expandLevel);
    },
    /**
     * 隐藏左侧节点
     */
    hideLeftNode: function hideLeftNode(list) {
      var todo = this.$refs.todo;
      if (todo && this.todoChooseType === external_jdf_jssdk_namespaceObject.CandidateChooseTypeEnum.MULTIPLE && this.multipleSelectRemoveLeft) {
        isEmpty_default()(list) ? todo.removeHideClassAll() : todo.addHideClassAll(list);
      }
    },
    /**
     * 校验待办人
     */
    todoVerifyNoPass: function todoVerifyNoPass() {
      if (this.showTodo && isEmpty_default()(this.selectedTodoList)) {
        return this.todoHandler.pathName;
      }
      return null;
    },
    /**
     * 校验待阅人
     */
    toreadVerifyNoPass: function toreadVerifyNoPass() {
      if (this.showRead && isEmpty_default()(this.selectedReadList)) {
        return this.readHandler.pathName;
      }
      return null;
    },
    getSelected: function getSelected() {
      return defineProperty_default()({}, this.nextNodeKey, this.selectedTodoList);
    },
    getSelectedRead: function getSelectedRead() {
      return defineProperty_default()({}, this.nextNodeKey, this.selectedReadList);
    },
    /**
     * 选择待办人事件
     * @param {Array} selected 已选人员
     */
    customNodeCheck: function customNodeCheck(selected) {
      this.$emit('customNodeCheck', selected, this.nextNodeKey);
    }
  }
});
;// CONCATENATED MODULE: ./packages/candidate/src/main.vue?vue&type=script&lang=js&
 /* harmony default export */ var src_mainvue_type_script_lang_js_ = (mainvue_type_script_lang_js_); 
;// CONCATENATED MODULE: ./packages/candidate/src/main.vue





/* normalize component */
;
var main_component = normalizeComponent(
  src_mainvue_type_script_lang_js_,
  render,
  staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* harmony default export */ var main = (main_component.exports);
;// CONCATENATED MODULE: ./packages/candidate/index.js

main.install = function (Vue) {
  Vue.component(main.name, main);
};
/* harmony default export */ var candidate = (main);
module.exports = __webpack_exports__;
/******/ })()
;