var u=(n,l,e)=>new Promise((f,o)=>{var c=t=>{try{d(e.next(t))}catch(a){o(a)}},r=t=>{try{d(e.throw(t))}catch(a){o(a)}},d=t=>t.done?f(t.value):Promise.resolve(t.value).then(c,r);d((e=e.apply(n,l)).next())});import{l as b}from"./menu-manage-faee0c27.js";import{d as x,r as C}from"./role-manage-91cdffc1.js";import{d as I,r as p,K as g,j as m,o as B,h as D,w as i,e as v,k,E as K,_ as M}from"./index-90c78f99.js";const N=I({__name:"auth-drawer",props:{visible:{type:Boolean,default:!1,required:!0},data:Object},emits:["close"],setup(n,{emit:l}){const e=n,f=a=>a&&a.children&&a.children.length?null:"is-last-level",o=p(),c=p([]),r=p([]),d=()=>u(this,null,function*(){const a=(yield b({roleId:e.data&&e.data.roleId})).data;c.value=a}),t=()=>u(this,null,function*(){const a=o.value.getCheckedKeys();yield C({menuIds:a,id:e.data&&e.data.roleId}),K.success("配置权限成功！"),l("close",!0)});return g(()=>e.visible,a=>u(this,null,function*(){if(a){if(d(),e.data&&e.data.roleId){const s=(yield x({id:e.data&&e.data.roleId})).data;r.value=s&&s.menu.map(_=>_.id)}}else r.value=[]})),(a,s)=>{const _=m("el-tree"),y=m("el-button"),h=m("el-drawer");return B(),D(h,{"model-value":n.visible,title:"权限配置",size:640,onClose:s[1]||(s[1]=w=>l("close"))},{footer:i(()=>[v(y,{type:"primary",onClick:t},{default:i(()=>[k("确定")]),_:1}),v(y,{onClick:s[0]||(s[0]=w=>l("close"))},{default:i(()=>[k("取消")]),_:1})]),default:i(()=>[v(_,{ref_key:"menuTreeRef",ref:o,data:c.value,"show-checkbox":"","default-expand-all":"","node-key":"id","default-checked-keys":r.value,props:{class:f,label:"title",value:"id"}},null,8,["data","default-checked-keys","props"])]),_:1},8,["model-value"])}}});const V=M(N,[["__scopeId","data-v-ba0fa1a3"]]);export{V as default};
