import{_ as x,d as b,w as s,o as w,c as v,l as C,u as g,bo as L,b as d}from"./index.1d5f2f42.js";import{b as N}from"./index.cb757309.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=s([]),i=s(null),l=s([]),m=s([]);async function c(t){return new Promise(e=>{N(t).then(a=>{const{code:n,data:r}=a;if(n===1&&r.list.length!==0){const k=r.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;l.value=[e];const a=await c({pid:e});setTimeout(()=>{const n=a[0];i.value.setCurrentKey(n.id),o("treeSelectChange",n)},500)}async function _(t,e){const{id:a}=t.data,n=await c({pid:a});e(n)}function y(t){Number(t.is_menu)!==1&&o("treeSelectChange",t)}return h(),(t,e)=>(w(),v("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":l.value,"default-checked-keys":m.value,onNodeClick:y},null,8,["data","default-expanded-keys","default-checked-keys"])]))}});var M=x(S,[["__file","D:/work/rep-v3/report-v3/src/views/system/setBtn/components/menu-tree.vue"]]);export{M as default};
