Files
vben-app/web/dist/js/ViewTree-DrgYPw-D.js
T
2026-10-01 17:05:05 +08:00

2 lines
2.8 KiB
JavaScript

var u=(x,h,s)=>new Promise((r,i)=>{var d=t=>{try{c(s.next(t))}catch(p){i(p)}},n=t=>{try{c(s.throw(t))}catch(p){i(p)}},c=t=>t.done?r(t.value):Promise.resolve(t.value).then(d,n);c((s=s.apply(x,h)).next())});import{aa as I,aT as M,af as R,a8 as D,am as S,aU as F,aV as U,aW as O,t as P,_ as Q}from"./bootstrap-Dvp__AlY.js";import{a7 as W,T as y,X,a0 as Y,a9 as $,b8 as j,aN as z,aw as G,aO as o,ax as _,x as l,aq as g,Y as H,aR as f}from"../jse/index-index-D97IFaZ_.js";const J={style:{display:"flex"}},K={style:{flex:"1",width:"100%"}},L={style:{width:"42px","min-width":"42px"}},Z={style:{"margin-bottom":"45px"}},ee=W({__name:"ViewTree",props:{url:{type:String,required:!0},tip:{type:String,default:"分类名称",required:!1},expand:{type:Boolean,default:!1,required:!1}},emits:["node-click"],setup(x,{expose:h,emit:s}){const r=x,i=s,d=y(""),n=y(),c={children:"children",label:"name"},t=X({data:[],willInit:!0,form:{}}),p=a=>u(null,null,function*(){switch(a){case"collapseAll":{for(let e=0;e<n.value.store._getAllNodes().length;e++)n.value.store._getAllNodes()[e].expanded=!1;break}case"expandAll":{for(let e=0;e<n.value.store._getAllNodes().length;e++)n.value.store._getAllNodes()[e].expanded=!0;break}case"refresh":{yield w();break}case"rootNode":{i("node-click",{id:"",name:""});break}}}),w=()=>u(null,null,function*(){t.data=yield P.get(`${r.url}`,{params:t.form})}),k=(a,e)=>a?e.name.includes(a):!0;Y(d,a=>{n.value.filter(a)});const v=a=>{i("node-click",{id:a.id,name:a.name,type:a.type})};return h({init:()=>u(null,null,function*(){yield w()})}),$(()=>u(null,null,function*(){yield w()})),(a,e)=>{const b=R,N=j("MoreFilled"),C=S,A=D,m=U,E=F,V=O,T=M,q=I;return G(),z(q,{class:"box-card",style:{height:"100%"},"body-style":"height: 100%;overflow: auto","body-class":"thin-scrollbar"},{header:o(()=>[_("div",J,[_("div",K,[l(b,{"prefix-icon":"Search",modelValue:g(d),"onUpdate:modelValue":e[0]||(e[0]=B=>H(d)?d.value=B:null),placeholder:r.tip},null,8,["modelValue","placeholder"])]),_("div",L,[l(V,{onCommand:p},{dropdown:o(()=>[l(E,null,{default:o(()=>[l(m,{command:"expandAll"},{default:o(()=>[...e[1]||(e[1]=[f("全部展开",-1)])]),_:1}),l(m,{command:"collapseAll"},{default:o(()=>[...e[2]||(e[2]=[f("全部折叠",-1)])]),_:1}),l(m,{command:"rootNode"},{default:o(()=>[...e[3]||(e[3]=[f("根目录",-1)])]),_:1}),l(m,{command:"refresh"},{default:o(()=>[...e[4]||(e[4]=[f("刷新",-1)])]),_:1})]),_:1})]),default:o(()=>[l(A,{style:{width:"34px","margin-left":"8px"}},{default:o(()=>[l(C,{class:"el-icon--center"},{default:o(()=>[l(N)]),_:1})]),_:1})]),_:1})])])]),default:o(()=>[_("div",Z,[l(T,{"default-expand-all":r.expand,"highlight-current":"","node-key":"id",ref_key:"treeRef",ref:n,data:g(t).data,props:c,class:"filter-tree","filter-node-method":k,onNodeClick:v},null,8,["default-expand-all","data"])])]),_:1})}}}),ne=Q(ee,[["__scopeId","data-v-a6d73368"]]);export{ne as C};