import{d as W,n as X,r as o,f as $,o as C,l as b,w as a,i as t,a as u,j as m,C as q,t as w,y as h,ak as B,H as P,E as Z,s as G,b$ as L,dW as O,K as Q,J as T,N as Y,_ as ee,__tla as ae}from"./index-b2b3c6c4.js";import{_ as le,__tla as te}from"./Dialog-70b24cbf.js";import{E as se,__tla as ue}from"./el-card-bd6e27c9.js";import{d as de,h as oe}from"./tree-0af4953a.js";import{g as ne,__tla as re}from"./index-9f4fa20b.js";import{g as _e,a as ie,__tla as me}from"./index-f119fff1.js";import{u as ce,__tla as fe}from"./useMessage-a5edbb0f.js";let V,ve=Promise.all([(()=>{try{return ae}catch{}})(),(()=>{try{return te}catch{}})(),(()=>{try{return ue}catch{}})(),(()=>{try{return re}catch{}})(),(()=>{try{return me}catch{}})(),(()=>{try{return fe}catch{}})()]).then(async()=>{V=ee(W({name:"SystemRoleAssignMenuForm",__name:"RoleAssignMenuForm",emits:["success"],setup(pe,{expose:I,emit:R}){const{t:F}=X(),H=ce(),n=o(!1),r=o(!1),s=$({id:0,name:"",code:"",menuIds:[]}),v=o(),p=o([]),_=o(!1),d=o(),c=o(!1);I({open:async l=>{n.value=!0,A(),p.value=oe(await ne()),s.id=l.id,s.name=l.name,s.code=l.code,r.value=!0;try{s.value.menuIds=await _e(l.id),s.value.menuIds.forEach(e=>{d.value.setChecked(e,!0,!1)})}finally{r.value=!1}}});const M=R,U=async()=>{if(v&&await v.value.validate()){r.value=!0;try{const l={roleId:s.id,menuIds:[...d.value.getCheckedKeys(!1),...d.value.getHalfCheckedKeys()]};await ie(l),H.success(F("common.updateSuccess")),n.value=!1,M("success")}finally{r.value=!1}}},A=()=>{var l,e;c.value=!1,_.value=!1,s.value={id:0,name:"",code:"",menuIds:[]},(l=d.value)==null||l.setCheckedNodes([]),(e=v.value)==null||e.resetFields()},E=()=>{d.value.setCheckedNodes(c.value?p.value:[])},K=()=>{var e;const l=(e=d.value)==null?void 0:e.store.nodesMap;for(let f in l)l[f].expanded!==_.value&&(l[f].expanded=_.value)};return(l,e)=>{const f=B,y=P,k=Z,N=G,x=L,j=O,S=se,z=Q,g=T,D=le,J=Y;return C(),b(D,{modelValue:u(n),"onUpdate:modelValue":e[3]||(e[3]=i=>h(n)?n.value=i:null),title:"\u83DC\u5355\u6743\u9650"},{footer:a(()=>[t(g,{disabled:u(r),type:"primary",onClick:U},{default:a(()=>[m("\u786E \u5B9A")]),_:1},8,["disabled"]),t(g,{onClick:e[2]||(e[2]=i=>n.value=!1)},{default:a(()=>[m("\u53D6 \u6D88")]),_:1})]),default:a(()=>[q((C(),b(z,{ref_key:"formRef",ref:v,model:u(s),"label-width":"80px"},{default:a(()=>[t(N,{gutter:30},{default:a(()=>[t(k,{span:"12"},{default:a(()=>[t(y,{label:"\u89D2\u8272\u540D\u79F0"},{default:a(()=>[t(f,null,{default:a(()=>[m(w(u(s).name),1)]),_:1})]),_:1})]),_:1}),t(k,{span:"12"},{default:a(()=>[t(y,{label:"\u89D2\u8272\u6807\u8BC6"},{default:a(()=>[t(f,null,{default:a(()=>[m(w(u(s).code),1)]),_:1})]),_:1})]),_:1})]),_:1}),t(y,{label:"\u83DC\u5355\u6743\u9650"},{default:a(()=>[t(S,{class:"cardHeight"},{header:a(()=>[m(" \u5168\u9009/\u5168\u4E0D\u9009: "),t(x,{modelValue:u(c),"onUpdate:modelValue":e[0]||(e[0]=i=>h(c)?c.value=i:null),"active-text":"\u662F","inactive-text":"\u5426","inline-prompt":"",onChange:E},null,8,["modelValue"]),m(" \u5168\u90E8\u5C55\u5F00/\u6298\u53E0: "),t(x,{modelValue:u(_),"onUpdate:modelValue":e[1]||(e[1]=i=>h(_)?_.value=i:null),"active-text":"\u5C55\u5F00","inactive-text":"\u6298\u53E0","inline-prompt":"",onChange:K},null,8,["modelValue"])]),default:a(()=>[t(j,{ref_key:"treeRef",ref:d,data:u(p),props:u(de),"empty-text":"\u52A0\u8F7D\u4E2D\uFF0C\u8BF7\u7A0D\u5019","node-key":"id","show-checkbox":""},null,8,["data","props"])]),_:1})]),_:1})]),_:1},8,["model"])),[[J,u(r)]])]),_:1},8,["modelValue"])}}}),[["__scopeId","data-v-4316139b"],["__file","/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-admin/src/views/system/role/RoleAssignMenuForm.vue"]])});export{ve as __tla,V as default};
