RoleAssignMenuForm-5e22c52b.js 3.5 KB

1
  1. import{d as J,B as Y,r as o,f as Z,o as C,j as I,w as l,i as t,a as u,m as _,D as z,t as b,R as h,al as P,I as T,E as W,s as G,cZ as L,dY as O,J as Q,q as X,M as $,__tla as ee}from"./index-1e808f2e.js";import{_ as ae,__tla as le}from"./Dialog-f44f9d78.js";import{E as te,__tla as se}from"./el-card-03b3588b.js";import{d as ue,h as de}from"./tree-fd3a041e.js";import{g as oe,__tla as re}from"./index-e7765947.js";import{b as ne,c as ce,__tla as me}from"./index-37347e47.js";import{u as _e,__tla as ie}from"./useMessage-5f9e8917.js";import{_ as fe}from"./_plugin-vue_export-helper-1b428a4d.js";let V,pe=Promise.all([(()=>{try{return ee}catch{}})(),(()=>{try{return le}catch{}})(),(()=>{try{return se}catch{}})(),(()=>{try{return re}catch{}})(),(()=>{try{return me}catch{}})(),(()=>{try{return ie}catch{}})()]).then(async()=>{V=fe(J({name:"SystemRoleAssignMenuForm",__name:"RoleAssignMenuForm",emits:["success"],setup(ve,{expose:w,emit:R}){const{t:M}=Y(),E=_e(),r=o(!1),n=o(!1),s=Z({id:0,name:"",code:"",menuIds:[]}),p=o(),v=o([]),c=o(!1),d=o(),i=o(!1);w({open:async a=>{r.value=!0,A(),v.value=de(await oe({categoryId:a.categoryId})),s.id=a.id,s.name=a.name,s.code=a.code,n.value=!0;try{s.value.menuIds=await ne(a.id),s.value.menuIds.forEach(e=>{d.value.setChecked(e,!0,!1)})}finally{n.value=!1}}});const F=R,U=async()=>{if(p&&await p.value.validate()){n.value=!0;try{const a={roleId:s.id,menuIds:[...d.value.getCheckedKeys(!1),...d.value.getHalfCheckedKeys()]};await ce(a),E.success(M("common.updateSuccess")),r.value=!1,F("success")}finally{n.value=!1}}},A=()=>{var a,e;i.value=!1,c.value=!1,s.value={id:0,name:"",code:"",menuIds:[]},(a=d.value)==null||a.setCheckedNodes([]),(e=p.value)==null||e.resetFields()},H=()=>{d.value.setCheckedNodes(i.value?v.value:[])},K=()=>{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,g=W,N=G,k=L,S=O,j=te,q=Q,x=X,B=ae,D=$;return C(),I(B,{modelValue:u(r),"onUpdate:modelValue":e[3]||(e[3]=m=>h(r)?r.value=m:null),title:"\u83DC\u5355\u6743\u9650"},{footer:l(()=>[t(x,{disabled:u(n),type:"primary",onClick:U},{default:l(()=>[_("\u786E \u5B9A")]),_:1},8,["disabled"]),t(x,{onClick:e[2]||(e[2]=m=>r.value=!1)},{default:l(()=>[_("\u53D6 \u6D88")]),_:1})]),default:l(()=>[z((C(),I(q,{ref_key:"formRef",ref:p,model:u(s),"label-width":"80px"},{default:l(()=>[t(N,{gutter:30},{default:l(()=>[t(g,{span:"12"},{default:l(()=>[t(y,{label:"\u89D2\u8272\u540D\u79F0"},{default:l(()=>[t(f,null,{default:l(()=>[_(b(u(s).name),1)]),_:1})]),_:1})]),_:1}),t(g,{span:"12"},{default:l(()=>[t(y,{label:"\u89D2\u8272\u6807\u8BC6"},{default:l(()=>[t(f,null,{default:l(()=>[_(b(u(s).code),1)]),_:1})]),_:1})]),_:1})]),_:1}),t(y,{label:"\u83DC\u5355\u6743\u9650"},{default:l(()=>[t(j,{class:"cardHeight"},{header:l(()=>[_(" \u5168\u9009/\u5168\u4E0D\u9009: "),t(k,{modelValue:u(i),"onUpdate:modelValue":e[0]||(e[0]=m=>h(i)?i.value=m:null),"active-text":"\u662F","inactive-text":"\u5426","inline-prompt":"",onChange:H},null,8,["modelValue"]),_(" \u5168\u90E8\u5C55\u5F00/\u6298\u53E0: "),t(k,{modelValue:u(c),"onUpdate:modelValue":e[1]||(e[1]=m=>h(c)?c.value=m:null),"active-text":"\u5C55\u5F00","inactive-text":"\u6298\u53E0","inline-prompt":"",onChange:K},null,8,["modelValue"])]),default:l(()=>[t(S,{ref_key:"treeRef",ref:d,data:u(v),props:u(ue),"empty-text":"\u52A0\u8F7D\u4E2D\uFF0C\u8BF7\u7A0D\u5019","node-key":"id","show-checkbox":""},null,8,["data","props"])]),_:1})]),_:1})]),_:1},8,["model"])),[[D,u(n)]])]),_:1},8,["modelValue"])}}}),[["__scopeId","data-v-3000774a"]])});export{pe as __tla,V as default};