"use strict";require("../../../utils/request.js");const e=require("../../../common/vendor.js"),t={label:"fullName",value:"id",icon:"icon",children:"children"},s={name:"tree-select",props:{selectList:{type:Array,default:()=>[]},selectedId:{type:Array,default:()=>[]},selectData:{type:Array,default:()=>[]},options:{type:Array,default:()=>[]},border:{type:Boolean,default:!0},filterable:{type:Boolean,default:!1},showAllLevels:{type:Boolean,default:!0},clearable:{type:Boolean,default:!1},modelValue:{type:Boolean,default:!1},cancelColor:{type:String,default:"#606266"},confirmColor:{type:String,default:"#2979ff"},zIndex:{type:[String,Number],default:0},safeAreaInsetBottom:{type:Boolean,default:!1},maskCloseAble:{type:Boolean,default:!0},props:{type:Object,default:()=>({label:"fullName",value:"id",icon:"icon",children:"children",isLeaf:"isLeaf"})},multiple:{type:Boolean,default:!1},title:{type:String,default:""},cancelText:{type:String,default:"取消"},confirmText:{type:String,default:"确认"},level:{type:Number,default:0}},data:()=>({moving:!1,selectListText:[],selectListId:[],selectListData:[],newListId:[],filterText:"",showPopup:!1}),watch:{modelValue:{immediate:!0,handler(e){this.showPopup=e,e&&setTimeout((()=>this.init()),10)}},filterText(e){this.$refs.tree.filter(e)}},created(){this.init()},computed:{uZIndex(){return this.zIndex?this.zIndex:this.$u.zIndex.popup},realProps(){return{...t,...this.props}}},methods:{init(){this.selectListText=this.$u.deepClone(this.selectList),this.selectListId=this.$u.deepClone(this.selectedId),this.selectListData=this.$u.deepClone(this.selectData)},filterNode(e,t){return!e||-1!==t[this.props.label].indexOf(e)},handleNodeClick(e){if(!e.parentId&&!e.isLeaf)return;let t=this.$refs.tree.getNodePath(e),s=[],l=e.data;this.multiple||(this.selectListText=[],this.selectListId=[],this.selectListData=[]);let i="",o="";for(let n=0;n<t.length;n++)s.push(t[n][this.props.value]),o+=(n?",":"")+t[n][this.props.value],i+=(n?"/":"")+t[n][this.props.label];this.showAllLevels?this.selectListText.push(i):this.selectListText.push(l[this.props.label]),this.selectListText=[...new Set(this.selectListText)];for(var a=!1,r=0;r<this.selectListId.length;r++)if(this.selectListId[r].join(",")===o){a=!0;break}!a&&this.selectListId.push(s),this.selectListData=t},delSelect(e){this.selectListText.splice(e,1),this.selectListId.splice(e,1),this.selectListData.splice(e,1)},setCheckAll(){this.selectListText=[],this.selectListId=[],this.selectListData=[],this.$refs.tree.setCheckAll(!1)},handleConfirm(){this.$emit("confirm",this.selectListText,this.selectListId,this.selectListData),this.close()},close(){this.$emit("close",!1)}}};if(!Array){(e.resolveComponent("u-search")+e.resolveComponent("u-tag")+e.resolveComponent("ly-tree")+e.resolveComponent("u-button")+e.resolveComponent("u-popup"))()}Math||((()=>"../../../uni_modules/vk-uview-ui/components/u-search/u-search.js")+(()=>"../../../uni_modules/vk-uview-ui/components/u-tag/u-tag.js")+(()=>"../../ly-tree/ly-tree.js")+(()=>"../../../uni_modules/vk-uview-ui/components/u-button/u-button.js")+(()=>"../../../uni_modules/vk-uview-ui/components/u-popup/u-popup.js"))();const l=e._export_sfc(s,[["render",function(t,s,l,i,o,a){return e.e({a:e.o(((...e)=>a.close&&a.close(...e))),b:l.filterable},l.filterable?{c:e.o((e=>o.filterText=e)),d:e.p({placeholder:"请输入关键词搜索",height:"72","show-action":!1,"bg-color":"#f0f2f6",shape:"square",modelValue:o.filterText})}:{},{e:l.multiple},l.multiple?{f:e.o(((...e)=>a.setCheckAll&&a.setCheckAll(...e)))}:{},{g:e.f(o.selectListText,((t,s,l)=>({a:e.o((e=>a.delSelect(s)),s),b:s,c:"f8992112-2-"+l+",f8992112-0",d:e.p({closeable:!0,text:t})}))),h:e.sr("tree","f8992112-3,f8992112-0"),i:e.o(a.handleNodeClick),j:e.p({"tree-data":l.options,"check-on-click-node":!0,"default-expand-all":!0,"node-key":a.realProps.value,"highlight-current":!0,props:a.realProps,"filter-node-method":a.filterNode}),k:e.o((e=>a.close())),l:e.o(a.handleConfirm),m:e.p({type:"primary"}),n:e.o(a.close),o:e.o((e=>o.showPopup=e)),p:e.p({width:"100%",length:"auto",mode:"right",popup:!1,safeAreaInsetBottom:l.safeAreaInsetBottom,maskCloseAble:l.maskCloseAble,"z-index":a.uZIndex,modelValue:o.showPopup})})}]]);wx.createComponent(l);