You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
3.6 KiB
1 line
3.6 KiB
import{n as e}from"./axios-CiYFffbI.js";import{I as t,N as n,V as r,Y as i,_ as a,d as o,it as s,kt as c,nt as l,ut as u,v as d,y as f}from"./runtime-core.esm-bundler-CnFWH3R5.js";import{n as p}from"./index-Dyg4zy2p.js";import{t as m}from"./listTableRowIndex-CwNZabrG.js";import{t as h}from"./datetime-CjmbUMhc.js";var g=1600,_=f({__name:`AuditLogs`,setup(f){let _=s(!1),v=s([]),y=l({current:1,pageSize:20,total:0}),b=l({keyword:``,method:`all`,status_code:void 0,dateRange:[]});async function x(){_.value=!0;try{let{data:e}=await p.get(`/audit-logs`,{params:{keyword:b.keyword||void 0,method:b.method,status_code:b.status_code||void 0,start_date:b.dateRange?.[0]||void 0,end_date:b.dateRange?.[1]||void 0,page:y.current,page_size:y.pageSize}});v.value=e.data,y.total=e.total}catch(t){e.error(t?.response?.data?.message??`加载操作日志失败`)}finally{_.value=!1}}function S(){y.current=1,x()}function C(e){y.current=e,x()}function w(e){return e===`super_admin`?`超级管理员`:e===`venue_admin`?`场馆管理员`:`-`}return n(x),(e,n)=>{let s=r(`a-input`),l=r(`a-option`),f=r(`a-select`),p=r(`a-input-number`),T=r(`a-range-picker`),E=r(`a-button`),D=r(`a-space`),O=r(`a-table-column`),k=r(`a-typography-paragraph`),A=r(`a-table`),j=r(`a-card`);return t(),o(j,{title:`用户与权限 / 操作日志`},{default:i(()=>[d(D,{wrap:``,size:12,style:{"margin-bottom":`12px`}},{default:i(()=>[d(s,{modelValue:b.keyword,"onUpdate:modelValue":n[0]||=e=>b.keyword=e,placeholder:`操作人/路径/动作`,"allow-clear":``,style:{width:`240px`}},null,8,[`modelValue`]),d(f,{modelValue:b.method,"onUpdate:modelValue":n[1]||=e=>b.method=e,style:{width:`120px`}},{default:i(()=>[d(l,{value:`all`},{default:i(()=>[...n[4]||=[a(`全部方法`,-1)]]),_:1}),d(l,{value:`POST`},{default:i(()=>[...n[5]||=[a(`POST`,-1)]]),_:1}),d(l,{value:`PUT`},{default:i(()=>[...n[6]||=[a(`PUT`,-1)]]),_:1}),d(l,{value:`PATCH`},{default:i(()=>[...n[7]||=[a(`PATCH`,-1)]]),_:1}),d(l,{value:`DELETE`},{default:i(()=>[...n[8]||=[a(`DELETE`,-1)]]),_:1})]),_:1},8,[`modelValue`]),d(p,{modelValue:b.status_code,"onUpdate:modelValue":n[2]||=e=>b.status_code=e,min:100,max:599,placeholder:`状态码`,style:{width:`120px`}},null,8,[`modelValue`]),d(T,{modelValue:b.dateRange,"onUpdate:modelValue":n[3]||=e=>b.dateRange=e,style:{width:`260px`}},null,8,[`modelValue`]),d(E,{type:`primary`,onClick:S},{default:i(()=>[...n[9]||=[a(`查询`,-1)]]),_:1}),d(E,{onClick:x},{default:i(()=>[...n[10]||=[a(`刷新`,-1)]]),_:1})]),_:1}),d(A,{class:`list-data-table`,scroll:{x:g},data:v.value,loading:_.value,"row-key":`id`,pagination:{current:y.current,pageSize:y.pageSize,total:y.total,showTotal:!0},onPageChange:C},{columns:i(()=>[d(O,{title:``,width:50,ellipsis:!0,tooltip:!0},{cell:i(({rowIndex:e})=>[a(c(u(m)(e,y.current,y.pageSize)),1)]),_:1}),d(O,{title:`操作人`,"data-index":`username`,width:140,ellipsis:!0,tooltip:!0}),d(O,{title:`角色`,width:120},{cell:i(({record:e})=>[a(c(w(e.role)),1)]),_:1}),d(O,{title:`方法`,"data-index":`method`,width:90}),d(O,{title:`路径`,"data-index":`path`,width:260,ellipsis:!0,tooltip:!0}),d(O,{title:`动作`,"data-index":`action`,width:220,ellipsis:!0,tooltip:!0}),d(O,{title:`状态码`,"data-index":`status_code`,width:100}),d(O,{title:`IP`,"data-index":`ip`,width:140,ellipsis:!0,tooltip:!0}),d(O,{title:`时间`,width:190},{cell:i(({record:e})=>[a(c(u(h)(e.created_at)),1)]),_:1}),d(O,{title:`请求参数`,"min-width":260},{cell:i(({record:e})=>[d(k,{ellipsis:{rows:2}},{default:i(()=>[a(c(e.request_payload?JSON.stringify(e.request_payload):`-`),1)]),_:2},1024)]),_:1})]),_:1},8,[`scroll`,`data`,`loading`,`pagination`])]),_:1})}}});export{_ as default}; |