import EasyText from '@/components/easyText/index.vue'
import { h } from 'vue'

import type { Record } from '@/api'
import type { ColumnsType } from 'ant-design-vue/es/table'
import { ui18n } from '@/lang'

export const recordColumns: ColumnsType<Record> = [
  // {
  //   title: '序列',
  //   dataIndex: 'logId',
  //   key: 'logId',
  //   customRender: ({ index }) => index + 1
  // },
  {
    title: ui18n.t('project.projectNameLabel'),
    dataIndex: 'projectName',
    key: 'projectName'
  },
  {
    title: ui18n.t('log.logMsgLabel'),
    dataIndex: 'logMsg',
    key: 'logMsg',
    customRender({ record }) {
      return h(EasyText, { content: record.logMsg, maxLen: 50 })
    }
  },
  {
    title: ui18n.t('log.userNameLabel'),
    dataIndex: 'userName',
    key: 'userName'
  },
  {
    title: ui18n.t('log.createTimeLabel'),
    dataIndex: 'createTime',
    key: 'createTime',
    customRender({ record }) {
      return record.createTime.substring(0, 16)
    }
  },
  {
    width: '100px',
    title: ui18n.t('sys.oper'),
    dataIndex: 'action',
    key: 'action'
  }
]
