var p=(x,C,m)=>new Promise((u,l)=>{var r=s=>{try{c(m.next(s))}catch(a){l(a)}},y=s=>{try{c(m.throw(s))}catch(a){l(a)}},c=s=>s.done?u(s.value):Promise.resolve(s.value).then(r,y);c((m=m.apply(x,C)).next())});import{d as O,e as U,f as i,n as g,w as H,U as d,a2 as w,a3 as J,k as n,af as o,ad as K,a4 as I,a5 as M,V as Q,u as T,a6 as W,G as f,F as X}from"./vue-vendor-CxLCUzY4.js";import{a as Y}from"./index-CJ4Xt1FM.js";import{_ as Z}from"./index-CNQBnF3P.js";import ee from"./DepartDataRuleDrawer-CSDKRcab.js";import{c as te,e as ae,f as ne}from"./depart.api-B8q8MC-j.js";import{C as oe,bT as se,_ as le}from"./index-Cy4uayzW.js";import"./antd-vue-vendor-CahNzUUa.js";import"./index-Bdn0r8CG.js";import"./index-CYoRlduV.js";import"./index-DYB8Ashr.js";import"./index-CrdW4fN1.js";import"./useTimeout-gJpgadD6.js";import"./vxe-table-vendor-Cdi8WfTx.js";import"./useIntersectionObserver-FVRzwlSd.js";import"./bem-IZKqD41e.js";import"./props-CG-jAkbI.js";import"./useContextMenu-Q6J5bB_u.js";const re={class:"j-box-bottom-button offset-20",style:{"margin-top":"30px"}},ie=O({__name:"DepartRuleTab",props:{data:{type:Object,default:()=>({})}},setup(x){const{prefixCls:C}=oe("j-depart-form-content"),m=x,u=U(()=>{var e;return(e=m.data)==null?void 0:e.id}),l=i(),r=i(!1),y=i([]),c=i([]),s=i([]),a=i([]),R=i([]),S=i(!0),[B,E]=Y();$(),H(u,()=>j(),{immediate:!0});function $(){return p(this,null,function*(){try{r.value=!0;let{treeList:e}=yield te();y.value=se(e),yield g(),b(!0)}finally{r.value=!1}})}function j(){return p(this,null,function*(){if(u.value)try{r.value=!0;let e=yield ae({departId:u.value});a.value=e,R.value=[...e]}finally{r.value=!1}})}function L(){return p(this,null,function*(){try{r.value=!0,yield ne({departId:u.value,permissionIds:a.value.join(","),lastpermissionIds:R.value.join(",")}),yield $(),yield j()}finally{r.value=!1}})}function N(e){Array.isArray(e)?a.value=e:a.value=e.checked}function F(e){c.value=e}function P(e,{selectedNodes:t}){var v;if((v=t[0])!=null&&v.ruleFlag){let D=e[0];E.openDrawer(!0,{departId:u,functionId:D})}s.value=[]}function ue(e){return p(this,null,function*(){S.value=e,yield g(),a.value=l.value.getCheckedKeys()})}function b(e){return p(this,null,function*(){l.value.expandAll(e),yield g(),c.value=l.value.getExpandedKeys()})}function A(e){return p(this,null,function*(){l.value.checkAll(e),yield g(),a.value=l.value.getCheckedKeys()})}return(e,t)=>{const v=d("Icon"),D=d("a-empty"),_=d("a-menu-item"),h=d("a-menu"),V=d("a-button"),q=d("a-dropdown"),z=d("a-spin");return w(),J(X,null,[n(z,{spinning:r.value},{default:o(()=>[y.value.length>0?(w(),K(T(Z),{key:0,ref_key:"basicTree",ref:l,class:"depart-rule-tree",checkable:"",treeData:y.value,checkedKeys:a.value,selectedKeys:s.value,expandedKeys:c.value,checkStrictly:S.value,style:{height:"500px",overflow:"auto"},onCheck:N,onExpand:F,onSelect:P},{title:o(({slotTitle:k,ruleFlag:G})=>[I("span",null,M(k),1),G?(w(),K(v,{key:0,icon:"ant-design:align-left-outlined",style:{"margin-left":"5px",color:"red"}})):Q("",!0)]),_:1},8,["treeData","checkedKeys","selectedKeys","expandedKeys","checkStrictly"])):(w(),K(D,{key:1,description:"无可配置部门权限"})),I("div",re,[I("div",{class:W(["j-box-bottom-button-float",[`${T(C)}`]])},[n(q,{trigger:["click"],placement:"top"},{overlay:o(()=>[n(h,null,{default:o(()=>[n(_,{key:"3",onClick:t[0]||(t[0]=k=>A(!0))},{default:o(()=>t[4]||(t[4]=[f("全部勾选")])),_:1}),n(_,{key:"4",onClick:t[1]||(t[1]=k=>A(!1))},{default:o(()=>t[5]||(t[5]=[f("取消全选")])),_:1}),n(_,{key:"5",onClick:t[2]||(t[2]=k=>b(!0))},{default:o(()=>t[6]||(t[6]=[f("展开所有")])),_:1}),n(_,{key:"6",onClick:t[3]||(t[3]=k=>b(!1))},{default:o(()=>t[7]||(t[7]=[f("收起所有")])),_:1})]),_:1})]),default:o(()=>[n(V,{style:{float:"left"}},{default:o(()=>[t[8]||(t[8]=f(" 树操作 ")),n(v,{icon:"ant-design:up-outlined"})]),_:1})]),_:1}),n(V,{type:"primary",preIcon:"ant-design:save-filled",onClick:L},{default:o(()=>t[9]||(t[9]=[f("保存")])),_:1})],2)])]),_:1},8,["spinning"]),n(ee,{onRegister:T(B)},null,8,["onRegister"])],64)}}}),Re=le(ie,[["__scopeId","data-v-3e122748"]]);export{Re as default};
