import{F as P,S as q,C as H,s as I,D as U,M as Z}from"./element-plus-z3MwpXC9.js";import{m as j}from"./menu-EcGxOY7f.js";import{a as z}from"./role-ClqAnN92.js";import{P as G}from"./index-CdmO5-Ss.js";import{t as J}from"./index-DXEGVToZ.js";import{d as Q,s as f,r,Z as W,o as k,c as X,V as o,M as d,O as Y,L as $,u as c,a as y,i as ee,n as x}from"./@vue-TMcuEboY.js";const te={class:"edit-popup"},ie=Q({__name:"auth",emits:["success","close"],setup(le,{expose:C,emit:b}){const _=b,s=f(),h=f(),u=f(),g=r(!1),i=r(!0),m=r(!1),v=r([]),p=r([]),a=W({id:"",name:"",desc:"",sort:0,menu_id:[]}),E={name:[{required:!0,message:"请输入名称",trigger:["blur"]}]},w=()=>{m.value=!0,j().then(e=>{p.value=e,v.value=J(e),x(()=>{A()}),m.value=!1})},R=()=>{var l,n;const e=(l=s.value)==null?void 0:l.getCheckedKeys(),t=(n=s.value)==null?void 0:n.getHalfCheckedKeys();return e==null||e.unshift.apply(e,t),e},A=()=>{a.menu_id.forEach(e=>{x(()=>{var t;(t=s.value)==null||t.setChecked(e,!0,!1)})})},D=e=>{const t=p.value;for(let l=0;l<t.length;l++)s.value.store.nodesMap[t[l].id].expanded=e},K=e=>{var t,l;e?(t=s.value)==null||t.setCheckedKeys(v.value.map(n=>n.id)):(l=s.value)==null||l.setCheckedKeys([])},V=async()=>{var e,t;await((e=h.value)==null?void 0:e.validate()),a.menu_id=R(),await z(a),(t=u.value)==null||t.close(),_("success")},S=()=>{_("close")},B=()=>{var e;(e=u.value)==null||e.open()},F=async e=>{for(const t in a)e[t]!=null&&e[t]!=null&&(a[t]=e[t])};return w(),C({open:B,setFormData:F}),(e,t)=>{const l=P,n=q,T=H,L=I,M=U,N=Z;return k(),X("div",te,[o(G,{ref_key:"popupRef",ref:u,title:"分配权限",async:!0,width:"550px",onConfirm:V,onClose:S},{default:d(()=>[Y((k(),$(M,{class:"ls-form",ref_key:"formRef",ref:h,rules:E,model:c(a),"label-width":"60px"},{default:d(()=>[o(L,{class:"h-[400px] sm:h-[600px]"},{default:d(()=>[o(T,{label:"权限",prop:"menu_id"},{default:d(()=>[y("div",null,[o(l,{label:"展开/折叠",onChange:D}),o(l,{label:"全选/不全选",onChange:K}),o(l,{modelValue:c(i),"onUpdate:modelValue":t[0]||(t[0]=O=>ee(i)?i.value=O:null),label:"父子联动"},null,8,["modelValue"]),y("div",null,[o(n,{ref_key:"treeRef",ref:s,data:c(p),props:{label:"name",children:"children"},"check-strictly":!c(i),"node-key":"id","default-expand-all":c(g),"show-checkbox":""},null,8,["data","check-strictly","default-expand-all"])])])]),_:1})]),_:1})]),_:1},8,["model"])),[[N,c(m)]])]),_:1},512)])}}});export{ie as _};
