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

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,u,ut as d,v as f,y as p}from"./runtime-core.esm-bundler-CnFWH3R5.js";import{n as m}from"./http-LCi9aT1G.js";import{u as h}from"./index-B07osdMA.js";import{t as g}from"./listTableRowIndex-Bl-nc9Qt.js";import{t as _}from"./datetime-DLy52ZIc.js";var v={class:`audit-api-endpoint`},y=1280,b=h(p({__name:`AuditLogs`,setup(p){let h=s(!1),b=s([]),x=l({current:1,pageSize:20,total:0}),S=l({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(t){e.error(t?.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 n(C),(e,n)=>{let s=r(`a-alert`),l=r(`a-input`),p=r(`a-option`),m=r(`a-select`),C=r(`a-input-number`),O=r(`a-range-picker`),k=r(`a-button`),A=r(`a-space`),j=r(`a-table-column`),M=r(`a-table`),N=r(`a-card`);return t(),o(N,{title:`用户与权限 / 操作日志`},{default:i(()=>[f(s,{type:`info`,style:{"margin-bottom":`12px`},closable:``},{default:i(()=>[...n[4]||=[a(` 此处为「操作日志」(写操作审计)。系统设置里的「系统日志」页面用于查看服务器 Laravel 日志文件,不是本页。列表不包含 GET 类查询请求。 `,-1)]]),_:1}),f(A,{wrap:``,size:12,style:{"margin-bottom":`12px`}},{default:i(()=>[f(l,{modelValue:S.keyword,"onUpdate:modelValue":n[0]||=e=>S.keyword=e,placeholder:`操作人 / 操作项`,"allow-clear":``,style:{width:`240px`}},null,8,[`modelValue`]),f(m,{modelValue:S.method,"onUpdate:modelValue":n[1]||=e=>S.method=e,style:{width:`120px`}},{default:i(()=>[f(p,{value:`all`},{default:i(()=>[...n[5]||=[a(`全部方法`,-1)]]),_:1}),f(p,{value:`POST`},{default:i(()=>[...n[6]||=[a(`POST`,-1)]]),_:1}),f(p,{value:`PUT`},{default:i(()=>[...n[7]||=[a(`PUT`,-1)]]),_:1}),f(p,{value:`PATCH`},{default:i(()=>[...n[8]||=[a(`PATCH`,-1)]]),_:1}),f(p,{value:`DELETE`},{default:i(()=>[...n[9]||=[a(`DELETE`,-1)]]),_:1})]),_:1},8,[`modelValue`]),f(C,{modelValue:S.status_code,"onUpdate:modelValue":n[2]||=e=>S.status_code=e,min:100,max:599,placeholder:`状态码`,style:{width:`120px`}},null,8,[`modelValue`]),f(O,{modelValue:S.dateRange,"onUpdate:modelValue":n[3]||=e=>S.dateRange=e,style:{width:`260px`}},null,8,[`modelValue`]),f(k,{type:`primary`,onClick:w},{default:i(()=>[...n[10]||=[a(`查询`,-1)]]),_:1})]),_:1}),f(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:i(()=>[f(j,{title:``,width:52,ellipsis:!0,tooltip:!0},{cell:i(({rowIndex:e})=>[a(c(d(g)(e,x.current,x.pageSize)),1)]),_:1}),f(j,{title:`操作人`,"data-index":`username`,width:140,ellipsis:!0,tooltip:!0},{cell:i(({record:e})=>[a(c(e.username||``),1)]),_:1}),f(j,{title:`操作时间`,width:178},{cell:i(({record:e})=>[a(c(d(_)(e.created_at)),1)]),_:1}),f(j,{title:`接口`,width:320,ellipsis:!0,tooltip:!0},{cell:i(({record:e})=>[u(`span`,v,c(D(e)),1)]),_:1}),f(j,{title:`操作项`,"min-width":320,ellipsis:!0,tooltip:!0},{cell:i(({record:e})=>[a(c(E(e)),1)]),_:1})]),_:1},8,[`scroll`,`data`,`loading`,`pagination`])]),_:1})}}}),[[`__scopeId`,`data-v-f4d2ff07`]]);export{b as default};