import{p as w,r as h,t as z,F as c,d as r,j as e,I as E,S as L,D as f,B as O,R as C,h as _,aK as y,g as u,a as B,s as l}from"./index-CKIL6d0V.js";import{F as P}from"./Table-BaVi_066.js";import"./iconUtil-Co5gbObL.js";import"./index-C-LPyJas.js";const V=w.div`
height: 100%;
font-size: 16px;

display: flex;
flex-direction: column;
.topSearch {
  height: 60px;
  padding-left: 15px;
  margin-bottom: 16px;
  background-color: ${i=>i.theme.colorBgContainer};
  .ant-form {
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .ant-row {
      width: 300px;
      .ant-form-item-label > label {
        font-size: 18px;
        letter-spacing: 2px;
      }
      &:nth-last-child(2) {
        width: 600px;
      }
    }
  }
  .userTitle {
    height: 100%;
    line-height: 60px;
    font-size: 18px;
    letter-spacing: 2px;
    .word {
      margin-left: 10px;
    }
  }
}

.tableList {
  flex: 1;
  height: 100%;
  padding: 16px;
  padding-top: 0;
  box-sizing: border-box;
  overflow: hidden;
  background-color: ${i=>i.theme.colorBgContainer};
}
`,$=w.div`
  height: 100%;
  min-height: 100px;
  padding: 16px;
  .log_info {
      width: 100%;
      max-height: 600px;
      overflow: auto;
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;
      line-height: 45px;
      font-size: 18px;
      li > span {
          display: inline-block;
          width: 80px;
          text-align: right;
        }
      .short {
        width: 45%;
        user-select: text;
      }
      .long {
        width: 90%;
        user-select: text;
      }
      .line {
        width: 100%;
        height: 2px;
        margin-bottom: 16px;
        border-top: 1px dotted ${i=>i.theme.colorBorderSecondary};
      }
    }
`,A=h.memo(()=>{const{token:i}=z.useToken(),[b,x]=h.useState(!1),[I,m]=h.useState(0),[a,S]=h.useState({}),[j]=c.useForm(),[T,p]=h.useState([]);h.useEffect(()=>{const t={StartTime:r().add(-1,"y").format("YYYY-MM-DD"),EndTime:r().startOf("day").format("YYYY-MM-DD"),pageIndex:1,pageSize:50};(async()=>{const{code:s,data:{items:o,totalRecords:d}}=await u("/api/SysLog/All",t);s===200&&(p(o),m(d))})()},[]);const N=[{title:"ID",dataIndex:"id",align:"center",width:80,key:"id",render:t=>e.jsx(e.Fragment,{children:t})},{title:"操作人",dataIndex:"userId",width:120,align:"center",key:"id",render:t=>e.jsx(e.Fragment,{children:t})},{title:"等级",dataIndex:"level",align:"center",key:"id",render:t=>e.jsx(e.Fragment,{children:t})},{title:"内容",dataIndex:"msg",width:400,align:"center",ellipsis:!0,key:"id",render:t=>e.jsx(e.Fragment,{children:t})},{title:"IP",dataIndex:"ip",align:"center",key:"id",render:t=>e.jsx(e.Fragment,{children:t})},{title:"时间",dataIndex:"createTime",align:"center",key:"id",render:t=>e.jsx(e.Fragment,{children:t})},{title:"操 作",dataIndex:"id",align:"center",key:"id",render:(t,n)=>e.jsx(B,{style:{color:i.colorPrimaryText},children:e.jsxs("span",{style:{cursor:"pointer"},onClick:()=>D(n),children:[e.jsx(y,{})," 详细信息"]})})}],k=async t=>{if(t.StartTime)if(t.EndTime){if(r(t.StartTime).valueOf()>r(t.EndTime).valueOf()){l.warning("开始日期不得大于结束日期");return}}else{l.warning("请选择结束日期");return}else{l.warning("请选择开始日期");return}const n={...t};n.pageIndex=1,n.pageSize=50,console.log(n);try{const{code:s,data:{items:o,totalRecords:d},msg:g}=await u("/api/SysLog/All",n);s===200?(p(o),m(d)):l.warning(g)}catch(s){l.error(s)}},v=async(t,n)=>{const s=j.getFieldValue();if(s.StartTime)if(s.EndTime){if(r(s.StartTime).valueOf()>r(s.EndTime).valueOf()){l.warning("开始日期不得大于结束日期");return}}else{l.warning("请选择结束日期");return}else{l.warning("请选择开始日期");return}const o={...s};o.pageIndex=t,o.pageSize=n;try{const{code:d,data:{items:g,totalRecords:F},msg:R}=await u("/api/SysLog/All",o);d===200?(p(g),m(F)):l.warning(R)}catch(d){l.error(d)}},D=t=>{S(t),x(!0)},M=()=>{x(!1)},Y=()=>{x(!1)};return e.jsxs(V,{theme:i,children:[e.jsx("div",{className:"topSearch",children:e.jsxs(c,{form:j,layout:"inline",onFinish:k,initialValues:{Msg:"",Level:"",StartTime:r().subtract(1,"year"),EndTime:r()},children:[e.jsx(c.Item,{label:"消 息 : ",name:"Msg",children:e.jsx(E,{allowClear:!0,className:"ysh_antd_input",placeholder:"请输入消息"})}),e.jsx(c.Item,{label:"等 级 : ",name:"Level",children:e.jsx(L,{className:"ysh_antd_select",options:[{value:"",label:"all"},{value:"Trace",label:"Trace"},{value:"Info",label:"Info"},{value:"Debug",label:"Debug"},{value:"Error",label:"Error"},{value:"Fatal",label:"Fatal"},{value:"Warn",label:"Warn"}]})}),e.jsx(c.Item,{label:"开始日期 : ",name:"StartTime",children:e.jsx(f,{format:"YYYY-MM-DD"})}),e.jsx(c.Item,{label:"结束日期 : ",name:"EndTime",children:e.jsx(f,{format:"YYYY-MM-DD"})}),e.jsx(c.Item,{children:e.jsxs(O,{type:"primary",htmlType:"submit",children:[e.jsx(C,{}),"查 询"]})})]})}),e.jsx("div",{className:"tableList",children:e.jsx(P,{className:"ysh_antd_table",size:"small",sticky:!0,rowKey:t=>t.id,columns:N,dataSource:T,pagination:{defaultPageSize:50,total:I,showSizeChanger:!0,showQuickJumper:!0,onChange:v,showTotal:t=>`共 ${t} 条`}})}),e.jsx(_,{text:e.jsxs("span",{style:{fontSize:"24px"},children:[e.jsx(y,{})," 日志详情"]}),width:"70%",open:b,onOk:M,onCancel:Y,children:e.jsx($,{children:e.jsxs("ul",{className:"log_info",children:[e.jsxs("li",{className:"short",children:[e.jsx("span",{children:"ID :"}),"      ",a.id]}),e.jsxs("li",{className:"short",children:[e.jsx("span",{children:"操作人 :"}),"      ",a.userId]}),e.jsxs("li",{className:"short",children:[e.jsx("span",{children:"应用名 :"}),"      ",a.appName]}),e.jsxs("li",{className:"short",children:[e.jsx("span",{children:"创建时间:"}),"      ",a.createTime]}),e.jsxs("li",{className:"short",children:[e.jsx("span",{children:"IP :"}),"      ",a.ip]}),e.jsxs("li",{className:"short",children:[e.jsx("span",{children:"等级 :"}),"     ",a.level]}),e.jsxs("li",{className:"short",children:[e.jsx("span",{children:"URL :"}),"      ",a.url]}),e.jsxs("li",{className:"long",children:[e.jsx("span",{children:"浏览器 :"}),"     ",a.useragent]}),e.jsx("p",{className:"line"}),e.jsxs("li",{className:"long",children:[e.jsx("span",{children:"记录器 :"}),"     ",a.logger]}),e.jsxs("li",{className:"long",children:[e.jsx("span",{children:"内容 :"}),"     ",a.msg]}),e.jsxs("li",{className:"long",children:[e.jsx("span",{children:"异常 :"}),"     ",a.exception]})]})})})]})});A.displayName="SystemRecord";export{A as default};
