import{m as j}from"./setting-nWDj4rDN.js";import{d as B,r as d,a as y,o as T,f as J,i as o,w as r,t as A,p,v as h,h as l,m as f,y as n,k as S,l as z}from"./index-ByQGGPf6.js";const F={class:"inner-toolbar inner-toolbar2"},G=l("div",{class:"toolbar-btns"},null,-1),M={class:"logInfo"},U={class:"logInfo"},W={class:"logInfo"},$={class:"logInfo"},q={class:"logInfo"},H={class:"logInfo"},K={class:"logInfo"},Z=B({__name:"systemLog",setup(Q){const C=A(),m=d(!1),a=y({page_no:1,page_size:10,company_id:C.state.companId}),c=d({});d("");const v=d(!1),s=d({}),u=y({});d(null);const k=e=>{a.page_size=e,g()},w=e=>{a.page_no=e,g()},I=e=>{Object.assign(a,{keyword:e}),Object.keys(u).forEach(t=>delete a[t]),a.page_no=1,g()},D=()=>{Object.assign(a,u),delete a.start_time,delete a.end_time,u.order_time_range&&(a.start_time=u.order_time_range[0]/1e3,a.end_time=u.order_time_range[1]/1e3),delete a.keyword,delete a.order_time_range,a.page_no=1,g()},g=()=>{m.value=!0;const e=JSON.parse(JSON.stringify(a));Object.keys(e).forEach(t=>{!e[t]&&e[t]!==0&&delete e[t]}),j(e).then(t=>{m.value=!1,c.value=t,a.page_no=t.page_no,a.page_size=t.page_size}).catch(()=>{m.value=!1})},L=e=>{v.value=!0,s.value=e},V=e=>!0,b=e=>new Date(e*1e3).toLocaleString();return T(()=>{g()}),(e,t)=>{const x=p("en-table-search"),_=p("el-table-column"),E=p("el-button"),N=p("el-pagination"),O=p("en-table-layout"),P=p("el-dialog");return h(),J("div",null,[o(O,{tableData:c.value.data,loading:m.value},{toolbar:r(()=>[l("div",F,[G,o(x,{onSearch:I,onAdvancedSearch:D,advanced:"",advancedWidth:"465",placeholder:"账号/操作内容/IP地址"})])]),"table-columns":r(()=>[o(_,{prop:"operator_name",label:"账号"}),o(_,{prop:"operate_detail",label:"操作描述"}),o(_,{label:"操作时间",align:"center"},{default:r(i=>[f(n(b(i.row.operate_time)),1)]),_:1}),o(_,{prop:"operate_ip",label:"IP地址"}),o(_,{label:"日志级别",align:"center"},{default:r(i=>[f(n(i.row.level==="important"?"重要":"一般"),1)]),_:1}),o(_,{label:"操作"},{default:r(i=>[V(["systemLogs:detail"])?(h(),S(E,{key:0,size:"small",type:"primary",onClick:R=>L(i.row)},{default:r(()=>[f("查看")]),_:2},1032,["onClick"])):z("",!0)]),_:1})]),pagination:r(()=>[c.value.data_total?(h(),S(N,{key:0,onSizeChange:k,onCurrentChange:w,"current-page":c.value.page_no,"page-sizes":[10,20,50,100],"page-size":c.value.page_size,layout:"total, sizes, prev, pager, next, jumper",total:c.value.data_total},null,8,["current-page","page-size","total"])):z("",!0)]),_:1},8,["tableData","loading"]),o(P,{title:"日志详情",modelValue:v.value,"onUpdate:modelValue":t[0]||(t[0]=i=>v.value=i),width:"40%"},{default:r(()=>[l("div",M,"账号："+n(s.value.operator_name),1),l("div",U,"操作描述："+n(s.value.operate_detail),1),l("div",W,"请求方法："+n(s.value.method),1),l("div",$,"请求参数："+n(s.value.params),1),l("div",q,"ip地址："+n(s.value.operate_ip),1),l("div",H,"日志级别："+n(s.value.level==="important"?"重要":"一般"),1),l("div",K,"操作时间："+n(b(s.value.operate_time)),1)]),_:1},8,["modelValue"])])}}});export{Z as default};
