tkitree.js 11 KB

1234567891011
  1. require('../../common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/subPackages/components/tkitree/tkitree"],{"1ed9":function(e,t,i){"use strict";i.d(t,"b",(function(){return n})),i.d(t,"c",(function(){return c})),i.d(t,"a",(function(){}));var n=function(){var e=this.$createElement;this._self._c},c=[]},"24b9":function(t,i,n){"use strict";(function(t){var c=n("47a9");Object.defineProperty(i,"__esModule",{value:!0}),i.default=void 0;var r=c(n("7eb4")),h=c(n("7ca3")),d=c(n("af34")),a=c(n("ee10")),o=c(n("c9ff")),s=n("5ae7"),l={name:"tkitree",props:{reciveUserInfo:{type:String},range:{type:Array,default:[]},idKey:{type:String,default:"id"},default_value:{type:Array,default:[]},rangeKey:{type:String,default:"label"},title:{type:String,default:""},multiple:{type:Boolean,default:!1},selectParent:{type:Boolean,default:!1},foldAll:{type:Boolean,default:!1},confirmColor:{type:String,default:""},cancelColor:{type:String,default:""},titleColor:{type:String,default:""},currentIcon:{type:String,default:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFEAAABRCAYAAACqj0o2AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWR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pEA7xXL7XfvcufR8K0Svfv6CREN3yDYfYIt9QiK3yjYTYLF95xB75SiP2ylcZsVu+cogj8pVCHJWvEuKwfOkREfKlRkTJlxkRJl86RMR8qRBR82VChM0XHpEhX2hElnyREWnyhUNkzBcKkTVfJETafIcjKuQ7FFEl35GIMvl2R1TMtyuiar49EWXzbY5oZpv/hibXTF2h3+s60FRKeT6+3TjMS3nrA3ZFRD8xrfY3ER1kJ+JEdBBwWGKeRAfEH1wS5WFZSDB/AAAAAElFTkSuQmCC"},lastIcon:{type:String,default:""},border:{type:Boolean,default:!1},custom:{type:Boolean,default:!1},spread:{type:Boolean,default:!1}},data:function(){return{fartherKey:"",showTree:!1,treeList:[],selectIndex:-1,idArr:[],searchname:"",selectName:[],getMsg:""}},computed:{},methods:{clear:function(){console.log(this.treeList),this.searchname=""},getList:function(){var e=this;return(0,a.default)(r.default.mark((function t(){var i,n;return r.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,(0,s.getSelectUserTwo)(e.searchname);case 2:i=t.sent,e._initTree(o.default.transData(i.data,"id","parentid","children")),n=e.treeList,n.forEach((function(t,i){t.name==e.searchname&&(t.show=!0),e.selectName.forEach((function(i){if(t.name==i){t.checked=!0,t.show=!0;var n=e.treeList.filter((function(e){return t.parentId[t.parentId.length-1]===e.parentId[e.parentId.length-1]}));n.forEach((function(e){e.show=!0}))}})),e.treeList.forEach((function(t,i){t.checked&&t.parentId.forEach((function(t,i){e.treeList.forEach((function(i,n){i.id==t&&(e.treeList[n].checked=!0,e.treeList[n].show=!0,e.treeList[n].showChild=!0)}))}))}))}));case 6:case"end":return t.stop()}}),t)})))()},_show:function(){console.log(123123);try{this.showTree=!0,this.fartherKey=e}catch(e){console.log(e)}},_hide:function(){this.showTree=!1},_cancel:function(){this._hide(),this.$emit("cancel","")},_confirm:function(){var e=this,t=[],i={};this.treeList.forEach((function(n,c){e.treeList[c].checked&&(i={},i.parents=e.treeList[c].parents,i=Object.assign(i,e.treeList[c].source),delete i.children,t.push(i))})),this._hide(),this.$emit("confirm",[].concat(t),this.fartherKey)},getSearchObj:function(e){var t=this;if(!e.children||!e.children.length)return e.name===this.searchname;e.children.forEach((function(e){if(e.name===t.searchname)return!0}))},_renderTreeList:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];t.forEach((function(t){if(e.treeList.push({id:t[e.idKey],name:t[e.rangeKey],source:t,parentId:n,parents:c,rank:i,showChild:!1,open:!1,show:0===i,hideArr:[],orChecked:!!t.checked&&t.checked,checked:!!t.checked&&t.checked}),Array.isArray(t.children)&&t.children.length>0){var r,a=(0,d.default)(n),o=(0,d.default)(c),s=[].concat(s);delete o.children,a.push(t[e.idKey]),o.push((r={},(0,h.default)(r,e.idKey,t[e.idKey]),(0,h.default)(r,e.rangeKey,t[e.rangeKey]),r)),e._renderTreeList(t.children,i+1,a,o)}else e.treeList[e.treeList.length-1].lastRank=!0}))},_defaultSelect:function(){var e=this.default_value;this.treeList.forEach((function(t,i){for(var n=0;n<e;n++)t.parentId.toString().indexOf(v2.parentId.toString())}))},_treeItemTap:function(e,t){var i=this;if(!0===e.lastRank)return this.treeList[t].checked=!this.treeList[t].checked,void this._fixMultiple(t);var n=this.treeList,c=e.id;e.showChild=!e.showChild,e.open=!!e.showChild||!e.open,n.forEach((function(t,n){if(!1===e.showChild){if(!t.parentId.includes(c))return;i.foldAll?!0!==t.lastRank&&(t.showChild=!1):(!0===t.lastRank||t.open||(t.showChild=!1),t.show&&(t.hideArr[e.rank]=c)),t.show=!1}else t.parentId[t.parentId.length-1]===c&&(t.show=!0),t.parentId.includes(c)&&!i.foldAll&&t.hideArr[e.rank]===c&&(t.show=!0,t.open&&t.showChild?t.showChild=!0:t.showChild=!1,t.hideArr[e.rank]=null)}))},_treeItemSelect:function(e,t){this.treeList[t].checked=!this.treeList[t].checked,this._fixMultiple(t),this._chenge(e,this.treeList[t].checked)},_treeItemSelect2:function(e,t){console.log(e,t,"点击事件1"),this._hide(),this.$emit("confirm",e)},_chenge:function(e,t){var i=this;if(1==e.checked){var n=this.selectName.indexOf(e.name);if(n>-1)return;this.selectName.push(e.name)}else{var c=this.selectName.indexOf(e.name);if(!(c>-1))return;this.selectName.splice(c,1)}if(this.searchname="",this.idArr.push(e.id),void 0==e.source.children)return this.treeList.forEach((function(e,n){i.idArr.forEach((function(c,r){e.id==c&&1==t?i.treeList[n].checked=!0:e.id==c&&0==t&&(i.treeList[n].checked=!1)}))})),e.checked?e.parentId.forEach((function(e,t){i.treeList.forEach((function(t,n){t.id==e&&(i.treeList[n].checked=!0)}))})):e.parentId.forEach((function(e,t){i.treeList.forEach((function(t,n){t.id==e&&(i.treeList[n].checked=!1)}))})),this.treeList.forEach((function(e,t){e.checked&&e.parentId.forEach((function(e,t){i.treeList.forEach((function(t,n){t.id==e&&(i.treeList[n].checked=!0)}))}))})),void(this.idArr=[]);this.handkeCheck1(e.source.children),this.treeList.forEach((function(e,n){i.idArr.forEach((function(c,r){e.id==c&&1==t?i.treeList[n].checked=!0:e.id==c&&0==t&&(i.treeList[n].checked=!1)}))})),e.checked?e.parentId.forEach((function(e,t){i.treeList.forEach((function(t,n){t.id==e&&(i.treeList[n].checked=!0)}))})):e.parentId.forEach((function(e,t){i.treeList.forEach((function(t,n){t.id==e&&(i.treeList[n].checked=!1)}))})),this.treeList.forEach((function(e,t){e.checked&&e.parentId.forEach((function(e,t){i.treeList.forEach((function(t,n){t.id==e&&(i.treeList[n].checked=!0)}))}))})),this.idArr=[]},handkeCheck1:function(e){var t=this;e.forEach((function(e,i){t.idArr.push(e.id),void 0!=e.children&&t.handkeCheck1(e.children)}))},handkeCheck:function(e,t,i){var n=this;e.forEach((function(e,c){void 0!=e.children?e.id==t.id&&1==t.checked?(e.checked=!0,n.handkeChecks(e.children,t,i)):e.id==t.id&&0==t.checked?(e.checked=!1,n.handkeChecks(e.children,t,i)):n.handkeCheck(e.children,t,i):e.id==t.id&&1==t.checked?e.checked=!0:e.id==t.id&&0==t.checked&&(e.checked=!1)}))},handkeChecks:function(e,t,i){var n=this;e.forEach((function(e,c){void 0!=e.children?t.checked?(e.checked=!0,n.handkeChecks(e.children,t,i)):(e.checked=!1,n.handkeChecks(e.children,t,i)):t.checked?e.checked=!0:e.checked=!1}))},_fixMultiple:function(e){var t=this;this.spread&&this.treeList.forEach((function(i,n){t.treeList[n].checked=n==e}))},_reTreeList:function(){var e=this;this.treeList.forEach((function(t,i){e.treeList[i].checked=t.orChecked}))},_initTree:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.range;this.treeList=[],this._renderTreeList(e),this.$nextTick((function(){}));var t=this.treeList;this.custom&&t.forEach((function(e,t){console.log("child",e),"1"==e.rank&&(e.show=!0)}))}},watch:{range:function(e){this._initTree(e)},multiple:function(){this.range.length&&this._reTreeList()},selectParent:function(){this.range.length&&this._reTreeList()},deep:!0,immediate:!0},mounted:function(){var e=this;this._initTree(),t.$on("sendMsg",(function(t){e.getMsg=t.msg}))}};i.default=l}).call(this,n("df3c")["default"])},"6f4a":function(e,t,i){},"95b6":function(e,t,i){"use strict";i.r(t);var n=i("24b9"),c=i.n(n);for(var r in n)["default"].indexOf(r)<0&&function(e){i.d(t,e,(function(){return n[e]}))}(r);t["default"]=c.a},bb8b:function(e,t,i){"use strict";var n=i("6f4a"),c=i.n(n);c.a},efee:function(e,t,i){"use strict";i.r(t);var n=i("1ed9"),c=i("95b6");for(var r in c)["default"].indexOf(r)<0&&function(e){i.d(t,e,(function(){return c[e]}))}(r);i("bb8b");var h=i("828b"),d=Object(h["a"])(c["default"],n["b"],n["c"],!1,null,"49b168d2",null,!1,n["a"],void 0);t["default"]=d.exports}}]);
  2. ;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
  3. 'pages/subPackages/components/tkitree/tkitree-create-component',
  4. {
  5. 'pages/subPackages/components/tkitree/tkitree-create-component':(function(module, exports, __webpack_require__){
  6. __webpack_require__('df3c')['createComponent'](__webpack_require__("efee"))
  7. })
  8. },
  9. [['pages/subPackages/components/tkitree/tkitree-create-component']]
  10. ]);