mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-06 00:18:51 +08:00
2 lines
2.1 KiB
JavaScript
2 lines
2.1 KiB
JavaScript
var d=(n,u,a)=>new Promise((s,o)=>{var p=t=>{try{i(a.next(t))}catch(r){o(r)}},l=t=>{try{i(a.throw(t))}catch(r){o(r)}},i=t=>t.done?s(t.value):Promise.resolve(t.value).then(p,l);i((a=a.apply(n,u)).next())});import{r as g,a as m,m as z,f as C,aZ as T,bp as P,J as f,aF as L,h as R}from"./index-DI6gHrBb.js";import{g as Y}from"./system-CBO3MjLi.js";import{u as w}from"./hooks-C5xYPx2U.js";function k(n){const u=g({username:"",status:"",loginTime:""}),a=m([]),s=m(!0),o=m(0),{tagStyle:p}=w(),l=g({total:0,pageSize:10,currentPage:1,background:!0}),i=[{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:y})=>C(R("el-tag"),{size:y.size,style:p.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 r(e){}function h(e){o.value=e.length,n.value.setAdaptive()}function b(){o.value=0,n.value.getTableRef().clearSelection()}function v(){const e=n.value.getTableRef().getSelectionRows();f(`已删除序号为 ${L(e,"id")} 的数据`,{type:"success"}),n.value.getTableRef().clearSelection(),c()}function S(){f("已删除所有日志数据",{type:"success"}),c()}function c(){return d(this,null,function*(){s.value=!0;const{data:e}=yield Y(P(u));a.value=e.list,l.total=e.total,l.pageSize=e.pageSize,l.currentPage=e.currentPage,setTimeout(()=>{s.value=!1},500)})}const W=e=>{e&&(e.resetFields(),c())};return z(()=>{c()}),{form:u,loading:s,columns:i,dataList:a,pagination:l,selectedNum:o,onSearch:c,clearAll:S,resetForm:W,onbatchDel:v,handleSizeChange:t,onSelectionCancel:b,handleCurrentChange:r,handleSelectionChange:h}}export{k as useRole};
|