Files
qhmes/deploy-qhmes/frontend/js/AuthButtonTree-CQIeTMAV-DCEpaSU4.js
2026-05-15 11:34:12 +08:00

2 lines
3.2 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{d as M,f as i,e as S,w as A,ah as v,ar as b,as as y,aC as I,F as $,au as F,k,aF as C,G as E}from"./vue-vendor-C7Zq48Yl.js";import{u as T}from"./index-BI6CMai0.js";import{C as V}from"./auth.data-Cp8D9uZ7-CIhflRNS.js";import{b as q,B as z,L as J}from"./auth.api-2QmzY0ji-CZbs6Z4o.js";import{h as O}from"./main.index-Cs5ETdXF.js";import"./antd-vue-vendor-BPnV8VqP.js";import"./vxe-table-vendor-B88kchpX.js";import"./usePopBiz-CG0vVpgI.js";import"./useMethods-DVip17X8.js";import"./index-Dg4HCEvo.js";var g=(e,t,l)=>new Promise((c,p)=>{var f=r=>{try{n(l.next(r))}catch(d){p(d)}},u=r=>{try{n(l.throw(r))}catch(d){p(d)}},n=r=>r.done?c(r.value):Promise.resolve(r.value).then(f,u);n((l=l.apply(e,t)).next())});const R=M({name:"AuthButtonTree",props:{cgformId:{type:String,required:!0}},setup(e){const{createMessage:t,createSuccessModal:l}=T(),c=i(""),p=i(2),f=i(!0),u=i([]),n=i([]),r=i([]),d=i(""),K=S(()=>!c.value);A(()=>e.cgformId,h,{immediate:!0});function h(){return g(this,null,function*(){if(!e.cgformId)return;let a=yield q(e.cgformId,p.value);a.forEach(s=>{for(const m of V)if(s.code==m.code){s.title||(s.title=m.title);break}});let o=[];for(let s of a){let m=P(s);o.push({key:s.id,title:m})}r.value=o})}function B(){h(),x(c.value,d.value)}function x(a,o){return g(this,null,function*(){c.value=a,d.value=o,n.value=[],yield h();let s=yield z({roleId:a,cgformId:e.cgformId,type:p.value,authMode:o});n.value=s.map(m=>m.authId)})}function N(){c.value="",h()}function w(){return g(this,null,function*(){try{const{success:a,message:o,result:s}=yield J(c.value,e.cgformId,{authId:JSON.stringify(n.value),authMode:d.value});a?Array.isArray(s==null?void 0:s.disabledNames)?l({title:"保存成功",content:`由于以下按钮未激活所以权限未生效<br>${s.disabledNames.join("<br>")}`}):t.success("保存成功"):t.error(o)}catch(a){t.error("保存出现异常")}})}function P(a){let o=a.title+"-";return a.code&&a.code.includes("form_sub")?o+="表单可见(附表)":a.page==3?o+="列表可见":a.page==5&&(o+="表单可见"),o}function _(a){u.value=a,f.value=!1}function D(){c.value="",n.value=[]}return{loadChecked:x,clear:D,expandedKeys:u,autoExpandParent:f,checkedKeys:n,treeData:r,disabled:K,onSave:w,onExpand:_,onRefresh:B,clearChecked:N}}}),j={class:"onl-auth-tree-btns"};function G(e,t,l,c,p,f){const u=v("a-empty"),n=v("a-button"),r=v("a-tree");return y(),b("div",null,[e.disabled?(y(),I(u,{key:0,description:"请先选中左侧角色/部门/用户"})):e.treeData.length===0?(y(),I(u,{key:1,description:"无权限信息"})):(y(),b($,{key:2},[F("div",j,[k(n,{onClick:e.onRefresh,size:"small",type:"primary",preIcon:"ant-design:redo",ghost:""},{default:C(()=>[...t[1]||(t[1]=[E("刷新",-1)])]),_:1},8,["onClick"]),k(n,{onClick:e.onSave,size:"small",type:"primary",preIcon:"ant-design:save",ghost:""},{default:C(()=>[...t[2]||(t[2]=[E("保存",-1)])]),_:1},8,["onClick"])]),k(r,{checkable:"",checkedKeys:e.checkedKeys,"onUpdate:checkedKeys":t[0]||(t[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 te=O(R,[["render",G],["__scopeId","data-v-b62449eb"]]);export{te as default};