import React from 'react';
import Page from '@/components/Page';
import { ProTable } from '@ant-design/pro-components';
import { getSysLog } from '@/service/syslog';
import { queryTable } from '@/utils/request';

export default (props) => {

  const columns = [
    {
      title: "时间",
      dataIndex: "createDate",
      valueType: 'dateRange',
      render: (_, row) => row.createDate ? row.createDate.replace('T', ' ') : '-',
      search: {
        transform: (val) => {
          return {
            startDate: val[0],
            endDate: val[1],
          }
        }
      }
    },
    {
      title: "操作人",
      dataIndex: "userName",
    },
    {
      title: "模块",
      dataIndex: "moduleName",
    },
    {
      title: "操作",
      dataIndex: "action",
      search: false,
    },
    {
      title: "IP",
      dataIndex: "ip",
      search: false,
    },
    {
      title: "User Agent",
      dataIndex: "ua",
      search: false,
    },
  ]

  return (
    <ProTable
      rowKey="logId"
      columns={columns}
      request={queryTable(getSysLog)}
    />
  )
}
