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