var D=(r,u,m)=>new Promise((p,E)=>{var f=i=>{try{n(m.next(i))}catch(o){E(o)}},F=i=>{try{n(m.throw(i))}catch(o){E(o)}},n=i=>i.done?p(i.value):Promise.resolve(i.value).then(f,F);n((m=m.apply(r,u)).next())});import{d as v,e as g,U as l,v as b,a2 as a,ad as d,af as e,k as s,a4 as P,G as t,a5 as M,a3 as S,V as B,q as k,F as w}from"./vue-vendor-CxLCUzY4.js";import{W as T,A as $}from"./antd-vue-vendor-CDWW6V_M.js";import x from"./CurrentPermissionMode-DwDyijhO.js";import{U as V,bv as N,z as U,ab as W,bu as I,_ as j}from"./index-B_2CoVdl.js";import{A as q}from"./index-CE7Is25u.js";import{P as z}from"./index-DaObvZxT.js";import"./vxe-table-vendor-B5h3MVdD.js";import"./useContentHeight-BWLGvKEC.js";import"./useWindowSizeFn-C3WExEpc.js";import"./useContentViewHeight-DlpfApuB.js";import"./usePageContext-HMYqek-Q.js";import"./injectionKey-DPVn4AgL.js";const G=v({components:{Alert:$,PageWrapper:z,CurrentPermissionMode:x,Divider:T,Authority:q},setup(){const{hasPermission:r}=V(),u=N(),m=U(),p=W(),E=g(()=>m.getProjectConfig.permissionMode===I.BACK);function f(F){return D(this,null,function*(){const n="fakeToken"+F;p.setToken(n),p.getUserInfoAction(),u.changePermissionCode()})}return{hasPermission:r,permissionStore:u,switchToken:f,isBackPremissionMode:E}}});function K(r,u,m,p,E,f){const F=l("CurrentPermissionMode"),n=l("Divider"),i=l("Alert"),o=l("a-button"),C=l("Authority"),y=l("PageWrapper"),A=b("auth");return a(),d(y,{contentBackground:"",title:"按钮权限控制",contentClass:"p-4"},{default:e(()=>[s(F),P("p",null,[u[2]||(u[2]=t(" 当前拥有的code列表: ")),P("a",null,M(r.permissionStore.getPermCodeList),1)]),s(n),s(i,{class:"mt-4",type:"info",message:"点击后请查看按钮变化(必须处于后台权限模式才可测试此页面所展示的功能)","show-icon":""}),s(n),s(o,{type:"primary",class:"mr-2",onClick:u[0]||(u[0]=c=>r.switchToken(2)),disabled:!r.isBackPremissionMode},{default:e(()=>u[3]||(u[3]=[t(" 点击切换按钮权限(用户id为2) ")])),_:1},8,["disabled"]),s(o,{type:"primary",onClick:u[1]||(u[1]=c=>r.switchToken(1)),disabled:!r.isBackPremissionMode},{default:e(()=>u[4]||(u[4]=[t(" 点击切换按钮权限(用户id为1,默认) ")])),_:1},8,["disabled"]),r.isBackPremissionMode?(a(),S(w,{key:0},[s(n,null,{default:e(()=>u[5]||(u[5]=[t("组件方式判断权限")])),_:1}),s(C,{value:"1000"},{default:e(()=>[s(o,{type:"primary",class:"mx-4"},{default:e(()=>u[6]||(u[6]=[t(" 拥有code ['1000']权限可见 ")])),_:1})]),_:1}),s(C,{value:"2000"},{default:e(()=>[s(o,{color:"success",class:"mx-4"},{default:e(()=>u[7]||(u[7]=[t(" 拥有code ['2000']权限可见 ")])),_:1})]),_:1}),s(C,{value:["1000","2000"]},{default:e(()=>[s(o,{color:"error",class:"mx-4"},{default:e(()=>u[8]||(u[8]=[t(" 拥有code ['1000','2000']角色权限可见 ")])),_:1})]),_:1}),s(n,null,{default:e(()=>u[9]||(u[9]=[t("函数方式方式判断权限")])),_:1}),r.hasPermission("1000")?(a(),d(o,{key:0,type:"primary",class:"mx-4"},{default:e(()=>u[10]||(u[10]=[t(" 拥有code ['1000']权限可见 ")])),_:1})):B("",!0),r.hasPermission("2000")?(a(),d(o,{key:1,color:"success",class:"mx-4"},{default:e(()=>u[11]||(u[11]=[t(" 拥有code ['2000']权限可见 ")])),_:1})):B("",!0),r.hasPermission(["1000","2000"])?(a(),d(o,{key:2,color:"error",class:"mx-4"},{default:e(()=>u[12]||(u[12]=[t(" 拥有code ['1000','2000']角色权限可见 ")])),_:1})):B("",!0),s(n,null,{default:e(()=>u[13]||(u[13]=[t("指令方式方式判断权限(该方式不能动态修改权限.)")])),_:1}),k((a(),d(o,{type:"primary",class:"mx-4"},{default:e(()=>u[14]||(u[14]=[t(" 拥有code ['1000']权限可见 ")])),_:1})),[[A,"1000"]]),k((a(),d(o,{color:"success",class:"mx-4"},{default:e(()=>u[15]||(u[15]=[t(" 拥有code ['2000']权限可见 ")])),_:1})),[[A,"2000"]]),k((a(),d(o,{color:"error",class:"mx-4"},{default:e(()=>u[16]||(u[16]=[t(" 拥有code ['1000','2000']角色权限可见 ")])),_:1})),[[A,["1000","2000"]]])],64)):B("",!0)]),_:1})}const ou=j(G,[["render",K],["__scopeId","data-v-a7c75d9b"]]);export{ou as default};
