var g=(o,i,l)=>new Promise((r,s)=>{var m=a=>{try{n(l.next(a))}catch(c){s(c)}},p=a=>{try{n(l.throw(a))}catch(c){s(c)}},n=a=>a.done?r(a.value):Promise.resolve(a.value).then(m,p);n((l=l.apply(o,i)).next())});import{a1 as x,k as R,f as A,h as _,r as v,a as f,eX as B,m as I,g as h,a_ as N,bq as q,I as d,aG as F,aj as L,j as b,A as M,z as P,b as S}from"./index-BXySHhHT.js";import{_ as V}from"./detail.vue_vue_type_script_setup_true_lang-DLq7maCg.js";import{b as Y,c as j}from"./system-DCf6ZbVd.js";import"./vue-json-pretty-DXgOcZY5.js";const H={viewBox:"0 0 24 24",width:"1em",height:"1em"};function $(o,i){return A(),R("svg",H,[...i[0]||(i[0]=[_("path",{fill:"currentColor",d:"M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m0-2a8 8 0 1 0 0-16a8 8 0 0 0 0 16m-1-5h2v2h-2zm2-1.645V14h-2v-1.5a1 1 0 0 1 1-1a1.5 1.5 0 1 0-1.471-1.794l-1.962-.393A3.501 3.501 0 1 1 13 13.355"},null,-1)])])}const E=x({name:"ri-question-line",render:$});function Q(o){const i=v({module:"",requestTime:""}),l=f([]),r=f(!0),s=f(0),{copied:m,update:p}=B(),n=v({total:0,pageSize:10,currentPage:1,background:!0}),a=[{label:"勾选列",type:"selection",fixed:"left",reserveSelection:!0},{label:"ID",prop:"id",minWidth:90},{label:"所属模块",prop:"module",minWidth:100},{headerRenderer:()=>h("span",{class:"flex-c"},[b("请求接口"),M(h(S("iconifyIconOffline"),{icon:E,class:"ml-1 cursor-help"},null),[[P("tippy"),{content:"双击下面请求接口进行拷贝"}]])]),prop:"url",minWidth:140},{label:"请求方法",prop:"method",minWidth:140},{label:"IP 地址",prop:"ip",minWidth:100},{label:"地点",prop:"address",minWidth:140},{label:"操作系统",prop:"system",minWidth:100},{label:"浏览器类型",prop:"browser",minWidth:100},{label:"请求耗时",prop:"takesTime",minWidth:100,cellRenderer:({row:e,props:t})=>h(S("el-tag"),{size:t.size,type:e.takesTime<1e3?"success":"warning",effect:"plain"},{default:()=>[e.takesTime,b(" ms")]})},{label:"请求时间",prop:"requestTime",minWidth:180,formatter:({requestTime:e})=>N(e).format("YYYY-MM-DD HH:mm:ss")},{label:"操作",fixed:"right",slot:"operation"}];function c(e){}function y(e){}function C(e){s.value=e.length,o.value.setAdaptive()}function D(){s.value=0,o.value.getTableRef().clearSelection()}function T({url:e},{property:t}){t==="url"&&(p(e),m.value?d(`${e} 已拷贝`,{type:"success"}):d("拷贝失败",{type:"warning"}))}function W(){const e=o.value.getTableRef().getSelectionRows();d(`已删除序号为 ${F(e,"id")} 的数据`,{type:"success"}),o.value.getTableRef().clearSelection(),u()}function k(){d("已删除所有日志数据",{type:"success"}),u()}function w(e){j({id:e.id}).then(t=>{L({title:"系统日志详情",fullscreen:!0,hideFooter:!0,contentRenderer:()=>V,props:{data:[t]}})})}function u(){return g(this,null,function*(){r.value=!0;const{code:e,data:t}=yield Y(q(i));e===0&&(l.value=t.list,n.total=t.total,n.pageSize=t.pageSize,n.currentPage=t.currentPage),setTimeout(()=>{r.value=!1},500)})}const z=e=>{e&&(e.resetFields(),u())};return I(()=>{u()}),{form:i,loading:r,columns:a,dataList:l,pagination:n,selectedNum:s,onSearch:u,onDetail:w,clearAll:k,resetForm:z,onbatchDel:W,handleSizeChange:c,onSelectionCancel:D,handleCellDblclick:T,handleCurrentChange:y,handleSelectionChange:C}}export{Q as useRole};