import{z as K}from"./eleVendor-dbf96bf3-1779868775780v=1.0.0.js";import{l as x,a as u,E as R,b as C,n as A,ah as m,m as a,p as d,T as c,R as B,U as y,O as k,M as z,S as w,u as M,q as O,H as U,J as H}from"./vendor-98154105-1779868775780v=1.0.0.js";import{_ as J}from"./_plugin-vue_export-helper-8c5478df-1779868775780v=1.0.0.js";const P={class:"filter"},$={key:0,class:"title sle"},j={class:"el-tree-node__label"},G={key:0},L={key:1},Q={key:2},W={key:3},X=x({name:"TreeFilter"}),Y=x({...X,props:{requestApi:{},data:{},title:{},id:{default:"areaId"},label:{default:"name"},multiple:{type:Boolean,default:!1},defaultValue:{},expandAll:{type:Boolean,default:!1},expandKeys:{default:[]},type:{default:"areaId"},allAccount:{type:Boolean,default:!1}},emits:["change"],setup(E,{expose:N,emit:T}){const l=E,F={children:"children",label:l.label},n=u(null),p=u([]),f=u([]),o=u(),V=()=>{l.multiple?o.value=Array.isArray(l.defaultValue)?l.defaultValue:[l.defaultValue]:o.value=typeof l.defaultValue=="string"?l.defaultValue:""};R(async()=>{if(V(),l.requestApi){const{data:e}=await l.requestApi();p.value=e,f.value=[{id:"",[l.label]:"\u5168\u90E8"},...e]}}),C(()=>l.defaultValue,()=>A(()=>V()),{deep:!0,immediate:!0}),C(()=>l.data,()=>{var e;(e=l.data)!=null&&e.length&&(p.value=l.data,f.value=[...l.data])},{deep:!0,immediate:!0});const _=u("");C(_,e=>{n.value.filter(e)});const S=()=>{b.value=!0,n.value,o.value,A(()=>{n.value.setCurrentKey(null),o.value="",v("change","")})},D=(e,g,s)=>{if(!e)return!0;let r=s.parent,i=[s.label],h=1;for(;h<s.level;)i=[...i,r.label],r=r.parent,h++;return i.some(t=>t.indexOf(e)!==-1)},v=T,b=u(!1),q=e=>{l.multiple||(b.value=!1,v("change",e[l.id]))},I=()=>{var e;v("change",(e=n.value)==null?void 0:e.getCheckedKeys())};return N({treeData:p,treeAllData:f,treeRef:n}),(e,g)=>{const s=m("el-input"),r=m("el-button"),i=m("el-tooltip"),h=m("el-scrollbar");return a(),d("div",P,[e.title?(a(),d("h4",$,c(e.title),1)):B("",!0),y(s,{modelValue:_.value,"onUpdate:modelValue":g[0]||(g[0]=t=>_.value=t),placeholder:"\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",clearable:""},null,8,["modelValue"]),y(h,{style:H({height:e.title?"calc(100% - 95px)":"calc(100% - 56px)"})},{default:k(()=>[e.allAccount?(a(),z(r,{key:0,type:b.value?"primary":"",style:{width:"100%","margin-bottom":"5px"},onClick:S},{default:k(()=>[w("\u5168\u90E8\u8D26\u53F7")]),_:1},8,["type"])):B("",!0),y(M(K),{ref_key:"treeRef",ref:n,"default-expand-all":e.expandAll,"default-expanded-keys":e.expandKeys,"node-key":e.id,data:e.multiple?p.value:f.value,"show-checkbox":e.multiple,"check-strictly":!1,"current-node-key":e.multiple?"":o.value,"highlight-current":!e.multiple,"expand-on-click-node":!1,"check-on-click-node":e.multiple,props:F,"filter-node-method":D,"default-checked-keys":e.multiple?o.value:[],onNodeClick:q,onCheck:I},{default:k(t=>[O("span",j,[U(e.$slots,"default",{row:t},()=>[t.node.label.length>7?(a(),d("p",G,[y(i,{effect:"dark","show-after":200,content:t.node.label,placement:"right"},{default:k(()=>[w(c(t.node.label),1)]),_:2},1032,["content"])])):(a(),d("p",L,c(t.node.label),1)),e.type=="areaId"?(a(),d("p",Q,c(t.data[e.type]),1)):(a(),d("p",W,"("+c(t.data[e.type])+")",1))],!0)])]),_:3},8,["default-expand-all","default-expanded-keys","node-key","data","show-checkbox","current-node-key","highlight-current","check-on-click-node","default-checked-keys"])]),_:3},8,["style"])])}}});const te=J(Y,[["__scopeId","data-v-d7294824"]]);export{te as T};
