import{U as y,a2 as v,a3 as I,ad as K,F as M,a4 as N,k,af as E,G as C,d as S,f as l,e as F,w as T}from"./vue-vendor-CxLCUzY4.js";import{c9 as V,u as q}from"./index-CYriLmQo.js";import{i as z}from"./auth.data-22948e87-bICx_6US.js";import{D as A,A as J,L as O}from"./auth.api-d3a6c4b3-D2WKBhPA.js";import"./antd-vue-vendor-CDWW6V_M.js";import"./vxe-table-vendor-B5h3MVdD.js";var g=(e,u,t)=>new Promise((f,i)=>{var m=a=>{try{r(t.next(a))}catch(s){i(s)}},o=a=>{try{r(t.throw(a))}catch(s){i(s)}},r=a=>a.done?f(a.value):Promise.resolve(a.value).then(m,o);r((t=t.apply(e,u)).next())});const R=S({name:"AuthButtonTree",props:{cgformId:{type:String,required:!0}},setup(e){const{createMessage:u}=q(),t=l(""),f=l(2),i=l(!0),m=l([]),o=l([]),r=l([]),a=l(""),s=F(()=>!t.value);T(()=>e.cgformId,h,{immediate:!0});function h(){return g(this,null,function*(){if(!e.cgformId)return;let n=yield A(e.cgformId,f.value);n.forEach(d=>{for(const p of z)if(d.code==p.code){d.title=p.title;break}});let c=[];for(let d of n){let p=w(d);c.push({key:d.id,title:p})}r.value=c})}function b(){h(),x(t.value,a.value)}function x(n,c){return g(this,null,function*(){t.value=n,a.value=c,o.value=[],yield h();let d=yield J({roleId:n,cgformId:e.cgformId,type:f.value,authMode:c});o.value=d.map(p=>p.authId)})}function D(){t.value="",h()}function P(){return g(this,null,function*(){yield O(t.value,e.cgformId,{authId:JSON.stringify(o.value),authMode:a.value}),u.success("保存成功")})}function w(n){let c=n.title+"-";return n.page==3?c+="列表可见":n.page==5&&(c+="表单可见"),c}function B(n){m.value=n,i.value=!1}function _(){t.value="",o.value=[]}return{loadChecked:x,clear:_,expandedKeys:m,autoExpandParent:i,checkedKeys:o,treeData:r,disabled:s,onSave:P,onExpand:B,onRefresh:b,clearChecked:D}}}),U={class:"onl-auth-tree-btns"};function $(e,u,t,f,i,m){const o=y("a-empty"),r=y("a-button"),a=y("a-tree");return v(),I("div",null,[e.disabled?(v(),K(o,{key:0,description:"请先选中左侧角色/部门/用户"})):e.treeData.length===0?(v(),K(o,{key:1,description:"无权限信息"})):(v(),I(M,{key:2},[N("div",U,[k(r,{onClick:e.onRefresh,size:"small",type:"primary",preIcon:"ant-design:redo",ghost:""},{default:E(()=>[C("刷新")]),_:1},8,["onClick"]),k(r,{onClick:e.onSave,size:"small",type:"primary",preIcon:"ant-design:save",ghost:""},{default:E(()=>[C("保存")]),_:1},8,["onClick"])]),k(a,{checkable:"",checkedKeys:e.checkedKeys,"onUpdate:checkedKeys":u[0]||(u[0]=s=>e.checkedKeys=s),expandedKeys:e.expandedKeys,autoExpandParent:e.autoExpandParent,treeData:e.treeData,onExpand:e.onExpand},null,8,["checkedKeys","expandedKeys","autoExpandParent","treeData","onExpand"])],64))])}const X=V(R,[["render",$],["__scopeId","data-v-d165a23e"]]);export{X as default};
