Files
qhmes/deploy-qhmes/frontend/js/AuthFieldTree-Bpj9QUm6-DdAQI0yZ.js
2026-05-15 11:34:12 +08:00

2 lines
4.0 KiB
Java

import{d as T,f,e as V,w as H,u as R,ah as h,ar as A,as as x,aC as w,F as q,au as G,k as c,aF as v,G as k}from"./vue-vendor-C7Zq48Yl.js";import{u as J}from"./index-BI6CMai0.js";import{D as Q,B as $,C as j}from"./auth.api-2QmzY0ji-CZbs6Z4o.js";import{aA as L,bO as W,bP as X,aK as Y,bQ as Z}from"./antd-vue-vendor-BPnV8VqP.js";import{h as ee}from"./main.index-Cs5ETdXF.js";import"./vxe-table-vendor-B88kchpX.js";import"./usePopBiz-CG0vVpgI.js";import"./useMethods-DVip17X8.js";import"./index-Dg4HCEvo.js";var K=(e,t,r)=>new Promise((C,m)=>{var p=i=>{try{n(r.next(i))}catch(d){m(d)}},o=i=>{try{n(r.throw(i))}catch(d){m(d)}},n=i=>i.done?C(i.value):Promise.resolve(i.value).then(p,o);n((r=r.apply(e,t)).next())});const te=T({name:"AuthFieldTree",components:{DownCircleOutlined:Z,HomeOutlined:Y,UpCircleOutlined:X,UndoOutlined:W,CheckOutlined:L},props:{cgformId:{type:String,required:!0}},setup(e){const{createMessage:t}=J(),r=f(""),C=f(1),m=f(!0),p=f([]),o=f([]),n=f([]),i=f([]),d=f(""),O=V(()=>!r.value);H(()=>e.cgformId,y,{immediate:!0});function y(){return K(this,null,function*(){if(!e.cgformId)return;let l=yield Q(e.cgformId,C.value),a=[],u=[];l.forEach(s=>{u.includes(s.code)||(u.push(s.code),a.push({key:s.code,title:s.title}))});for(let s of a){let b=[];for(let E of l)if(s.key===E.code){let N=I(E);b.push({key:E.id,title:N})}s.children=b}i.value=a,p.value=[...u],n.value=u})}function I(l){let a="";return l.page==3?a+="列表":l.page==5&&(a+="表单"),l.control==3?a+="可编辑":l.control==5&&(a+="可见"),a}function g(l,a){return K(this,null,function*(){r.value=l,d.value=a,o.value=[],yield y();let u=yield $({roleId:l,cgformId:e.cgformId,type:C.value,authMode:a});o.value=u.map(s=>s.authId)})}function D(){r.value="",y()}function S(){y(),g(r.value,d.value)}function _(){return K(this,null,function*(){let l=o.value.filter(a=>n.value.indexOf(a)<0);yield j(r.value,e.cgformId,{authId:JSON.stringify(l),authMode:d.value}),t.success("保存成功")})}function P(){p.value=[...n.value]}function U(){p.value=[]}function z(l){p.value=l,m.value=!1}function B(){r.value="",o.value=[]}function F(){o.value=[]}function M(){const l=function(a){for(let u of a)o.value.push(u.key),u.children&&u.children.length>0&&l.call(null,u.children)};o.value=[],l.call(null,R(i))}return{loadChecked:g,clear:B,expandedKeys:p,autoExpandParent:m,checkedKeys:o,treeData:i,disabled:O,onSave:_,onExpand:z,clearChecked:D,onCloseAll:U,onExpandAll:P,onRefresh:S,onClearSelected:F,onSelectAll:M}}}),le={class:"onl-auth-tree-btns"};function ae(e,t,r,C,m,p){const o=h("a-empty"),n=h("a-button"),i=h("DownCircleOutlined"),d=h("UpCircleOutlined"),O=h("CheckOutlined"),y=h("UndoOutlined"),I=h("a-tree");return x(),A("div",null,[e.disabled?(x(),w(o,{key:0,description:"请先选中左侧角色/部门/用户"})):e.treeData.length===0?(x(),w(o,{key:1,description:"无权限信息"})):(x(),A(q,{key:2},[G("div",le,[c(n,{onClick:e.onRefresh,size:"small",type:"primary",preIcon:"ant-design:redo",ghost:""},{default:v(()=>[...t[1]||(t[1]=[k("刷新",-1)])]),_:1},8,["onClick"]),c(n,{onClick:e.onExpandAll,size:"small",type:"primary",ghost:""},{default:v(()=>[c(i),t[2]||(t[2]=k("展开",-1))]),_:1},8,["onClick"]),c(n,{onClick:e.onCloseAll,size:"small",type:"primary",ghost:""},{default:v(()=>[c(d),t[3]||(t[3]=k("折叠",-1))]),_:1},8,["onClick"]),c(n,{onClick:e.onSave,size:"small",type:"primary",preIcon:"ant-design:save",ghost:""},{default:v(()=>[...t[4]||(t[4]=[k("保存",-1)])]),_:1},8,["onClick"]),c(n,{onClick:e.onSelectAll,size:"small",type:"primary",ghost:""},{default:v(()=>[c(O),t[5]||(t[5]=k("全选",-1))]),_:1},8,["onClick"]),c(n,{onClick:e.onClearSelected,size:"small",type:"primary",ghost:""},{default:v(()=>[c(y),t[6]||(t[6]=k("重置",-1))]),_:1},8,["onClick"])]),c(I,{checkable:"",checkedKeys:e.checkedKeys,"onUpdate:checkedKeys":t[0]||(t[0]=g=>e.checkedKeys=g),expandedKeys:e.expandedKeys,autoExpandParent:e.autoExpandParent,treeData:e.treeData,onExpand:e.onExpand},null,8,["checkedKeys","expandedKeys","autoExpandParent","treeData","onExpand"])],64))])}const fe=ee(te,[["render",ae],["__scopeId","data-v-e6dabb1d"]]);export{fe as default};