var g=(n,p,a)=>new Promise((i,o)=>{var d=t=>{try{r(a.next(t))}catch(c){o(c)}},l=t=>{try{r(a.throw(t))}catch(c){o(c)}},r=t=>t.done?i(t.value):Promise.resolve(t.value).then(d,l);r((a=a.apply(n,p)).next())});import{r as f,a as m,m as z,g as C,a_ as T,bq as P,I as h,aG as L,b as R}from"./index-BXySHhHT.js";import{g as Y}from"./system-DCf6ZbVd.js";import{u as w}from"./hooks-DWcuK1Si.js";function k(n){const p=f({username:"",status:"",loginTime:""}),a=m([]),i=m(!0),o=m(0),{tagStyle:d}=w(),l=f({total:0,pageSize:10,currentPage:1,background:!0}),r=[{label:"勾选列",type:"selection",fixed:"left",reserveSelection:!0},{label:"序号",prop:"id",minWidth:90},{label:"用户名",prop:"username",minWidth:100},{label:"登录 IP",prop:"ip",minWidth:140},{label:"登录地点",prop:"address",minWidth:140},{label:"操作系统",prop:"system",minWidth:100},{label:"浏览器类型",prop:"browser",minWidth:100},{label:"登录状态",prop:"status",minWidth:100,cellRenderer:({row:e,props:s})=>C(R("el-tag"),{size:s.size,style:d.value(e.status)},{default:()=>[e.status===1?"成功":"失败"]})},{label:"登录行为",prop:"behavior",minWidth:100},{label:"登录时间",prop:"loginTime",minWidth:180,formatter:({loginTime:e})=>T(e).format("YYYY-MM-DD HH:mm:ss")}];function t(e){}function c(e){}function b(e){o.value=e.length,n.value.setAdaptive()}function v(){o.value=0,n.value.getTableRef().clearSelection()}function S(){const e=n.value.getTableRef().getSelectionRows();h(`已删除序号为 ${L(e,"id")} 的数据`,{type:"success"}),n.value.getTableRef().clearSelection(),u()}function W(){h("已删除所有日志数据",{type:"success"}),u()}function u(){return g(this,null,function*(){i.value=!0;const{code:e,data:s}=yield Y(P(p));e===0&&(a.value=s.list,l.total=s.total,l.pageSize=s.pageSize,l.currentPage=s.currentPage),setTimeout(()=>{i.value=!1},500)})}const y=e=>{e&&(e.resetFields(),u())};return z(()=>{u()}),{form:p,loading:i,columns:r,dataList:a,pagination:l,selectedNum:o,onSearch:u,clearAll:W,resetForm:y,onbatchDel:S,handleSizeChange:t,onSelectionCancel:v,handleCurrentChange:c,handleSelectionChange:b}}export{k as useRole};