import{_ as x,d as b,m as n,o as v,c as w,h as C,u as g,da as L,b as d}from"./index.e80c366d.js";import{b as N}from"./index.31c623b4.js";const B={class:"max-w-280px w-[280px] h-full min-h-780px bg-white p-2 mt-5px mr-10px"},D=d("div",{class:"flex justify-between mb-1 font-bold"},[d("h1",null,"\u83DC\u5355\u5217\u8868")],-1),S=b({__name:"menu-tree",emits:["treeSelectChange","initTableData"],setup(T,{emit:o}){const f={label:"menu_name",children:"child",isLeaf:"isLeaf"},p=n([]),i=n(null),r=n([]),m=n([]);async function c(t){return new Promise(e=>{N({...t,size:100}).then(a=>{const{code:s,data:l}=a;if(s===1&&l.list.length!==0){const k=l.list.map(u=>({...u,isLeaf:Number(u.is_menu)===0}));e(k)}else e([])}).catch(()=>{e([])})})}async function h(){const e=(await c({}))[0].id;r.value=[e];const a=await c({pid:e});setTimeout(()=>{const s=a[0];i.value.setCurrentKey(s.id),o("treeSelectChange",s)},500)}async function _(t,e){const{id:a}=t.data,s=await c({pid:a});e(s)}function y(t){Number(t.is_menu)!==1&&o("treeSelectChange",t)}return h(),(t,e)=>(v(),w("div",B,[D,C(g(L),{ref_key:"treeRef",ref:i,accordion:"","node-key":"id","highlight-current":"",props:f,data:p.value,lazy:!0,load:_,"default-expanded-keys":r.value,"default-checked-keys":m.value,onNodeClick:y},null,8,["data","default-expanded-keys","default-checked-keys"])]))}});var M=x(S,[["__file","C:/Users/63107/Desktop/projects/report-v3/src/views/system/setBtn/components/menu-tree.vue"]]);export{M as default};
