import{d as T,r as s,z as U,c as h,a as e,w as l,a$ as L,B as K,b as n,q as S,Z as y,A as w,L as j,f as q,b3 as A,b4 as M,i as O,h as x,E as Y,u as Z,s as $,aY as F,b0 as G,t as r,b1 as H,b2 as J,by as Q,bc as R,o as p}from"./index-DqVhJ65C.js";/* empty css                *//* empty css                      *//* empty css               *//* empty css                  *//* empty css                     *//* empty css                  *//* empty css                 *//* empty css                        *//* empty css                    */import"./el-tooltip-l0sNRNKZ.js";const W={class:"p-6"},X={class:"mb-4 flex flex-wrap gap-2"},ee={class:"flex flex-col"},te={class:"font-medium"},ae={class:"text-xs text-gray-400"},le={class:"text-xs"},oe={class:"text-gray-400"},se={key:1,class:"mt-4 flex justify-end"},ge=T({__name:"User",setup(ne){const _=s([]),c=s(!1),m=s(""),u=s(null),v=s(1),b=s(20),f=s(0),d=async()=>{c.value=!0;try{const i={page:v.value,limit:b.value,keyword:m.value};u.value!==null&&(i.status=u.value);const a=await K.get("/admin/log/login",{params:i});a.code===0&&(_.value=a.data.data||[],f.value=a.data.total||0)}catch(i){console.error(i)}finally{c.value=!1}};return U(()=>{d()}),(i,a)=>{const E=j,g=M,k=A,V=Y,C=O,o=G,B=H,I=J,z=Q,D=R,N=L,P=F;return p(),h("div",W,[e(N,{shadow:"hover"},{default:l(()=>[n("div",X,[e(E,{modelValue:m.value,"onUpdate:modelValue":a[0]||(a[0]=t=>m.value=t),placeholder:"搜索IP/用户名",class:"w-48",clearable:"",onKeyup:q(d,["enter"])},null,8,["modelValue"]),e(k,{modelValue:u.value,"onUpdate:modelValue":a[1]||(a[1]=t=>u.value=t),placeholder:"状态",class:"w-28",clearable:""},{default:l(()=>[e(g,{label:"成功",value:1}),e(g,{label:"失败",value:0})]),_:1},8,["modelValue"]),e(C,{type:"primary",onClick:d},{default:l(()=>[e(V,{class:"mr-1"},{default:l(()=>[e(Z($))]),_:1}),a[3]||(a[3]=x("搜索 ",-1))]),_:1})]),S((p(),y(I,{data:_.value,stripe:"",border:""},{default:l(()=>[e(o,{prop:"id",label:"ID",width:"80"}),e(o,{label:"用户","min-width":"140"},{default:l(({row:t})=>[n("div",ee,[n("span",te,r(t.username||"未知"),1),n("span",ae,"ID: "+r(t.user_id),1)])]),_:1}),e(o,{prop:"ip",label:"登录IP",width:"140"}),e(o,{prop:"location",label:"归属地",width:"120"}),e(o,{label:"设备/浏览器",width:"130"},{default:l(({row:t})=>[n("div",le,[n("div",null,r(t.device||"-"),1),n("div",oe,r(t.browser||"-"),1)])]),_:1}),e(o,{prop:"status",label:"状态",width:"80"},{default:l(({row:t})=>[e(B,{type:t.status===1?"success":"danger",size:"small"},{default:l(()=>[x(r(t.status===1?"成功":"失败"),1)]),_:2},1032,["type"])]),_:1}),e(o,{prop:"remark",label:"备注","min-width":"150","show-overflow-tooltip":""}),e(o,{prop:"create_time",label:"登录时间",width:"170"})]),_:1},8,["data"])),[[P,c.value]]),!c.value&&_.value.length===0?(p(),y(z,{key:0,description:"暂无登录记录"})):w("",!0),f.value>0?(p(),h("div",se,[e(D,{background:"",layout:"total, prev, pager, next",total:f.value,"current-page":v.value,"onUpdate:currentPage":a[2]||(a[2]=t=>v.value=t),"page-size":b.value,onCurrentChange:d},null,8,["total","current-page","page-size"])])):w("",!0)]),_:1})])}}});export{ge as default};
