import{ar as k,d as _a,r as e,R as ca,o as d,c as U,g as s,w as y,a as _,y as E,h as v,t as ua,P as L,x as j,n as K,F as na,B as ia,G as sa,D as oa,J as ma,p as pa,k as da,_ as ya,__tla as va}from"./index-b362e1d5.js";import{_ as ha,__tla as fa}from"./ContentWrap-a3bb871b.js";import Ma,{__tla as xa}from"./main-f3c4e109.js";import ga,{__tla as Ua}from"./MenuEditor-e175a40f.js";import ba,{__tla as Ia}from"./MenuPreviewer-86a102c5.js";import{h as wa}from"./tree-0af4953a.js";import{u as Ta,__tla as Ca}from"./useMessage-7c1dd10e.js";import{__tla as ka}from"./el-card-732e29b8.js";import{__tla as Ea}from"./index-242a34bc.js";import{__tla as Da}from"./main-e4e4a6c7.js";import{__tla as Va}from"./TabNews-4ede9ed1.js";import{__tla as qa}from"./main-8cbf99b6.js";import{__tla as Sa}from"./el-image-6c94a1ed.js";import{__tla as za}from"./el-image-viewer-68ae3e49.js";import{__tla as Aa}from"./main-5121aed8.js";import{__tla as Pa}from"./index-ccc64a6d.js";import{__tla as $a}from"./index-39b44010.js";import{__tla as Fa}from"./main-3a54b460.js";import{__tla as Ha}from"./main-3514c588.js";import{__tla as Na}from"./index-4c0e0c51.js";import{__tla as Oa}from"./index-6614cf2c.js";import{__tla as Ra}from"./formatTime-053b1c05.js";import{__tla as Ba}from"./TabText-4dd36556.js";import{__tla as Ga}from"./TabImage-abae8133.js";import{__tla as Ja}from"./useUpload-017e3ac5.js";import{__tla as La}from"./TabVoice-bac959c3.js";import{__tla as ja}from"./TabVideo-55623e20.js";import{__tla as Ka}from"./TabMusic-7b656c14.js";import{__tla as Qa}from"./vuedraggable.umd-c5f7eb02.js";let Q,Wa=Promise.all([(()=>{try{return va}catch{}})(),(()=>{try{return fa}catch{}})(),(()=>{try{return xa}catch{}})(),(()=>{try{return Ua}catch{}})(),(()=>{try{return Ia}catch{}})(),(()=>{try{return Ca}catch{}})(),(()=>{try{return ka}catch{}})(),(()=>{try{return Ea}catch{}})(),(()=>{try{return Da}catch{}})(),(()=>{try{return Va}catch{}})(),(()=>{try{return qa}catch{}})(),(()=>{try{return Sa}catch{}})(),(()=>{try{return za}catch{}})(),(()=>{try{return Aa}catch{}})(),(()=>{try{return Pa}catch{}})(),(()=>{try{return $a}catch{}})(),(()=>{try{return Fa}catch{}})(),(()=>{try{return Ha}catch{}})(),(()=>{try{return Na}catch{}})(),(()=>{try{return Oa}catch{}})(),(()=>{try{return Ra}catch{}})(),(()=>{try{return Ba}catch{}})(),(()=>{try{return Ga}catch{}})(),(()=>{try{return Ja}catch{}})(),(()=>{try{return La}catch{}})(),(()=>{try{return ja}catch{}})(),(()=>{try{return Ka}catch{}})(),(()=>{try{return Qa}catch{}})()]).then(async()=>{let D,V,q,S,z,A,P,$,F,x;D={class:"clearfix public-account-management"},V={class:"left"},q={class:"weixin-hd"},S={class:"weixin-title"},z={class:"clearfix weixin-menu"},A={class:"save_div"},P={key:0,class:"right"},$={key:1,class:"right"},F=[(g=>(pa("data-v-e74cfd0c"),g=g(),da(),g))(()=>v("p",null,"\u8BF7\u9009\u62E9\u83DC\u5355\u914D\u7F6E",-1))],x="__MENU_NOT_SELECTED__",Q=ya(_a({name:"MpMenu",__name:"index",setup(g){const o=Ta(),c=e(!1),m=e(-1),H=e(""),u=e([]),h=e(x),b=e(-1),f=e(!1),I=e(!0),n=e({}),r=e({grand:"0",x:0,y:0}),W=e(!1),X=(t,a)=>{m.value=t,H.value=a,w()},w=async()=>{c.value=!1;try{const t=await(l=>k.get({url:"/mp/menu/list?accountId="+l}))(m.value),a=Y(t);u.value=wa(a,"id")}finally{c.value=!1}},Y=t=>{if(!t)return[];const a=[];return t.forEach(l=>{const p={...l};p.reply={type:l.replyMessageType,accountId:l.accountId,content:l.replyContent,mediaId:l.replyMediaId,url:l.replyMediaUrl,title:l.replyTitle,description:l.replyDescription,thumbMediaId:l.replyThumbMediaId,thumbMediaUrl:l.replyThumbMediaUrl,articles:l.replyArticles,musicUrl:l.replyMusicUrl,hqMusicUrl:l.replyHqMusicUrl},a.push(p)}),a},Z=()=>{h.value=x,b.value=-1,f.value=!1,n.value={},r.value={grand:"0",x:0,y:0},W.value=!1},aa=async()=>{var t;try{await o.confirm("\u786E\u5B9A\u8981\u5220\u9664\u5417?"),r.value.grand==="1"?u.value.splice(r.value.x,1):r.value.grand==="2"&&((t=u.value[r.value.x].children)==null||t.splice(r.value.y,1)),o.notifySuccess("\u5220\u9664\u6210\u529F"),n.value={},f.value=!1,h.value=x}catch{}},ta=async()=>{try{await o.confirm("\u786E\u5B9A\u8981\u4FDD\u5B58\u5417?"),c.value=!0,await((t,a)=>k.post({url:"/mp/menu/save",data:{accountId:t,menus:a}}))(m.value,ra()),w(),o.notifySuccess("\u53D1\u5E03\u6210\u529F")}finally{c.value=!1}},la=async()=>{try{await o.confirm("\u786E\u5B9A\u8981\u5220\u9664\u5417?"),c.value=!0,await(t=>k.delete({url:"/mp/menu/delete?accountId="+t}))(m.value),Z(),w(),o.notifySuccess("\u6E05\u7A7A\u6210\u529F")}finally{c.value=!1}},ra=()=>{const t=[];return u.value.forEach(a=>{const l=N(a);t.push(l),!a.children||a.children.length<=0||(l.children=[],a.children.forEach(p=>{l.children.push(N(p))}))}),t},N=t=>{let a={...t,children:void 0,reply:void 0};return a.replyMessageType=t.reply.type,a.replyContent=t.reply.content,a.replyMediaId=t.reply.mediaId,a.replyMediaUrl=t.reply.url,a.replyTitle=t.reply.title,a.replyDescription=t.reply.description,a.replyThumbMediaId=t.reply.thumbMediaId,a.replyThumbMediaUrl=t.reply.thumbMediaUrl,a.replyArticles=t.reply.articles,a.replyMusicUrl=t.reply.musicUrl,a.replyHqMusicUrl=t.reply.hqMusicUrl,a};return(t,a)=>{const l=ia,p=sa,O=ha,R=oa,B=ca("hasPermi"),ea=ma;return d(),U(na,null,[s(O,null,{default:y(()=>[s(p,{class:"-mb-15px",ref:"queryFormRef",inline:!0,"label-width":"68px"},{default:y(()=>[s(l,{label:"\u516C\u4F17\u53F7",prop:"accountId"},{default:y(()=>[s(_(Ma),{onChange:X})]),_:1})]),_:1},512)]),_:1}),s(O,null,{default:y(()=>[E((d(),U("div",D,[v("div",V,[v("div",q,[v("div",S,ua(_(H)),1)]),v("div",z,[s(ba,{modelValue:_(u),"onUpdate:modelValue":a[0]||(a[0]=i=>L(u)?u.value=i:null),"account-id":_(m),"active-index":_(h),"parent-index":_(b),onMenuClicked:a[1]||(a[1]=(i,T)=>((C,M)=>{f.value=!0,n.value=C,r.value.grand="1",r.value.x=M,I.value=!0,h.value=`${M}`,b.value=M})(i,T)),onSubmenuClicked:a[2]||(a[2]=(i,T,C)=>((M,G,J)=>{f.value=!0,n.value=M,r.value.grand="2",r.value.x=G,r.value.y=J,I.value=!1,h.value=`${G}-${J}`})(i,T,C))},null,8,["modelValue","account-id","active-index","parent-index"])]),v("div",A,[E((d(),j(R,{class:"save_btn",type:"success",onClick:ta},{default:y(()=>[K("\u4FDD\u5B58\u5E76\u53D1\u5E03\u83DC\u5355")]),_:1})),[[B,["mp:menu:save"]]]),E((d(),j(R,{class:"save_btn",type:"danger",onClick:la},{default:y(()=>[K("\u6E05\u7A7A\u83DC\u5355")]),_:1})),[[B,["mp:menu:delete"]]])])]),_(f)?(d(),U("div",P,[s(ga,{"account-id":_(m),"is-parent":_(I),modelValue:_(n),"onUpdate:modelValue":a[3]||(a[3]=i=>L(n)?n.value=i:null),onDelete:aa},null,8,["account-id","is-parent","modelValue"])])):(d(),U("div",$,[...F]))])),[[ea,_(c)]])]),_:1})],64)}}}),[["__scopeId","data-v-e74cfd0c"],["__file","D:/zx/mall-newfeifan-zx-admin/src/views/mp/menu/index.vue"]])});export{Wa as __tla,Q as default};