Files
qhmes/web-dist/js/RolePermissionDrawer-C7gBuDbP.js

2 lines
6.0 KiB
Java
Raw Normal View History

2026-06-16 18:19:57 +08:00
var R=(T,A,d)=>new Promise((g,a)=>{var y=c=>{try{p(d.next(c))}catch(m){a(m)}},k=c=>{try{p(d.throw(c))}catch(m){a(m)}},p=c=>c.done?g(c.value):Promise.resolve(c.value).then(y,k);p((d=d.apply(T,A)).next())});import{B as U}from"./index-D9GWo192.js";import{B as Y}from"./index-Bzmv9Ie7.js";import{_ as W}from"./RoleDataRuleDrawer.vue_vue_type_script_setup_true_lang-DZSkJZHk.js";import{n as E,o as X,p as Z}from"./role.api-B0N9uXDv.js";import{aR as ee,aS as te,f2 as S,ad as oe,au as le}from"./index-X7Y8jykP.js";import{a as re,u as ne}from"./useDrawer-BDPywy9W.js";import"./index-CfNJyBRj.js";import{D as se}from"./dropdown-jkliuVyN.js";import{e as ae,y as O,z as P,A as r,B as ie,u as i,K as L,f as n,r as f,E as u,H as ue,G as pe,Q as $}from"./vue-vendor-DNhG1Cve.js";import"./index-BzChaRPg.js";import"./ArrowLeftOutlined-B3JgaWh-.js";import"./index-ByCwbQDV.js";import"./index-Upeu4GGa.js";import"./index-C4wWpZeQ.js";import"./emoji-mart-vue-fast-R0uJEDq-.js";import"./useTimeout-D5AmIBZw.js";import"./index-M9QP6cvf.js";import"./Skeleton-CimgOdM7.js";import"./useScrollTo-0FPEw5-K.js";import"./useIntersectionObserver-BGOgyKyu.js";import"./index-DZJwICFr.js";import"./isNumeric-DjvBa-1E.js";import"./bem-CTsBfXqP.js";import"./props-Cc-8EPhZ.js";import"./fromPairs-Dx9PT-t0.js";import"./useContextMenu-BncvQCmV.js";import"./index-saD4h7VJ.js";import"./difference-CGvbIcA7.js";import"./index-C7ckZv9Z.js";import"./DirectoryTree-nk_YTTIy.js";import"./FolderOpenOutlined-SzIPA7z0.js";import"./index-Cl-8Hzo4.js";import"./useMaxLevel-DE205ncc.js";import"./eagerComputed-BTlOruLW.js";import"./index-BuONesFs.js";import"./index-DSsDi_fL.js";import"./Group-UHkub2tu.js";import"./Checkbox-Dbxs4we4.js";import"./index-CuWaQdlK.js";import"./index-DO7ZhK45.js";const ce=ae({__name:"RolePermissionDrawer",emits:["register"],setup(T,{emit:A}){const d=f([]),g=f([]),a=f([]),y=f([]),k=f([]),p=f(""),c=f(null),m=f(!1),w=f([]),x=f(!1),[j,{openDrawer:F}]=re(),[V,{setDrawerProps:N,closeDrawer:h}]=ne(t=>R(null,null,function*(){yield G(),N({confirmLoading:!1,loading:!0}),p.value=t.roleId;const e=yield Z();d.value=B(e.treeList),g.value=e.ids;const l=localStorage.getItem(S);if(l){const s=JSON.parse(l);s.level&&C({key:s.level}),s.expand&&C({key:s.expand})}else w.value=e.ids;const o=yield E({roleId:i(p)});a.value=o,y.value=o,N({loading:!1})}));function B(t){return t!=null&&t.length&&t.forEach(e=>{var l;if(e.slotTitle){const{t:o}=oe();e.slotTitle.includes("t('")&&o&&(e.slotTitle=new Function("t",`return ${e.slotTitle}`)(o))}(l=e.children)!=null&&l.length&&B(e.children)}),t}function J(t,e){if(x.value)a.value=t.checked?t.checked:t;else{const l=q(e.node,"children","key");if(e.checked)a.value=[...new Set([...a.value,...l])];else{const o=M(a.value,l);a.value=o}}}function M(t,e){const l={};for(const o of e)l[o]=!0;return t.filter(o=>!l[o])}function q(t,e,l){var D;const o=[];o.push(t[l]);const s=K=>{K.forEach(v=>{var I;o.push(v[l]),(I=v[e])!=null&&I.length&&s(v[e])})};return(D=t[e])!=null&&D.length&&s(t[e]),o}function z(t){t&&t.length>0&&(k.value=t),F(!0,{functionId:i(k)[0],roleId:i(p)})}function G(){d.value=[],g.value=[],a.value=[],y.value=[],k.value=[],p.value=""}function H(){const t=i(c);if(!t)throw new Error("tree is null!");return t}function b(t){return R(this,null,function*(){let e={roleId:i(p),permissionIds:i(H().getCheckedKeys()).join(","),lastpermissionIds:i(y).join(",")};if(m.value===!1&&(yield Q(e)),t)h();else{const l=yield E({roleId:i(p)});y.value=l}})}function Q(t){return R(this,null,function*(){m.value=!0;try{yield X(t)}catch(e){m.value=!1}setTimeout(()=>{m.value=!1},500)})}function C({key:t}){t==="checkAll"?a.value=g.value:t==="cancelCheck"?a.value=[]:t==="openAll"?(w.value=g.value,_("expand","openAll")):t==="closeAll"?(w.value=[],_("expand","closeAll")):t==="relation"?(x.value=!1,_("level","relation")):(x.value=!0,_("level","standAlone"))}const _=(t,e)=>{const l=localStorage.getItem(S),o=l?JSON.parse(l):{};o[t]=e,localStorage.setItem(S,JSON.stringify(o))};return(t,e)=>{const l=L("Icon"),o=L("a-button"),s=te,D=ee,K=se;return P(),O(i(U),ie(t.$attrs,{onRegister:i(V),width: