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-BbRh5og5.js";import{t as m}from"./datetime-3T8f3S0H.js";import{t as h}from"./listTable-Djel28e5.js";var g=f({__name:`AuditLogs`,setup(f){let g=s(!1),_=s([]),v=l({current:1,pageSize:20,total:0}),y=l({keyword:``,method:`all`,status_code:void 0,dateRange:[]});async function b(){g.value=!0;try{let{data:e}=await p.get(`/audit-logs`,{params:{keyword:y.keyword||void 0,method:y.method,status_code:y.status_code||void 0,start_date:y.dateRange?.[0]||void 0,end_date:y.dateRange?.[1]||void 0,page:v.current,page_size:v.pageSize}});_.value=e.data,v.total=e.total}catch(t){e.error(t?.response?.data?.message??`加载操作日志失败`)}finally{g.value=!1}}function x(){v.current=1,b()}function S(e){v.current=e,b()}function C(e){return e===`super_admin`?`超级管理员`:e===`venue_admin`?`场馆管理员`:`-`}return n(b),(e,n)=>{let s=r(`a-input`),l=r(`a-option`),f=r(`a-select`),p=r(`a-input-number`),w=r(`a-range-picker`),T=r(`a-button`),E=r(`a-space`),D=r(`a-table-column`),O=r(`a-typography-paragraph`),k=r(`a-table`),A=r(`a-card`);return t(),o(A,{title:`用户与权限 / 操作日志`},{default:i(()=>[d(E,{wrap:``,size:12,style:{"margin-bottom":`12px`}},{default:i(()=>[d(s,{modelValue:y.keyword,"onUpdate:modelValue":n[0]||=e=>y.keyword=e,placeholder:`操作人/路径/动作`,"allow-clear":``,style:{width:`240px`}},null,8,[`modelValue`]),d(f,{modelValue:y.method,"onUpdate:modelValue":n[1]||=e=>y.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:y.status_code,"onUpdate:modelValue":n[2]||=e=>y.status_code=e,min:100,max:599,placeholder:`状态码`,style:{width:`120px`}},null,8,[`modelValue`]),d(w,{modelValue:y.dateRange,"onUpdate:modelValue":n[3]||=e=>y.dateRange=e,style:{width:`260px`}},null,8,[`modelValue`]),d(T,{type:`primary`,onClick:x},{default:i(()=>[...n[9]||=[a(`查询`,-1)]]),_:1}),d(T,{onClick:b},{default:i(()=>[...n[10]||=[a(`刷新`,-1)]]),_:1})]),_:1}),d(k,{class:`list-data-table`,scroll:{x:u(h)},data:_.value,loading:g.value,"row-key":`id`,pagination:{current:v.current,pageSize:v.pageSize,total:v.total,showTotal:!0},onPageChange:S},{columns:i(()=>[d(D,{title:`ID`,"data-index":`id`,width:88}),d(D,{title:`操作人`,"data-index":`username`,width:140,ellipsis:!0,tooltip:!0}),d(D,{title:`角色`,width:120},{cell:i(({record:e})=>[a(c(C(e.role)),1)]),_:1}),d(D,{title:`方法`,"data-index":`method`,width:90}),d(D,{title:`路径`,"data-index":`path`,width:260,ellipsis:!0,tooltip:!0}),d(D,{title:`动作`,"data-index":`action`,width:220,ellipsis:!0,tooltip:!0}),d(D,{title:`状态码`,"data-index":`status_code`,width:100}),d(D,{title:`IP`,"data-index":`ip`,width:140,ellipsis:!0,tooltip:!0}),d(D,{title:`时间`,width:190},{cell:i(({record:e})=>[a(c(u(m)(e.created_at)),1)]),_:1}),d(D,{title:`请求参数`,"min-width":260},{cell:i(({record:e})=>[d(O,{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{g as default};