RoleAssignMenuForm-1f056dd8.js 3.5 KB

1
  1. import{d as Y,P as q,r as o,x as z,o as C,C as V,A as l,f as t,a as u,D as m,k as B,E as b,a1 as h,av as G,U as L,H as O,K as Q,cC as T,e1 as W,V as X,J as Z,Y as $,__tla as ee}from"./index-92ee0c67.js";import{_ as ae,__tla as le}from"./Dialog-81b4474b.js";import{E as te,__tla as se}from"./el-card-82c8630d.js";import{d as ue,h as de}from"./tree-0af4953a.js";import{g as oe,__tla as re}from"./index-bcc811be.js";import{b as ne,c as ce,__tla as _e}from"./index-7532570a.js";import{u as me,__tla as ie}from"./useMessage-f82a8260.js";import{_ as fe}from"./_plugin-vue_export-helper-1b428a4d.js";let I,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()=>{I=fe(Y({name:"SystemRoleAssignMenuForm",__name:"RoleAssignMenuForm",emits:["success"],setup(pe,{expose:w,emit:R}){const{t:U}=q(),A=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,E(),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,M=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),A.success(U("common.updateSuccess")),r.value=!1,F("success")}finally{n.value=!1}}},E=()=>{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()},H=()=>{d.value.setCheckedNodes(i.value?p.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=G,y=L,k=O,D=Q,x=T,N=W,P=te,S=X,g=Z,j=ae,J=$;return C(),V(j,{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:M},{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(()=>[B((C(),V(S,{ref_key:"formRef",ref:v,model:u(s),"label-width":"80px"},{default:l(()=>[t(D,{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(b(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(b(u(s).code),1)]),_:1})]),_:1})]),_:1})]),_:1}),t(y,{label:"\u83DC\u5355\u6743\u9650"},{default:l(()=>[t(P,{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:H},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:K},null,8,["modelValue"])]),default:l(()=>[t(N,{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"])),[[J,u(n)]])]),_:1},8,["modelValue"])}}}),[["__scopeId","data-v-3000774a"]])});export{ve as __tla,I as default};