import{systemApi as w}from"./index-DxOMYcp4.js";import{_ as D,E as B,o as v,c as I,a,d as e,w as i,Y as C,j as V,h as s,r,X as E,b as L,t as h,Z as M,$ as N}from"./index-BKsb6cIX.js";import"./index-B8_nURbH.js";const j={class:"app-page log-workbench"},z={class:"page-hero"},A={class:"log-code"},J={class:"log-code"},P={style:{display:"flex","justify-content":"flex-end","margin-top":"20px"}},S={__name:"LogView",setup(T){const _=s([]),p=s(1),g=s(0),c=s(!1),d=s(!1);B(()=>u());async function u(){c.value=!0;try{const t=await w.getLogs({page:p.value,size:20});_.value=t.records||[],g.value=t.total||0}finally{c.value=!1}}function f(t){return t?t.length>120?t.slice(0,120)+"...":t:"--"}async function m(){await M.confirm("将复制当前 SQLite 数据库到备份目录。建议在低峰时段执行。","备份数据库",{type:"info"}),d.value=!0;try{const t=await w.backupDatabase();N.success("备份已创建："+t.path),await u()}finally{d.value=!1}}return(t,l)=>{const b=r("el-button"),o=r("el-table-column"),y=r("el-table"),x=r("el-pagination"),k=E("loading");return v(),I("div",j,[a("div",z,[l[2]||(l[2]=a("div",{class:"hero-info"},[a("h2",null,"操作日志"),a("p",null,"全操作留痕，不可删除")],-1)),e(b,{type:"primary",onClick:m,loading:d.value,round:""},{default:i(()=>[...l[1]||(l[1]=[L("备份数据库",-1)])]),_:1},8,["loading"])]),C((v(),V(y,{data:_.value,stripe:"",style:{width:"100%"},class:"data-table"},{default:i(()=>[e(o,{prop:"id",label:"ID",width:"70"}),e(o,{prop:"action",label:"操作类型","min-width":"120","show-overflow-tooltip":""}),e(o,{prop:"entityType",label:"实体类型","min-width":"120","show-overflow-tooltip":""}),e(o,{prop:"entityId",label:"实体ID",width:"80"}),e(o,{prop:"operatorId",label:"操作人",width:"90"}),e(o,{prop:"ip",label:"IP 地址","min-width":"140","show-overflow-tooltip":""}),e(o,{prop:"createdAt",label:"操作时间","min-width":"160"}),e(o,{label:"请求参数","min-width":"300","show-overflow-tooltip":""},{default:i(({row:n})=>[a("code",A,h(f(n.oldDataJson)),1)]),_:1}),e(o,{label:"响应数据","min-width":"300","show-overflow-tooltip":""},{default:i(({row:n})=>[a("code",J,h(f(n.newDataJson)),1)]),_:1})]),_:1},8,["data"])),[[k,c.value]]),a("div",P,[e(x,{"current-page":p.value,"onUpdate:currentPage":l[0]||(l[0]=n=>p.value=n),total:g.value,"page-size":20,layout:"total, prev, pager, next",onCurrentChange:u,background:""},null,8,["current-page","total"])])])}}},Y=D(S,[["__scopeId","data-v-e78b0742"]]);export{Y as default};
