import{g as y,e as A,f as b}from"./index-8db2df2c.js";import{T as S,S as x,f as w}from"./ui-ba7aaa7e.js";import{e as C,r as s,P as l,a3 as m,a4 as i,f as U,Q as B,F as T,aa as D,H as F,ab as N}from"./vue-bf422dc1.js";const $=C({__name:"AddMenu",emits:["refresh"],setup(V,{expose:f,emit:_}){const c=s([]);(async()=>{const e=await y();e.code&&(c.value=e.data)})();const a=s([]),u=async()=>{const e=await A();e.code&&e.data!==void 0&&(a.value=e.data)};u();const n=s(!1),p=s("添加菜单"),v=_,g=async e=>{if(a.value.length>0&&a.value.some(r=>r.menu_id===e))return;(await b({menu_id:e})).code&&(u(),v("refresh"))};return f({init:()=>{n.value=!0}}),(e,o)=>{const r=S,h=x,M=w;return l(),m(M,{visible:n.value,"onUpdate:visible":o[0]||(o[0]=t=>n.value=t),"close-on-overlay-click":!1,"destroy-on-close":!0,header:p.value,footer:!1},{default:i(()=>[U(h,{align:"center","break-line":""},{default:i(()=>[(l(!0),B(T,null,D(c.value,(t,k)=>(l(),m(r,{key:k,theme:a.value.some(d=>d.id===t.id)?"default":"primary",onClick:d=>g(t.id)},{default:i(()=>[F(N(t.title),1)]),_:2},1032,["theme","onClick"]))),128))]),_:1})]),_:1},8,["visible","header"])}}});export{$ as _};
