menu-tree.25a3870b.js 1.4 KB

1
  1. import{_ as x,d as b,m as a,o as v,c as w,h as C,u as g,db as L,b as d}from"./index.56449854.js";import{b as N}from"./index.77a8b055.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=a([]),i=a(null),r=a([]),m=a([]);async function c(t){return new Promise(e=>{N({...t,size:100}).then(n=>{const{code:s,data:l}=n;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 n=await c({pid:e});setTimeout(()=>{const s=n[0];i.value.setCurrentKey(s.id),o("treeSelectChange",s)},500)}async function _(t,e){const{id:n}=t.data,s=await c({pid:n});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/89793/Desktop/projects/report-v3/src/views/system/setBtn/components/menu-tree.vue"]]);export{M as default};