1var e=Object.defineProperty,s=Object.defineProperties,a=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,t=Object.prototype.propertyIsEnumerable,o=(s,a,l)=>a in s?e(s,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):s[a]=l;import{d as n,v as i,x as d,a as c,c as m,e as u,f as p,h as v,p as f,z as b,m as y,l as x,k as g,P as w,T as h,y as _,i as k,I as R,J as N,K as j,O as E}from"./index-CA--wBCS.js";/* empty css */import{E as P}from"./el-card-B_Q0xpak.js";/* empty css */import{E as O}from"./index-DXOsZame.js";const S={class:"py-2"},U={class:"mb-6"},A={class:"flex items-start mb-3 last:mb-0"},I={class:"flex items-start mb-3 last:mb-0"},C={class:"flex items-start mb-3 last:mb-0"},D={class:"flex flex-wrap gap-2"},T={key:0,class:"italic text-g-500"},F={class:"mb-6"},M={class:"grid grid-cols-[repeat(auto-fit,minmax(300px,1fr))] gap-4"},z={class:"mb-4"},q={class:"m-0 mb-2 text-base font-semibold"},J={class:"m-0 mb-2 leading-[1.5] text-g-700"},K={class:"flex flex-col gap-1"},L={class:"text-xs text-g-600"},B={class:"text-xs text-g-600"},G={class:"text-right"},H=n((Q=((e,s)=>{for(var a in s||(s={}))r.call(s,a)&&o(e,a,s[a]);if(l)for(var a of l(s))t.call(s,a)&&o(e,a,s[a]);return e})({},{name:"PermissionSwitchRole"}),s(Q,a({__name:"index",setup(e){const{t:s}=i(),a=d(),l=c(!1),r=m(()=>a.info),t=m(()=>[{key:"super",label:s("login.roles.super"),userName:"Super",password:"123456",roles:["R_SUPER"],color:"#E6A23C",description:"æ¥æç³»ç»æé«æéï¼å¯ä»¥è®¿é®ææåè½æ¨¡å"},{key:"admin",label:s("login.roles.admin"),userName:"Admin",password:"123456",roles:["R_ADMIN"],color:"#409EFF",description:"æ¥æç®¡çæéï¼å¯ä»¥ç®¡çç¨æ·åé¨åç³»ç»è®¾ç½®"},{key:"user",label:s("login.roles.user"),userName:"User",password:"123456",roles:["R_USER"],color:"#67C23A",description:"æ®éç¨æ·æéï¼åªè½è®¿é®åºç¡åè½æ¨¡å"}]),o=e=>e&&{R_SUPER:"warning",R_ADMIN:"primary",R_USER:"success"}[e]||"info",n=e=>e&&{R_SUPER:"è¶
级管çå",R_ADMIN:"管çå",R_USER:"æ®éç¨æ·"}[e]||"æªç¥è§è²",H=e=>{return s=null,r=null,t=function*(){try{l.value=!0;const{token:s,refreshToken:r}=yield N({userName:e.userName,password:e.password});if(!s)throw new Error("Login failed - no token received");a.setToken(s,r);const t=yield j();a.setUserInfo(t),setTimeout(()=>{window.location.reload()},100)}catch(s){"cancel"!==s&&E.error("åæ¢ç¨æ·èº«ä»½å¤±è´¥ï¼è¯·ç¨åéè¯")}finally{l.value=!1}},new Promise((e,a)=>{var l=e=>{try{n(t.next(e))}catch(s){a(s)}},o=e=>{try{n(t.throw(e))}catch(s){a(s)}},n=s=>s.done?e(s.value):Promise.resolve(s.value).then(l,o);n((t=t.apply(s,r)).next())});var s,r,t};return(e,s)=>{const a=O,i=P,d=R;return p(),u("div",S,[s[7]||(s[7]=v("div",{class:"mb-6"},[v("h2",{class:"m-0 mb-2 text-xl font-medium"},"æé忢æ¼ç¤º"),v("p",{class:"m-0 leading-[1.6] text-g-700"}," ç¹å»ä¸æ¹æé®åæ¢ä¸åç¨æ·èº«ä»½ï¼æ¨¡æä¸åç¨æ·ç»å½ç³»ç»çææã忢åä¼å½±åæ´ä¸ªç³»ç»çèåæ¾ç¤ºåæé®æéã ")],-1)),v("div",U,[f(i,{shadow:"never"},{header:b(()=>[...s[0]||(s[0]=[v("div",{class:"font-semibold"},[v("span",null,"å½åç»å½ç¨æ·")],-1)])]),default:b(()=>{var e,l;return[v("div",null,[v("div",null,[v("div",A,[s[1]||(s[1]=v("span",{class:"min-w-30 font-semibold"},"ç¨æ·åï¼",-1)),v("span",null,y(r.value.userName||"æªç»å½"),1)]),v("div",I,[s[2]||(s[2]=v("span",{class:"min-w-30 font-semibold"},"è§è²ï¼",-1)),f(a,{type:o(null==(e=r.value.roles)?void 0:e[0])},{default:b(()=>{var e;return[x(y(n(null==(e=r.value.roles)?void 0:e[0])),1)]}),_:1},8,["type"])]),v("div",C,[s[3]||(s[3]=v("span",{class:"min-w-30 font-semibold"},"æéç ï¼",-1)),v("div",D,[(p(!0),u(w,null,h(r.value.buttons,e=>(p(),_(a,{key:e,size:"small",type:"info"},{default:b(()=>[x(y(e),1)]),_:2},1024))),128)),(null==(l=r.value.buttons)?void 0:l.length)?g("",!0):(p(),u("span",T,"æ æéç "))])])])])]}),_:1})]),v("div",F,[f(i,{shadow:"never"},{header:b(()=>[...s[4]||(s[4]=[v("div",{class:"font-semibold"},[v("span",null,"è´¦å·åæ¢")],-1)])]),default:b(()=>[v("div",M,[(p(!0),u(w,null,h(t.value,e=>(p(),u("div",{key:e.key,class:k(["p-5 border border-g-400 rounded-lg tad-300",{"bg-theme/12 !border-theme":r.value.userName===e.userName}])},[v("div",z,[v("div",null,[v("h4",q,y(e.label),1),v("p",J,y(e.description),1),v("div",K,[v("span",L,"ç¨æ·å: "+y(e.userName),1),v("span",B,"è§è²: "+y(e.roles.join(", ")),1)])])]),v("div",G,[r.value.userName!==e.userName?(p(),_(d,{key:0,t
1ype:"primary",onClick:s=>H(e),loading:l.value},{default:b(()=>[...s[5]||(s[5]=[x(" 忢尿¤è§è² ",-1)])]),_:1},8,["onClick","loading"])):(p(),_(a,{key:1,type:"success"},{default:b(()=>[...s[6]||(s[6]=[x("å½åç¨æ·",-1)])]),_:1}))])],2))),128))])]),_:1})])])}}}))));var Q;export{H as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.