webpackJsonp([15],{XrHk:function(e,t){},dkM4:function(e,t){},egjg:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=a("mvHQ"),l=a.n(n),r={name:"el-tree-select",props:{config:{type:Object,default:function(){return{value:"id",label:"title",children:"children"}}},options:{type:Array,default:function(){return[]}},value:{type:Number,default:function(){return null}},clearable:{type:Boolean,default:function(){return!0}},accordion:{type:Boolean,default:function(){return!1}},placeholder:{type:String,default:function(){return"搜索关键字"}}},data:function(){return{filterText:"",valueId:this.value,valueTitle:"",defaultExpandedKey:[]}},mounted:function(){this.initHandle()},methods:{initHandle:function(){this.valueId&&(this.valueTitle=this.$refs.selectTree.getNode(this.valueId).data[this.config.label],this.$refs.selectTree.setCurrentKey(this.valueId),this.defaultExpandedKey=[this.valueId])},nodeClick:function(e){this.valueTitle=e[this.config.label],this.valueId=e[this.config.value],this.$emit("node-click",e),this.defaultExpandedKey=[]},clearHandle:function(){this.valueTitle="",this.valueId=null,this.defaultExpandedKey=[],this.clearSelected(),this.$emit("getValue",null)},clearSelected:function(){document.querySelectorAll(".select-tree #tree-option .el-tree-node").forEach(function(e){return e.classList.remove("is-current")})},filterNode:function(e,t){return!e||-1!==t.name.indexOf(e)}},watch:{value:function(){this.valueId=this.value,this.initHandle()},filterText:function(e){this.$refs.selectTree.filter(e)}}},i={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"select-tree"},[a("el-select",{attrs:{value:e.valueTitle,clearable:e.clearable},on:{clear:e.clearHandle}},[a("el-input",{staticClass:"select-input",attrs:{placeholder:e.placeholder,size:"small"},model:{value:e.filterText,callback:function(t){e.filterText=t},expression:"filterText"}}),e._v(" "),a("el-option",{attrs:{value:e.valueTitle,label:e.valueTitle}},[a("el-tree",{ref:"selectTree",attrs:{id:"tree-option",accordion:e.accordion,data:e.options,props:e.config,"node-key":e.config.value,"default-expanded-keys":e.defaultExpandedKey,"filter-node-method":e.filterNode},on:{"node-click":e.nodeClick}})],1)],1)],1)},staticRenderFns:[]};var d={name:"app",components:{SelectTree:a("VU/8")(r,i,!1,function(e){a("XrHk")},"data-v-42740069",null).exports,Json:a("a1Va").a},data:function(){return{isClearable:!0,isAccordion:!0,value:"",selectedNode:{},selectedNodeStr:"",config:{value:"id",label:"name",children:"children"},list:[{id:1,parentId:0,name:"一级菜单A",rank:1},{id:2,parentId:0,name:"一级菜单B",rank:1},{id:3,parentId:0,name:"一级菜单C",rank:1},{id:4,parentId:1,name:"二级菜单A-A",rank:2},{id:5,parentId:1,name:"二级菜单A-B",rank:2},{id:6,parentId:2,name:"二级菜单B-A",rank:2},{id:7,parentId:4,name:"三级菜单A-A-A",rank:3},{id:8,parentId:7,name:"四级菜单A-A-A-A",rank:4},{id:9,parentId:0,name:"一级菜单C",rank:1},{id:10,parentId:0,name:"一级菜单end",rank:1}]}},computed:{optionData:function(){var e=JSON.parse(l()(this.list));return e.filter(function(t){var a=e.filter(function(e){return t.id==e.parentId});return a.length>0&&(t.children=a),0==t.parentId})}},methods:{getValue:function(e){this.valueId=e.id,this.selectedNode=e,this.selectedNodeStr=l()(e)}}},c={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("el-row",{attrs:{gutter:20}},[a("el-col",{staticClass:"mb20",attrs:{md:12}},[a("el-card",{staticClass:"card-demo"},[a("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[a("span",[e._v("树形选择器组件")])]),e._v(" "),a("select-tree",{attrs:{config:e.config,options:e.optionData,"v-model":e.value,clearable:e.isClearable,accordion:e.isAccordion},on:{"node-click":function(t){return e.getValue(t)}}})],1)],1),e._v(" "),a("el-col",{attrs:{md:12}},[a("el-card",{staticClass:"card-demo"},[a("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[a("span",[e._v("选中的节点")])]),e._v(" "),a("json",{model:{value:e.selectedNodeStr,callback:function(t){e.selectedNodeStr=t},expression:"selectedNodeStr"}})],1)],1)],1)},staticRenderFns:[]};var o=a("VU/8")(d,c,!1,function(e){a("dkM4")},"data-v-248828de",null);t.default=o.exports}});