import{$n as e,Ar as t,Jn as n,M as r,P as i,Qn as a,Rt as o,br as s,cr as c,gr as l,qn as u,t as d,tr as f,ur as p}from"./index-ngtHwr8t.js";import{t as m}from"./useSnackbar-D7YOfKok.js";import{t as h}from"./VChip-pM5_2xb4.js";import{a as g}from"./VSelectionControl-B8N1uBPi.js";import{t as _}from"./VSpacer-B9pYUh4l.js";import{t as v}from"./VSelect-dA-HhEp_.js";import{t as y}from"./VDataTableServer-DSbw4kV5.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=f({__name:`AuditPage`,setup(f){let T=m(),E=s(!1),D=s([]),O=s(0),k=s(1),A=s(null),j=s(``),M=s(``),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 o.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 c(()=>F()),(o,s)=>(p(),n(g,{fluid:``,class:`pa-6`},{default:l(()=>[e(r,{elevation:`0`,border:``,rounded:`lg`},{default:l(()=>[e(i,{class:`d-flex align-center`},{default:l(()=>[s[7]||=a(` 审计日志 `,-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(d,{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(d,{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":l(({item:n})=>[e(h,{color:I(n.action),size:`small`,variant:`tonal`,label:``},{default:l(()=>[a(t(n.action),1)]),_:2},1032,[`color`])]),"item.admin_username":l(({item:e})=>[u(`span`,b,t(e.admin_username),1)]),"item.target":l(({item:e})=>[u(`span`,x,t(e.resource_type)+t(e.resource_id?` #${e.resource_id}`:``),1)]),"item.detail":l(({item:e})=>[u(`span`,S,t(e.detail||`—`),1)]),"item.ip_address":l(({item:e})=>[u(`span`,C,t(e.ip_address||`—`),1)]),"item.created_at":l(({item:e})=>[u(`span`,w,t(e.created_at),1)]),"no-data":l(()=>[...s[8]||=[u(`div`,{class:`text-center text-medium-emphasis py-6`},`暂无数据`,-1)]]),_:1},8,[`items`,`items-length`,`loading`,`page`])]),_:1})]),_:1}))}});export{T as default};