RoleAssignMenuForm-7e3dab9c.js 3.5 KB

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