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