var D=(h,I,t)=>new Promise((c,r)=>{var i=a=>{try{l(t.next(a))}catch(u){r(u)}},s=a=>{try{l(t.throw(a))}catch(u){r(u)}},l=a=>a.done?c(a.value):Promise.resolve(a.value).then(i,s);l((t=t.apply(h,I)).next())});import{d as P,f as n,U as m,a2 as f,a3 as A,k as v,af as d,a4 as C,ad as w,a5 as G,V as O,u as y,G as U,F as z}from"./vue-vendor-CxLCUzY4.js";import{_ as H}from"./index-44tRnyoF.js";import{u as J,a as Q,B as W}from"./index-BjHivc1K.js";import{bT as X,u as Y}from"./index-CLZzJyTP.js";import Z from"./DepartRoleDataRuleDrawer-DuuWPh3a.js";import{a as ee,b as te,c as ae}from"./depart.user.api-Bvirj8Bq.js";import"./antd-vue-vendor-CahNzUUa.js";import"./index-DvqyyN77.js";import"./bem-DT3DdmOs.js";import"./vxe-table-vendor-Cdi8WfTx.js";import"./props-CG-jAkbI.js";import"./index-DS3utcig.js";import"./index-BZbg0EjM.js";import"./index-CrdW4fN1.js";import"./useTimeout-KpZCXEcl.js";import"./useIntersectionObserver-FVRzwlSd.js";import"./useContextMenu-BGU2vdqV.js";const we=P({__name:"DepartRoleAuthDrawer",emits:["register"],setup(h){const{createMessage:I}=Y(),t=n(!1),c=n(""),r=n(""),i=n([]),s=n([]),l=n([]),a=n([]),u=n([]),b=n([]),K=n(!0),[T,{closeDrawer:B}]=J(e=>{r.value=e.record.id,c.value=e.record.departId,R()}),[F,S]=Q();function R(){return D(this,null,function*(){try{t.value=!0;const{ids:e,treeList:o}=yield ee({departId:c.value});e.length>0?(b.value=e,a.value=e,i.value=X(o),s.value=yield te({roleId:r.value}),l.value=[s.value]):g()}finally{t.value=!1}})}function g(){i.value=[],a.value=[],s.value=[],l.value=[],t.value=!1}function V(e){K.value?s.value=e.checked:s.value=e}function N(e){a.value=e}function $(e,{selectedNodes:o}){var p;if((p=o[0])!=null&&p.ruleFlag){let _=e[0];S.openDrawer(!0,{roleId:r,departId:c,functionId:_})}u.value=[]}function E(){g(),B()}function j(){g()}function x(e){return D(this,null,function*(){try{t.value=!0;let o={roleId:r.value,permissionIds:s.value.join(","),lastpermissionIds:l.value.join(",")};yield ae(o),e&&E()}finally{t.value=!1,e||R()}})}return(e,o)=>{const p=m("Icon"),_=m("a-empty"),q=m("a-spin"),L=m("a-button");return f(),A(z,null,[v(y(W),{title:"部门角色权限配置",width:650,loading:t.value,showFooter:"",okText:"保存并关闭",onOk:o[1]||(o[1]=k=>x(!0)),onClose:j,onRegister:y(T)},{centerFooter:d(()=>[v(L,{type:"primary",loading:t.value,ghost:"",onClick:o[0]||(o[0]=k=>x(!1))},{default:d(()=>o[2]||(o[2]=[U("仅保存")])),_:1},8,["loading"])]),default:d(()=>[C("div",null,[v(q,{spinning:t.value},{default:d(()=>[i.value.length>0?(f(),w(y(H),{key:0,title:"所拥有的部门权限",toolbar:"",checkable:"",treeData:i.value,checkedKeys:s.value,selectedKeys:u.value,expandedKeys:a.value,checkStrictly:K.value,clickRowToExpand:!1,onCheck:V,onExpand:N,onSelect:$},{title:d(({slotTitle:k,ruleFlag:M})=>[C("span",null,G(k),1),M?(f(),w(p,{key:0,icon:"ant-design:align-left-outlined",style:{"margin-left":"5px",color:"red"}})):O("",!0)]),_:1},8,["treeData","checkedKeys","selectedKeys","expandedKeys","checkStrictly"])):(f(),w(_,{key:1,description:"无可配置部门权限"}))]),_:1},8,["spinning"])])]),_:1},8,["loading","onRegister"]),v(Z,{onRegister:y(F)},null,8,["onRegister"])],64)}}});export{we as default};
