var w=(h,_,l)=>new Promise((g,c)=>{var y=e=>{try{r(l.next(e))}catch(u){c(u)}},v=e=>{try{r(l.throw(e))}catch(u){c(u)}},r=e=>e.done?g(e.value):Promise.resolve(e.value).then(y,v);r((l=l.apply(h,_)).next())});import{a as G,z as I,b as s,o as E,c as S,w as a,e as n,K as k,u as i,V as K,E as p,G as $,aP as H,a$ as R,b0 as U,i as j,U as q,a5 as F,aa as J}from"./ant-design-vue-710243d9.js";import{a as Q,f as P,g as C}from"./index-2a45336b.js";import{u as W}from"./usePagination-7442a465.js";import{l as X,w as M,f as Y}from"./lodash-es-7cb071db.js";import"./tinymce-3184e0f1.js";import"./echarts-ca5d9323.js";import"./cropper-47c8e461.js";import"./qrcode-bec2257a.js";import"./jschardet-bd496279.js";const Z={class:"ant-tree-title__name"},ee={class:"ant-tree-title__actions"},pe={__name:"Menu",props:{value:{type:String,default:""}},emits:["change","update:value"],setup(h,{emit:_}){const l=h,g=Q(),{listData:c,loading:y,showLoading:v,hideLoading:r}=W(),e=G([l.value]);I(()=>l.value,t=>{var o;t!==((o=e.value)==null?void 0:o[0])&&(e.value=[t])}),u();function u(){return w(this,null,function*(){try{v();const{code:t,data:o}=yield P.common.getPageList().catch(()=>{throw new Error});if(r(),C("http.code.success")===t){const{records:d}=o;c.value=d,c.value.length&&(e.value=[X(M(c.value),"id")],x())}}catch(t){r()}})}function L({id:t}){F.confirm({title:"删除提示",content:"确认删除？",okText:"确认",onOk:()=>new Promise((o,d)=>{w(this,null,function*(){try{const{code:m}=yield P.common.del(t).catch(()=>{throw new Error});C("http.code.success")===m&&(o(),J.success("删除成功"),yield u())}catch(m){d()}})})})}function N(t){t.length&&(e.value=t,x())}function x(){const t=M(e.value),o=Y(c.value,{id:t});_("update:value",t),_("change",o)}return(t,o)=>{const d=s("a-input-search"),m=s("x-action-button"),f=s("a-menu-item"),V=s("a-menu"),D=s("a-dropdown"),B=s("a-tree"),O=s("a-empty"),T=s("a-spin"),z=s("x-scrollbar"),A=s("a-card");return E(),S(A,{"body-style":{height:"calc(100% - 56px - 47px)",padding:0},style:q({height:i(g).mainHeight})},{title:a(()=>[n(d,{"allow-clear":"",placeholder:"搜索菜单"})]),actions:a(()=>[k("span",null,[n(i(K)),p(" 新建菜单 ")])]),default:a(()=>[n(z,{class:"pa-8-2"},{default:a(()=>[n(T,{spinning:i(y)},{default:a(()=>[n(B,{"block-node":"","default-expand-all":"","field-names":{children:"children",key:"id"},"selected-keys":e.value,"tree-data":i(c),onSelect:N},{title:a(b=>[k("span",Z,$(b.title),1),k("span",ee,[n(D,{trigger:["click"],onClick:o[0]||(o[0]=H(()=>{},["stop"]))},{overlay:a(()=>[n(V,null,{default:a(()=>[n(f,null,{default:a(()=>[p("添加下级")]),_:1}),n(f,null,{default:a(()=>[p("克隆")]),_:1}),n(f,null,{default:a(()=>[p("编辑")]),_:1}),n(f,{onClick:te=>L(b)},{default:a(()=>[p("删除")]),_:2},1032,["onClick"])]),_:2},1024)]),default:a(()=>[n(m,null,{default:a(()=>[n(i(R))]),_:1})]),_:2},1024)])]),_:1},8,["selected-keys","tree-data"]),i(c).length?j("",!0):(E(),S(O,{key:0,image:i(U).PRESENTED_IMAGE_SIMPLE},null,8,["image"]))]),_:1},8,["spinning"])]),_:1})]),_:1},8,["body-style","style"])}}};export{pe as default};
