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.8 KiB
1 line
3.8 KiB
import{I as e,N as t,V as n,Y as r,_ as i,d as a,it as o,kt as s,nt as c,u as l,ut as u,v as d,y as f}from"./runtime-core.esm-bundler-CnFWH3R5.js";import{t as p}from"./message-Dh9377vh.js";import{n as m}from"./http-BWP--XXK.js";import{a as h}from"./index-D-AZ5ijJ.js";import{t as g}from"./datetime-CjmbUMhc.js";import{t as _}from"./listTableRowIndex-ekx2Z6yT.js";var v={class:`audit-api-endpoint`},y=1280,b=h(f({__name:`AuditLogs`,setup(f){let h=o(!1),b=o([]),x=c({current:1,pageSize:20,total:0}),S=c({keyword:``,method:`all`,status_code:void 0,dateRange:[]});async function C(){h.value=!0;try{let{data:e}=await m.get(`/audit-logs`,{params:{keyword:S.keyword||void 0,method:S.method,status_code:S.status_code||void 0,start_date:S.dateRange?.[0]||void 0,end_date:S.dateRange?.[1]||void 0,page:x.current,page_size:x.pageSize}});b.value=e.data,x.total=e.total}catch(e){p.error(e?.response?.data?.message??`加载操作日志失败`)}finally{h.value=!1}}function w(){x.current=1,C()}function T(e){x.current=e,C()}function E(e){return e.operation_summary&&String(e.operation_summary).trim()!==``?e.operation_summary:e.action&&String(e.action).trim()!==``?e.action:`—`}function D(e){let t=(e.method||``).toUpperCase()||`—`,n=(e.path||``).trim();return!n||n===`/`?t+` —`:(n.startsWith(`/`)||(n=`/`+n),`${t} ${n}`)}return t(C),(t,o)=>{let c=n(`a-alert`),f=n(`a-input`),p=n(`a-option`),m=n(`a-select`),C=n(`a-input-number`),O=n(`a-range-picker`),k=n(`a-button`),A=n(`a-space`),j=n(`a-table-column`),M=n(`a-table`),N=n(`a-card`);return e(),a(N,{title:`用户与权限 / 操作日志`},{default:r(()=>[d(c,{type:`info`,style:{"margin-bottom":`12px`},closable:``},{default:r(()=>[...o[4]||=[i(` 此处为「操作日志」(写操作审计)。系统设置里的「系统日志」页面用于查看服务器 Laravel 日志文件,不是本页。列表不包含 GET 类查询请求。 `,-1)]]),_:1}),d(A,{wrap:``,size:12,style:{"margin-bottom":`12px`}},{default:r(()=>[d(f,{modelValue:S.keyword,"onUpdate:modelValue":o[0]||=e=>S.keyword=e,placeholder:`操作人 / 操作项`,"allow-clear":``,style:{width:`240px`}},null,8,[`modelValue`]),d(m,{modelValue:S.method,"onUpdate:modelValue":o[1]||=e=>S.method=e,style:{width:`120px`}},{default:r(()=>[d(p,{value:`all`},{default:r(()=>[...o[5]||=[i(`全部方法`,-1)]]),_:1}),d(p,{value:`POST`},{default:r(()=>[...o[6]||=[i(`POST`,-1)]]),_:1}),d(p,{value:`PUT`},{default:r(()=>[...o[7]||=[i(`PUT`,-1)]]),_:1}),d(p,{value:`PATCH`},{default:r(()=>[...o[8]||=[i(`PATCH`,-1)]]),_:1}),d(p,{value:`DELETE`},{default:r(()=>[...o[9]||=[i(`DELETE`,-1)]]),_:1})]),_:1},8,[`modelValue`]),d(C,{modelValue:S.status_code,"onUpdate:modelValue":o[2]||=e=>S.status_code=e,min:100,max:599,placeholder:`状态码`,style:{width:`120px`}},null,8,[`modelValue`]),d(O,{modelValue:S.dateRange,"onUpdate:modelValue":o[3]||=e=>S.dateRange=e,style:{width:`260px`}},null,8,[`modelValue`]),d(k,{type:`primary`,onClick:w},{default:r(()=>[...o[10]||=[i(`查询`,-1)]]),_:1})]),_:1}),d(M,{class:`list-data-table`,scroll:{x:y},data:b.value,loading:h.value,"row-key":`id`,pagination:{current:x.current,pageSize:x.pageSize,total:x.total,showTotal:!0},onPageChange:T},{columns:r(()=>[d(j,{title:``,width:52,ellipsis:!0,tooltip:!0},{cell:r(({rowIndex:e})=>[i(s(u(_)(e,x.current,x.pageSize)),1)]),_:1}),d(j,{title:`操作人`,"data-index":`username`,width:140,ellipsis:!0,tooltip:!0},{cell:r(({record:e})=>[i(s(e.username||`—`),1)]),_:1}),d(j,{title:`操作时间`,width:178},{cell:r(({record:e})=>[i(s(u(g)(e.created_at)),1)]),_:1}),d(j,{title:`接口`,width:320,ellipsis:!0,tooltip:!0},{cell:r(({record:e})=>[l(`span`,v,s(D(e)),1)]),_:1}),d(j,{title:`操作项`,"min-width":320,ellipsis:!0,tooltip:!0},{cell:r(({record:e})=>[i(s(E(e)),1)]),_:1})]),_:1},8,[`scroll`,`data`,`loading`,`pagination`])]),_:1})}}}),[[`__scopeId`,`data-v-f4d2ff07`]]);export{b as default}; |