import{B as O,T as j,D as q,E as H,F as I,N as U}from"./element-plus.ae09c4a0.js";import{a as W}from"./role.f1a9603c.js";import{P as z}from"./index.e64ff1d1.js";import{s as G}from"./index.80696382.js";import{m as J}from"./menu.2165bc84.js";import{d as Q,s as f,r as u,a0 as X,o as k,c as Y,W as o,O as i,P as Z,M as $,u as c,a as y,j as ee,n as x}from"./@vue.a7a54728.js";const te={class:"edit-popup"},re=Q({__name:"auth",emits:["success","close"],setup(le,{expose:C,emit:b}){const _=b,s=f(),h=f(),d=f(),g=u(!1),r=u(!0),m=u(!1),v=u([]),p=u([]),a=X({id:"",name:"",desc:"",sort:0,menu_id:[]}),E={name:[{required:!0,message:"\u8BF7\u8F93\u5165\u540D\u79F0",trigger:["blur"]}]},D=()=>{m.value=!0,J().then(e=>{p.value=e,v.value=G(e),x(()=>{F()}),m.value=!1})},w=()=>{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},F=()=>{a.menu_id.forEach(e=>{x(()=>{var t;(t=s.value)==null||t.setChecked(e,!0,!1)})})},R=e=>{const t=p.value;for(let l=0;l<t.length;l++)s.value.store.nodesMap[t[l].id].expanded=e},A=e=>{var t,l;e?(t=s.value)==null||t.setCheckedKeys(v.value.map(n=>n.id)):(l=s.value)==null||l.setCheckedKeys([])},B=async()=>{var e,t;await((e=h.value)==null?void 0:e.validate()),a.menu_id=w(),await W(a),(t=d.value)==null||t.close(),_("success")},K=()=>{_("close")},T=()=>{var e;(e=d.value)==null||e.open()},V=async e=>{for(const t in a)e[t]!=null&&e[t]!=null&&(a[t]=e[t])};return D(),C({open:T,setFormData:V}),(e,t)=>{const l=O,n=j,S=q,N=H,P=I,L=U;return k(),Y("div",te,[o(z,{ref_key:"popupRef",ref:d,title:"\u5206\u914D\u6743\u9650",async:!0,width:"550px",onConfirm:B,onClose:K},{default:i(()=>[Z((k(),$(P,{class:"ls-form",ref_key:"formRef",ref:h,rules:E,model:c(a),"label-width":"60px"},{default:i(()=>[o(N,{class:"h-[400px] sm:h-[600px]"},{default:i(()=>[o(S,{label:"\u6743\u9650",prop:"menu_id"},{default:i(()=>[y("div",null,[o(l,{label:"\u5C55\u5F00/\u6298\u53E0",onChange:R}),o(l,{label:"\u5168\u9009/\u4E0D\u5168\u9009",onChange:A}),o(l,{modelValue:c(r),"onUpdate:modelValue":t[0]||(t[0]=M=>ee(r)?r.value=M:null),label:"\u7236\u5B50\u8054\u52A8"},null,8,["modelValue"]),y("div",null,[o(n,{ref_key:"treeRef",ref:s,data:c(p),props:{label:"name",children:"children"},"check-strictly":!c(r),"node-key":"id","default-expand-all":c(g),"show-checkbox":""},null,8,["data","check-strictly","default-expand-all"])])])]),_:1})]),_:1})]),_:1},8,["model"])),[[L,c(m)]])]),_:1},512)])}}});export{re as _};
