import{b as d}from"./monitor-wjQIzRk9.js";import{d as b,u as C,a as T,v as B,o as L,c as N,b as o,w as n,f as r,e as u,h as V,i as I,j as _,B as f,k as D,n as k,L as P,_ as S}from"./index-CkzfmDGw.js";import{R as z}from"./RefreshOutline-DXhpU5zO.js";const A={class:"page-container"},M={class:"table-toolbar"},R=b({__name:"index",setup(j){const m=C(),p=T(),a=B(),g=e=>a.hasPermission(e),c=u([]),s=u(!1),h=[{title:"序号",key:"index",width:60,render:(e,t)=>t+1},{title:"会话编号",key:"tokenId",ellipsis:{tooltip:!0},minWidth:180},{title:"登录名称",key:"loginName",width:100},{title:"主机",key:"ipaddr",width:130},{title:"登录地点",key:"loginLocation",width:140},{title:"浏览器",key:"browser",width:120},{title:"操作系统",key:"os",width:120},{title:"会话状态",key:"status",width:100,render(e){return k(P,{type:e.status===1?"success":"default",size:"small"},{default:()=>e.status===1?"在线":"离线"})}},{title:"登录时间",key:"loginTime",width:180},{title:"最后访问时间",key:"lastAccessTime",width:180},{title:"操作",key:"actions",width:100,fixed:"right",render(e){return g("monitor:online:forceLogout")?k(f,{size:"small",type:"error",onClick:()=>y(e)},{default:()=>"强退"}):"-"}}];async function i(){s.value=!0;try{c.value=await d.list()}finally{s.value=!1}}function y(e){p.warning({title:"提示",content:"确定要强制下线该用户吗？",positiveText:"确定",negativeText:"取消",onPositiveClick:async()=>{const t=e.tokenValue||e.tokenId,l=!!a.token&&t===a.token;if(await d.forceLogout(t),m.success("操作成功"),l){await a.logout();return}i()}})}return L(()=>i()),(e,t)=>{const l=r("n-icon"),w=r("n-data-table"),v=r("n-card");return V(),N("div",A,[o(v,{class:"page-layout"},{default:n(()=>[I("div",M,[o(_(f),{onClick:i},{icon:n(()=>[o(l,null,{default:n(()=>[o(_(z))]),_:1})]),default:n(()=>[t[0]||(t[0]=D(" 刷新 ",-1))]),_:1})]),o(w,{columns:h,data:c.value,loading:s.value,"row-key":x=>x.tokenId},null,8,["data","loading","row-key"])]),_:1})])}}}),U=S(R,[["__scopeId","data-v-81bd632a"]]);export{U as default};
