import{d as e,r as a,R as l,W as t,ad as d,a as n,b as u,h as s,t as o,l as i,e as r,w as c,f as p,ah as f,k as y,p as h,j as k,K as m,_ as v}from"./index-d052b22f-1780912037814v=1.0.0.js";const x={class:"filter"},b={key:0,class:"title sle"},_={class:"el-tree-node__label"},g={key:0},V={key:1},A={key:2},w={key:3},K=e({name:"TreeFilter"}),q=v(e({...K,props:{requestApi:{},data:{},title:{},id:{default:"company_area_id"},label:{default:"name"},multiple:{type:Boolean,default:!1},defaultValue:{},expandAll:{type:Boolean,default:!1},expandKeys:{default:[]},type:{default:"company_area_id"}},emits:["change"],setup(e,{expose:v,emit:K}){const q=e,C={children:"next",label:q.label},R=a(),j=a([]),B=a([]),D=a(),T=()=>{q.multiple?D.value=Array.isArray(q.defaultValue)?q.defaultValue:[q.defaultValue]:D.value="string"==typeof q.defaultValue?q.defaultValue:""};l((async()=>{if(T(),q.requestApi){const{data:e}=await q.requestApi();j.value=e,B.value=[{id:"",[q.label]:"全部"},...e]}})),t((()=>q.defaultValue),(()=>d((()=>T()))),{deep:!0,immediate:!0}),t((()=>q.data),(()=>{var e;(null==(e=q.data)?void 0:e.length)&&(j.value=q.data,B.value=[...q.data])}),{deep:!0,immediate:!0});const F=a("");t(F,(e=>{R.value.filter(e)}));const I=(e,a,l)=>{if(!e)return!0;let t=l.parent,d=[l.label],n=1;for(;n<l.level;)d=[...d,t.label],t=t.parent,n++;return d.some((a=>-1!==a.indexOf(e)))},N=K,O=e=>{q.multiple||N("change",e[q.id])},U=()=>{var e;N("change",null==(e=R.value)?void 0:e.getCheckedKeys())};return v({treeData:j,treeAllData:B,treeRef:R}),(e,a)=>{const l=n("el-input"),t=n("el-tooltip"),d=n("el-scrollbar");return u(),s("div",x,[e.title?(u(),s("h4",b,o(e.title),1)):i("v-if",!0),r(l,{modelValue:F.value,"onUpdate:modelValue":a[0]||(a[0]=e=>F.value=e),placeholder:"输入关键字进行过滤",clearable:""},null,8,["modelValue"]),r(d,{style:m({height:e.title?"calc(100% - 95px)":"calc(100% - 56px)"})},{default:c((()=>[r(p(f),{ref_key:"treeRef",ref:R,"default-expand-all":e.expandAll,"default-expanded-keys":e.expandKeys,"node-key":e.id,data:e.multiple?j.value:B.value,"show-checkbox":e.multiple,"check-strictly":!1,"current-node-key":e.multiple?"":D.value,"highlight-current":!e.multiple,"expand-on-click-node":!1,"check-on-click-node":e.multiple,props:C,"filter-node-method":I,"default-checked-keys":e.multiple?D.value:[],onNodeClick:O,onCheck:U},{default:c((a=>[y("span",_,[h(e.$slots,"default",{row:a},(()=>[a.node.label.length>7?(u(),s("p",g,[r(t,{effect:"dark","show-after":200,content:a.node.label,placement:"right"},{default:c((()=>[k(o(a.node.label),1)])),_:2},1032,["content"])])):(u(),s("p",V,o(a.node.label),1)),"company_area_id"==e.type?(u(),s("p",A,o(a.data[e.type]),1)):(u(),s("p",w,"("+o(a.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"])])}}}),[["__scopeId","data-v-ee0dd796"]]);export{q as T};
