You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
3.5 KiB
JavaScript
2 lines
3.5 KiB
JavaScript
var v=(g,C,d)=>new Promise((f,h)=>{var n=o=>{try{m(d.next(o))}catch(s){h(s)}},i=o=>{try{m(d.throw(o))}catch(s){h(s)}},m=o=>o.done?f(o.value):Promise.resolve(o.value).then(n,i);m((d=d.apply(g,C)).next())});import{a as P,B as V}from"./index-DVEqH4Di.js";import{u as $,_ as G}from"./useForm-Ca7JThS8.js";import"./BasicForm.vue_vue_type_style_index_0_lang-D34fDasZ.js";import"./componentMap-S705cJLS.js";import{f as j,i as D,j as E}from"./index-Czsik27I.js";import{r as O,e as W}from"./index-Bv8q_Kfd.js";import{_ as q}from"./index-BF4ebJi9.js";import{e as z,m as H}from"./role.data-D9IMr4NG.js";import{bA as J,bl as Q,bB as X}from"./entry/index-CwTXVJ2d-1723001953242.js";import{bb as Y,a3 as Z}from"./antd-BY-1PcYE.js";import{d as ee,f as p,c as te,y as ae,_ as S,a8 as R,a9 as k,k as _,u as r,ac as re,ad as oe}from"./vue-aEZWZQSa.js";import"./useWindowSizeFn-C93ItSr2.js";import"./FormItem.vue_vue_type_script_lang-DhGC9etS.js";import"./helper-BPjqq6ZQ.js";import"./RadioButtonGroup.vue_vue_type_script_setup_true_lang-Cx2YeHC7.js";import"./index-B4wZYO02.js";import"./useSortable-BAwH_r98.js";import"./download-Da_OLLnH.js";import"./useLoading-B4X4QuoY.js";import"./copyTextToClipboard-BBFF3Y3I.js";import"./onMountedOrActivated-BIJ0U1R1.js";import"./style-DTWqfx8n.js";import"./dictEnum-DeC8h6ZR.js";import"./dict-yGEj6H2j.js";import"./useRender-BJHJeiBI.js";import"./index-4SGburFo.js";const se=1,Ue=ee({name:"RoleModal",__name:"RoleModal",emits:["register","reload"],setup(g,{emit:C}){const d=C,f=p(!1),h=te(()=>f.value?"编辑角色":"新增角色"),n=p([]),i=p(!1),m=p(),[o,{modalLoading:s,closeModal:T}]=P(e=>v(this,null,function*(){s(!0),i.value=!1;const{record:t,update:c}=e;if(f.value=c,c&&t){const a=yield j(t.roleId);i.value=!a.menuCheckStrictly,yield b(a);const u=yield O(a.roleId),{menus:M,checkedKeys:y}=u,L=I(M);if(n.value=L,a.menuCheckStrictly){const N=J(M,y);l.value=[...N,...y]}else l.value=y;yield b({menuIds:y})}else{const a=yield W(),u=I(a);n.value=u}ae(()=>{var a;(a=m.value)==null||a.filterByLevel(se)}),s(!1)}));function I(e){return Q(e,t=>!z.includes(t.id),{id:"id",pid:"parentId",children:"children"})}const[x,{setFieldsValue:b,resetForm:B,validate:F}]=$({labelWidth:100,layout:"vertical",showActionButtonGroup:!1,baseColProps:{span:24},schemas:H}),l=p([]);function A(e,t){if(e instanceof Array){const c=t.halfCheckedKeys||[];l.value=[...c,...e]}else l.value=[...e.checked]}function U(e){if(e instanceof Array){const t=X(n.value);e.length===0&&(l.value=[]),e.length===t.length&&(l.value=t)}}function K(){return v(this,null,function*(){try{s(!0);const e=yield F();e.menuCheckStrictly=!r(i),e.menuIds=[...r(l)],r(f)?yield D(e):yield E(e),yield w(),d("reload",T)}catch(e){}finally{s(!1)}})}function w(){return v(this,null,function*(){yield B(),l.value=[]})}return(e,t)=>(S(),R(r(V),oe(e.$attrs,{title:h.value,width:600,onRegister:r(o),onOk:K,onCancel:w}),{default:k(()=>[_(r(G),{onRegister:r(x)},{menuTree:k(({model:c,field:a})=>[_(r(Y),null,{default:k(()=>[_(r(Z),{"body-style":{padding:0}},{default:k(()=>[n.value.length?(S(),R(r(q),{key:0,ref_key:"roleTreeRef",ref:m,title:"菜单分配","tree-data":n.value,fieldNames:{title:"label",key:"id"},checkable:!0,selectable:!1,enableCustomTool:!0,checkStrictly:i.value,"onUpdate:checkStrictly":t[0]||(t[0]=u=>i.value=u),checkedKeys:c[a],"onUpdate:checkedKeys":u=>c[a]=u,onCheck:A,onChange:U},null,8,["tree-data","checkStrictly","checkedKeys","onUpdate:checkedKeys"])):re("",!0)]),_:2},1024)]),_:2},1024)]),_:1},8,["onRegister"])]),_:1},16,["title","onRegister"]))}});export{Ue as default};
|