var b=(t,e,n)=>new Promise((r,a)=>{var m=s=>{try{i(n.next(s))}catch(f){a(f)}},u=s=>{try{i(n.throw(s))}catch(f){a(f)}},i=s=>s.done?r(s.value):Promise.resolve(s.value).then(m,u);i((n=n.apply(t,e)).next())});import{cq as _,f7 as V,s as J,au as Q,bL as G}from"./index-X7Y8jykP.js";import{m as W,q as X,r as Y}from"./auth.api-DyuagR5L.js";import{f as c,e as Z,h as ee,c as te,r as g,u as ne,C as I,z as k,y as U,F as re,Q as ae,A as h,K as O,E as y}from"./vue-vendor-DNhG1Cve.js";import{H as le}from"./HomeOutlined-CZ9a0aTj.js";import{_ as oe}from"./index-C7ckZv9Z.js";import"./emoji-mart-vue-fast-R0uJEDq-.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";var ie={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M690 405h-46.9c-10.2 0-19.9 4.9-25.9 13.2L512 563.6 406.8 418.2c-6-8.3-15.6-13.2-25.9-13.2H334c-6.5 0-10.3 7.4-6.5 12.7l178 246c3.2 4.4 9.7 4.4 12.9 0l178-246c3.9-5.3.1-12.7-6.4-12.7z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"down-circle",theme:"outlined"};function j(t){for(var e=1;e!n.value);ee(()=>t.cgformId,v,{immediate:!0});function v(){return b(this,null,function*(){if(!t.cgformId)return;let l=yield Y(t.cgformId,r.value),o=[],d=[];l.forEach(p=>{d.includes(p.code)||(d.push(p.code),o.push({key:p.code,title:p.title}))});for(let p of o){let D=[];for(let P of l)if(p.key===P.code){let R=S(P);D.push({key:P.id,title:R})}p.children=D}s.value=o,m.value=[...d],i.value=d})}function S(l){let o="";return l.page==3?o+="列表":l.page==5&&(o+="表单"),l.control==3?o+="可编辑":l.control==5&&(o+="可见"),o}function C(l,o){return b(this,null,function*(){n.value=l,f.value=o,u.value=[],yield v();let d=yield W({roleId:l,cgformId:t.cgformId,type:r.value,authMode:o});u.value=d.map(p=>p.authId)})}function M(){n.value="",v()}function N(){v(),C(n.value,f.value)}function T(){return b(this,null,function*(){let l=u.value.filter(o=>i.value.indexOf(o)<0);yield X(n.value,t.cgformId,{authId:JSON.stringify(l),authMode:f.value}),e.success("保存成功")})}function B(){m.value=[...i.value]}function F(){m.value=[]}function L(l){m.value=l,a.value=!1}function H(){n.value="",u.value=[]}function K(){u.value=[]}function q(){const l=function(o){for(let d of o)u.value.push(d.key),d.children&&d.children.length>0&&l.call(null,d.children)};u.value=[],l.call(null,ne(s))}return{loadChecked:C,clear:H,expandedKeys:m,autoExpandParent:a,checkedKeys:u,treeData:s,disabled:w,onSave:T,onExpand:L,clearChecked:M,onCloseAll:F,onExpandAll:B,onRefresh:N,onClearSelected:K,onSelectAll:q}}}),me={class:"onl-auth-tree-btns"};function ge(t,e,n,r,a,m){const u=G,i=O("a-button"),s=O("DownCircleOutlined"),f=O("UpCircleOutlined"),w=O("CheckOutlined"),v=O("UndoOutlined"),S=oe;return k(),I("div",null,[t.disabled?(k(),U(u,{key:0,description:"请先选中左侧角色/部门/用户"})):t.treeData.length===0?(k(),U(u,{key:1,description:"无权限信息"})):(k(),I(re,{key:2},[ae("div",me,[c(i,{onClick:t.onRefresh,size:"small",type:"primary",preIcon:"ant-design:redo",ghost:""},{default:h(()=>[...e[1]||(e[1]=[y("刷新",-1)])]),_:1},8,["onClick"]),c(i,{onClick:t.onExpandAll,size:"small",type:"primary",ghost:""},{default:h(()=>[c(s),e[2]||(e[2]=y("展开",-1))]),_:1},8,["onClick"]),c(i,{onClick:t.onCloseAll,size:"small",type:"primary",ghost:""},{default:h(()=>[c(f),e[3]||(e[3]=y("折叠",-1))]),_:1},8,["onClick"]),c(i,{onClick:t.onSave,size:"small",type:"primary",preIcon:"ant-design:save",ghost:""},{default:h(()=>[...e[4]||(e[4]=[y("保存",-1)])]),_:1},8,["onClick"]),c(i,{onClick:t.onSelectAll,size:"small",type:"primary",ghost:""},{default:h(()=>[c(w),e[5]||(e[5]=y("全选",-1))]),_:1},8,["onClick"]),c(i,{onClick:t.onClearSelected,size:"small",type:"primary",ghost:""},{default:h(()=>[c(v),e[6]||(e[6]=y("重置",-1))]),_:1},8,["onClick"])]),c(S,{checkable:"",checkedKeys:t.checkedKeys,"onUpdate:checkedKeys":e[0]||(e[0]=C=>t.checkedKeys=C),expandedKeys:t.expandedKeys,autoExpandParent:t.autoExpandParent,treeData:t.treeData,onExpand:t.onExpand},null,8,["checkedKeys","expandedKeys","autoExpandParent","treeData","onExpand"])],64))])}const Ae=Q(pe,[["render",ge],["__scopeId","data-v-997b7773"]]);export{Ae as default};