import{$n as e,Jn as t,M as n,P as r,Qn as i,Rt as a,_r as o,cr as s,jr as c,qn as l,t as u,tr as d,ur as f,xr as p}from"./index-CrPqJ6pQ.js";import{t as m}from"./useSnackbar-D7YOfKok.js";import{t as h}from"./VChip-CQVqOX5b.js";import{a as g}from"./VSelectionControl-BYrT5H5c.js";import{t as _}from"./VSpacer-CZyPSZwX.js";import{t as v}from"./VSelect-mAdfI6nm.js";import{t as y}from"./VDataTableServer-MRe-lY4t.js";var b={class:`font-weight-medium`},x={class:`text-body-2`},S={class:`text-body-2 text-medium-emphasis text-truncate`,style:{"max-width":`300px`,display:`inline-block`}},C={class:`text-caption text-medium-emphasis`},w={class:`text-caption text-medium-emphasis`},T=d({__name:`AuditPage`,setup(d){let T=m(),E=p(!1),D=p([]),O=p(0),k=p(1),A=p(null),j=p(``),M=p(``),N=[{label:`创建`,value:`create`},{label:`更新`,value:`update`},{label:`删除`,value:`delete`},{label:`登录`,value:`login`},{label:`登出`,value:`logout`},{label:`执行`,value:`execute`},{label:`推送`,value:`push`}],P=[{title:`操作`,key:`action`,width:100},{title:`用户`,key:`admin_username`,width:100},{title:`目标`,key:`target`,width:140},{title:`详情`,key:`detail`},{title:`IP`,key:`ip_address`,width:120},{title:`时间`,key:`created_at`,width:160}];async function F(){E.value=!0;try{let e=await a.get(`/audit/`,{page:k.value,per_page:50,action:A.value||void 0,admin_username:j.value||void 0,date:M.value||void 0});D.value=e.items||[],O.value=e.total||0}catch{D.value=[],T(`加载审计日志失败`,`error`)}finally{E.value=!1}}function I(e){return e===`create`?`success`:e===`update`?`info`:e===`delete`?`error`:e===`login`||e===`logout`?`secondary`:e===`execute`?`warning`:`primary`}return s(()=>F()),(a,s)=>(f(),t(g,{fluid:``,class:`pa-6`},{default:o(()=>[e(n,{elevation:`0`,border:``,rounded:`lg`},{default:o(()=>[e(r,{class:`d-flex align-center`},{default:o(()=>[s[7]||=i(` 审计日志 `,-1),e(_),e(v,{modelValue:A.value,"onUpdate:modelValue":[s[0]||=e=>A.value=e,s[1]||=e=>{k.value=1,F()}],items:N,"item-title":`label`,"item-value":`value`,label:`操作类型`,variant:`outlined`,density:`compact`,"hide-details":``,style:{"max-width":`160px`},clearable:``},null,8,[`modelValue`]),e(u,{modelValue:j.value,"onUpdate:modelValue":[s[2]||=e=>j.value=e,s[3]||=e=>{k.value=1,F()}],"prepend-inner-icon":`mdi-account`,label:`用户`,variant:`outlined`,density:`compact`,"hide-details":``,style:{"max-width":`140px`},class:`ml-3`,clearable:``},null,8,[`modelValue`]),e(u,{modelValue:M.value,"onUpdate:modelValue":[s[4]||=e=>M.value=e,s[5]||=e=>{k.value=1,F()}],"prepend-inner-icon":`mdi-calendar`,label:`日期`,variant:`outlined`,density:`compact`,"hide-details":``,style:{"max-width":`160px`},class:`ml-3`,type:`date`,clearable:``},null,8,[`modelValue`])]),_:1}),e(y,{items:D.value,headers:P,"items-length":O.value,loading:E.value,page:k.value,"items-per-page":50,hover:``,density:`compact`,"onUpdate:page":s[6]||=e=>{k.value=e,F()}},{"item.action":o(({item:t})=>[e(h,{color:I(t.action),size:`small`,variant:`tonal`,label:``},{default:o(()=>[i(c(t.action),1)]),_:2},1032,[`color`])]),"item.admin_username":o(({item:e})=>[l(`span`,b,c(e.admin_username),1)]),"item.target":o(({item:e})=>[l(`span`,x,c(e.resource_type)+c(e.resource_id?` #${e.resource_id}`:``),1)]),"item.detail":o(({item:e})=>[l(`span`,S,c(e.detail||`—`),1)]),"item.ip_address":o(({item:e})=>[l(`span`,C,c(e.ip_address||`—`),1)]),"item.created_at":o(({item:e})=>[l(`span`,w,c(e.created_at),1)]),"no-data":o(()=>[...s[8]||=[l(`div`,{class:`text-center text-medium-emphasis py-6`},`暂无数据`,-1)]]),_:1},8,[`items`,`items-length`,`loading`,`page`])]),_:1})]),_:1}))}});export{T as default};