import{d as F,r as c,u as D,t as R,F as o,a as i,j as e,I as E,S as M,D as f,b as y,B as j,R as z,g as h,s as r,c as L}from"./index-BtzNP73w.js";import{R as C}from"./FileAddOutlined-Cp67G1mx.js";import{F as N}from"./Table-BCm752cP.js";import"./iconUtil-D_WnT0lW.js";import"./index-B6m4IotF.js";const O=F.div`
height: 100%;
font-size: 16px;

display: flex;
flex-direction: column;
.topSearch {
  height: 60px;
  padding-left: 15px;
  margin-bottom: 16px;
  background-color: ${d=>d.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;
  box-sizing: border-box;
  overflow: hidden;
  background-color: ${d=>d.theme.colorBgContainer};
}
`,$=c.memo(()=>{const d=D(),{token:p}=R.useToken(),[b,m]=c.useState(0),[u]=o.useForm(),[T,g]=c.useState([]);c.useEffect(()=>{const t={StartTime:i().add(-1,"y").format("YYYY-MM-DD"),EndTime:i().startOf("day").format("YYYY-MM-DD"),pageIndex:1,pageSize:50};(async()=>{const{code:a,data:{items:s,totalRecords:l}}=await h("/api/SysLog/All",t);a===200&&(g(s),m(l))})()},[]);const S=[{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(y,{style:{color:p.colorPrimaryText},children:e.jsxs("span",{style:{cursor:"pointer"},onClick:()=>v(),children:[e.jsx(L,{})," 编辑问卷"]})})}],w=async t=>{if(t.StartTime)if(t.EndTime){if(i(t.StartTime).valueOf()>i(t.EndTime).valueOf()){r.warning("开始日期不得大于结束日期");return}}else{r.warning("请选择结束日期");return}else{r.warning("请选择开始日期");return}const n={...t};n.pageIndex=1,n.pageSize=50,console.log(n);try{const{code:a,data:{items:s,totalRecords:l},msg:x}=await h("/api/SysLog/All",n);a===200?(g(s),m(l)):r.warning(x)}catch(a){r.error(a)}},I=async(t,n)=>{const a=u.getFieldValue();if(a.StartTime)if(a.EndTime){if(i(a.StartTime).valueOf()>i(a.EndTime).valueOf()){r.warning("开始日期不得大于结束日期");return}}else{r.warning("请选择结束日期");return}else{r.warning("请选择开始日期");return}const s={...a};s.pageIndex=t,s.pageSize=n;try{const{code:l,data:{items:x,totalRecords:k},msg:Y}=await h("/api/SysLog/All",s);l===200?(g(x),m(k)):r.warning(Y)}catch(l){r.error(l)}},v=()=>{d("/layout/SurveyTaskManageEdit")};return e.jsxs(O,{theme:p,children:[e.jsx("div",{className:"topSearch",children:e.jsxs(o,{form:u,layout:"inline",onFinish:w,initialValues:{Msg:"",Level:"",StartTime:i().subtract(1,"year"),EndTime:i()},children:[e.jsx(o.Item,{label:"消 息 : ",name:"Msg",children:e.jsx(E,{allowClear:!0,placeholder:"请输入消息"})}),e.jsx(o.Item,{label:"等 级 : ",name:"Level",children:e.jsx(M,{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(o.Item,{label:"开始日期 : ",name:"StartTime",children:e.jsx(f,{format:"YYYY-MM-DD"})}),e.jsx(o.Item,{label:"结束日期 : ",name:"EndTime",children:e.jsx(f,{format:"YYYY-MM-DD"})}),e.jsx(o.Item,{children:e.jsxs(y,{children:[e.jsxs(j,{type:"primary",htmlType:"submit",children:[e.jsx(z,{}),"查 询"]}),e.jsxs(j,{htmlType:"submit",children:[e.jsx(C,{}),"新建问卷"]})]})})]})}),e.jsx("div",{className:"tableList",children:e.jsx(N,{size:"small",sticky:!0,rowKey:t=>t.id,columns:S,dataSource:T,pagination:{defaultPageSize:50,total:b,showSizeChanger:!0,showQuickJumper:!0,onChange:I,showTotal:t=>`共 ${t} 条`}})})]})});$.displayName="SurveyTask";export{$ as default};
