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

export const memberColumns: ColumnsType<Member> = [
  // {
  //   title: '序列',
  //   dataIndex: 'teamId',
  //   key: 'teamId',
  //   customRender: ({ index }) => index + 1
  // },
  {
    title: ui18n.t('material.nickNameLabel'),
    dataIndex: 'nickName',
    key: 'nickName'
  },
  {
    title: ui18n.t('material.userNameLabel'),
    dataIndex: 'userName',
    key: 'userName'
  },
  {
    title: ui18n.t('material.roleLabel'),
    dataIndex: 'roles',
    key: 'roles',
    customRender(data) {
      return h(
        'span',
        null,
        data.record.roles.map(role => role.roleName).join('、')
      )
    }
  },
  {
    title: ui18n.t('material.bindAccountLabel'),
    dataIndex: 'bindAccount',
    key: 'bindAccount'
  },
  {
    title: ui18n.t('material.remarkLabel'),
    key: 'remark',
    dataIndex: 'remark'
  },
  {
    title: ui18n.t('material.createTimeLabel'),
    dataIndex: 'createTime',
    key: 'createTime'
  }
]
