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