2 lines
3.2 KiB
Java
2 lines
3.2 KiB
Java
var h=(e,o,u)=>new Promise((c,p)=>{var m=s=>{try{n(u.next(s))}catch(d){p(d)}},l=s=>{try{n(u.throw(s))}catch(d){p(d)}},n=s=>s.done?c(s.value):Promise.resolve(s.value).then(m,l);n((u=u.apply(e,o)).next())});import{s as w,au as S,bL as D}from"./index-X7Y8jykP.js";import{b as M}from"./auth.data-C5DJn-kD.js";import{m as P,s as $,n as z}from"./auth.api-DyuagR5L.js";import{e as F,h as L,c as R,r as i,C as b,z as v,y as I,F as V,Q as j,f as g,A as _,K as q,E as C}from"./vue-vendor-DNhG1Cve.js";import{_ as J}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";const O=F({name:"AuthButtonTree",props:{cgformId:{type:String,required:!0}},setup(e){const{createMessage:o,createSuccessModal:u}=w(),c=i(""),p=i(2),m=i(!0),l=i([]),n=i([]),s=i([]),d=i(""),E=R(()=>!c.value);L(()=>e.cgformId,y,{immediate:!0});function y(){return h(this,null,function*(){if(!e.cgformId)return;let t=yield z(e.cgformId,p.value);t.forEach(a=>{for(const f of M)if(a.code==f.code){a.title||(a.title=f.title);break}});let r=[];for(let a of t){let f=T(a);r.push({key:a.id,title:f})}s.value=r})}function K(){y(),k(c.value,d.value)}function k(t,r){return h(this,null,function*(){c.value=t,d.value=r,n.value=[],yield y();let a=yield P({roleId:t,cgformId:e.cgformId,type:p.value,authMode:r});n.value=a.map(f=>f.authId)})}function B(){c.value="",y()}function x(){return h(this,null,function*(){try{const{success:t,message:r,result:a}=yield $(c.value,e.cgformId,{authId:JSON.stringify(n.value),authMode:d.value});t?Array.isArray(a==null?void 0:a.disabledNames)?u({title:"保存成功",content:`由于以下按钮未激活,所以权限未生效。<br>${a.disabledNames.join("<br>")}`}):o.success("保存成功"):o.error(r)}catch(t){o.error("保存出现异常")}})}function T(t){let r=t.title+"-";return t.code&&t.code.includes("form_sub")?r+="表单可见(附表)":t.page==3?r+="列表可见":t.page==5&&(r+="表单可见"),r}function A(t){l.value=t,m.value=!1}function N(){c.value="",n.value=[]}return{loadChecked:k,clear:N,expandedKeys:l,autoExpandParent:m,checkedKeys:n,treeData:s,disabled:E,onSave:x,onExpand:A,onRefresh:K,clearChecked:B}}}),Q={class:"onl-auth-tree-btns"};function U(e,o,u,c,p,m){const l=D,n=q("a-button"),s=J;return v(),b("div",null,[e.disabled?(v(),I(l,{key:0,description:"请先选中左侧角色/部门/用户"})):e.treeData.length===0?(v(),I(l,{key:1,description:"无权限信息"})):(v(),b(V,{key:2},[j("div",Q,[g(n,{onClick:e.onRefresh,size:"small",type:"primary",preIcon:"ant-design:redo",ghost:""},{default:_(()=>[...o[1]||(o[1]=[C("刷新",-1)])]),_:1},8,["onClick"]),g(n,{onClick:e.onSave,size:"small",type:"primary",preIcon:"ant-design:save",ghost:""},{default:_(()=>[...o[2]||(o[2]=[C("保存",-1)])]),_:1},8,["onClick"])]),g(s,{checkable:"",checkedKeys:e.checkedKeys,"onUpdate:checkedKeys":o[0]||(o[0]=d=>e.checkedKeys=d),expandedKeys:e.expandedKeys,autoExpandParent:e.autoExpandParent,treeData:e.treeData,onExpand:e.onExpand},null,8,["checkedKeys","expandedKeys","autoExpandParent","treeData","onExpand"])],64))])}const ce=S(O,[["render",U],["__scopeId","data-v-594c4759"]]);export{ce as default};
|