{"remainingRequest":"D:\\jenkins\\workspace\\bzzgj-fvue\\node_modules\\thread-loader\\dist\\cjs.js!D:\\jenkins\\workspace\\bzzgj-fvue\\node_modules\\babel-loader\\lib\\index.js!D:\\jenkins\\workspace\\bzzgj-fvue\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!D:\\jenkins\\workspace\\bzzgj-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\bzzgj-fvue\\src\\components\\myTree\\index.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\bzzgj-fvue\\src\\components\\myTree\\index.vue","mtime":1691463999649},{"path":"D:\\jenkins\\workspace\\bzzgj-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\bzzgj-fvue\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\bzzgj-fvue\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\bzzgj-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\bzzgj-fvue\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import \"core-js/modules/es7.object.get-own-property-descriptors\";\nimport \"core-js/modules/es6.object.keys\";\nimport \"core-js/modules/es6.regexp.constructor\";\nimport \"core-js/modules/es6.regexp.replace\";\nimport \"core-js/modules/es6.regexp.split\";\nimport \"core-js/modules/es6.string.iterator\";\nimport \"core-js/modules/es6.set\";\nimport \"core-js/modules/es7.array.includes\";\nimport \"core-js/modules/es6.string.includes\";\nimport \"core-js/modules/web.dom.iterable\";\nimport _typeof from \"D:/jenkins/workspace/bzzgj-fvue/node_modules/@babel/runtime/helpers/esm/typeof\";\nimport _toConsumableArray from \"D:/jenkins/workspace/bzzgj-fvue/node_modules/@babel/runtime/helpers/esm/toConsumableArray\";\nimport \"core-js/modules/es6.function.name\";\nimport _defineProperty from \"D:/jenkins/workspace/bzzgj-fvue/node_modules/@babel/runtime/helpers/esm/defineProperty\";\nimport \"core-js/modules/es6.array.find\";\nimport \"core-js/modules/es6.number.constructor\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nexport default {\n name: 'MyTree',\n props: {\n tree: {\n // 树形数据源\n type: Array,\n default: function _default() {\n return [];\n }\n },\n sonOptions: {\n // 多项子集配置\n type: Array,\n default: function _default() {\n return [{\n childrenkey: 'children',\n nameKey: 'name',\n idKey: 'id',\n disabledKey: 'disabled',\n height: '32px'\n }];\n }\n },\n topChild: {\n // 顶层对象含义\n type: String,\n default: 'children'\n },\n treeParams: {\n // 个性化样式配置\n type: Object,\n default: function _default() {}\n },\n indent: {\n // 相邻级节点间的水平缩进,单位为像素\n type: Number,\n default: 18\n },\n defaultExpandAll: {\n // 是否默认展开所有节点\n type: Boolean,\n default: false\n },\n foldAll: {\n // 折叠时关闭所有已经打开的子集,再次打开时需要一级一级打开\n type: Boolean,\n default: false\n },\n openSerch: {\n // 开启搜索\n type: Boolean,\n default: false\n },\n treeStyle: {\n // 自定义样式类名\n type: String,\n default: ''\n }\n },\n data: function data() {\n return {\n treeList: [],\n initialData: [],\n params: {\n prefixIcon: './img/prefix-icon.png',\n // 前置图标\n postIcon: './img/post-icon.png',\n // 后置图标(自动旋转)\n disabledIcon: './img/disabled-icon.png',\n // 禁用图标\n border: false\n },\n serchVal: ''\n };\n },\n watch: {\n tree: {\n handler: function handler(tree) {\n var _this = this;\n\n this.params = Object.assign(this.params, this.treeParams); // console.time('数据处理时间:')\n // 异步执行避免后续功能出错\n\n setTimeout(function () {\n _this.initialData = _this.flattenTree(tree);\n _this.treeList = _this.deepClone(_this.initialData); // console.timeEnd('数据处理时间:')\n\n _this.$emit('is-finished', _this.initialData);\n }, 0);\n },\n immediate: true // 初始化执行\n\n }\n },\n mounted: function mounted() {},\n methods: {\n // 扁平化树形结构\n flattenTree: function flattenTree() {\n var tree = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var rank = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var parentIds = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];\n var sonOptions = this.sonOptions,\n topChild = this.topChild,\n defaultExpandAll = this.defaultExpandAll,\n flattenTree = this.flattenTree;\n return tree.reduce(function (concatArr, item) {\n var _sonOptions$find = sonOptions.find(function (i) {\n return i.childrenkey === (item.childrenkey || topChild);\n }),\n nameKey = _sonOptions$find.nameKey,\n idKey = _sonOptions$find.idKey,\n disabledKey = _sonOptions$find.disabledKey,\n height = _sonOptions$find.height;\n\n var newItem = _objectSpread(_objectSpread({}, item), {}, {\n name: item[nameKey] || item.name,\n // 显示文字\n id: item[idKey] || item.id,\n // 唯一标识符\n height: height || '32px',\n // 高度\n isShow: defaultExpandAll || rank === 0,\n // 自身是否显示\n showChild: defaultExpandAll && !item.lastRank || false,\n //子级是否展开\n childrenkey: item.childrenkey || topChild,\n // 父级下层级代表\n rank: rank,\n // 层级\n lastRank: false,\n // 是否为最底层\n disabled: !!(item[disabledKey] || item.disabled),\n // 是否禁用\n parentIds: parentIds,\n // 父级id数组\n parentId: parentIds[parentIds.length - 1] || 0 // 父级id\n\n }); // 合并所有类型的子集数组并打上类型标记\n\n\n var children = sonOptions.map(function (_ref) {\n var childrenkey = _ref.childrenkey;\n delete newItem[childrenkey]; // 删除扁平化数组对象中的所有子集数组\n\n return childrenkey;\n }).map(function (childrenkey) {\n if (Array.isArray(item[childrenkey]) && item[childrenkey].length) {\n return item[childrenkey].map(function (_item) {\n return _objectSpread({\n childrenkey: childrenkey\n }, _item);\n });\n }\n }).filter(function (item) {\n return item;\n }).reduce(function (sonConcat, son) {\n if (Array.isArray(son) && son.length) return sonConcat.concat(son);\n }, []); // 判断是否到达底层\n\n if (Array.isArray(children) && children.length) {\n var parents = _toConsumableArray(parentIds);\n\n parents.push(item[sonOptions.find(function (i) {\n return i.childrenkey === topChild;\n }).idKey]);\n return concatArr.concat(newItem, flattenTree(children, rank + 1, parents));\n } else {\n newItem.lastRank = true;\n return concatArr.concat(newItem);\n }\n }, []);\n },\n //使用递归的方式实现数组、对象的深拷贝\n deepClone: function deepClone(obj) {\n // 只拷贝对象\n if (_typeof(obj) !== 'object') return; // 根据obj的类型判断是新建一个数组还是一个对象\n\n var newObj = obj instanceof Array ? [] : {};\n\n for (var key in obj) {\n // 遍历obj,并且判断是obj的属性才拷贝\n if (obj.hasOwnProperty(key)) {\n // 判断属性值的类型,如果是对象递归调用深拷贝\n newObj[key] = _typeof(obj[key]) === 'object' ? this.deepClone(obj[key]) : obj[key];\n }\n }\n\n return newObj;\n },\n // 行点击\n rowClick: function rowClick(row) {\n var lastRank = row.lastRank,\n id = row.id,\n disabled = row.disabled;\n var foldAll = this.foldAll;\n if (disabled) return this.$emit('disabled-item-click', row);\n if (lastRank) return this.$emit('tree-item-click', row);\n row.showChild = !row.showChild;\n this.treeList.forEach(function (item, index, arr) {\n if (!row.showChild) {\n // 关闭子集\n if (item.parentIds.includes(id)) {\n item.isShow = false; // 是否开启关闭折叠所有子集项功能\n\n if (foldAll) {\n arr.forEach(function (_ref2) {\n var id = _ref2.id;\n if (item.parentId === id) item.showChild = false;\n });\n }\n }\n } else {\n // 打开子集\n var clickItem = arr.find(function (_ref3) {\n var id = _ref3.id;\n return id === item.parentId;\n }) || {};\n\n if (item.parentIds.includes(id) && clickItem.showChild) {\n item.isShow = true;\n }\n }\n });\n },\n // 展开所有列表\n expandAll: function expandAll() {\n this.treeList.forEach(function (item, index, arr) {\n if (!item.lastRank && !item.disabled) item.showChild = true;\n item.isShow = true; // 将禁用项的组件的子集关闭\n\n arr.forEach(function (_item) {\n if (item.parentIds.includes(_item.id) && _item.disabled) {\n item.isShow = false;\n item.showChild = false;\n }\n });\n });\n },\n // 搜索\n serch: function serch(serchVal) {\n this.serchVal.trim();\n var initialData = this.initialData,\n tree = this.tree,\n flattenTree = this.flattenTree,\n expandAll = this.expandAll;\n\n if (!serchVal) {\n return this.treeList = flattenTree(tree);\n }\n\n var treeList = initialData.filter(function (_ref4) {\n var id = _ref4.id;\n return _toConsumableArray(new Set(initialData.filter(function (_ref5) {\n var name = _ref5.name;\n return name.includes(serchVal) || serchVal.includes(name);\n }).reduce(function (concatArr, _ref6) {\n var parentIds = _ref6.parentIds,\n id = _ref6.id,\n name = _ref6.name;\n if (Array.isArray(parentIds) && parentIds.length) return concatArr.concat(parentIds, id);\n }, []))).includes(id);\n });\n var max = 0;\n treeList.map(function (_ref7) {\n var rank = _ref7.rank;\n return rank;\n }).forEach(function (item) {\n return max = item > max ? item : max;\n });\n treeList.forEach(function (item) {\n if (item.rank === max) {\n item.showChild = false;\n item.lastRank = true;\n }\n });\n this.treeList = treeList;\n expandAll();\n },\n // 重置搜索内容\n reset: function reset() {\n this.serchVal = '';\n this.treeList = this.flattenTree(this.tree);\n },\n // 高亮搜索内容\n brightenKeyword: function brightenKeyword(val, keyword) {\n if (keyword.length) {\n var keywordArr = keyword.split('');\n val = val + '';\n keywordArr.forEach(function (item) {\n if (val.indexOf(item) !== -1 && item !== ' ') {\n val = val.replace(new RegExp(item, 'g'), '' + item + '');\n }\n });\n }\n\n return val;\n }\n }\n};",null]}