import { h } from 'vue'
import TableImage from '@/components/DataTable/tools/Image.vue'
import TableTags from '@/components/DataTable/tools/Tags.vue'

const table = {
  columns: [
    {
      type: 'selection'
    },
    {
      title: '用户编号',
      key: 'code',
      align: 'center'
    },
    {
      title: '头像',
      key: 'avatar',
      align: 'center',
      render(row) {
        return h(TableImage, {
          images: {
            width: 36,
            height: 36,
            src: row.avatar
          }
        })
      }
    },
    {
      title: '用户账号',
      key: 'username',
      align: 'center'
    },
    {
      title: '用户姓名',
      key: 'realname',
      align: 'center'
    },
    {
      title: '角色',
      key: 'roleList',
      align: 'center',
      render(row) {
        return h(TableTags, {
          data: row.roleList,
          rowKey: 'name'
        })
      }
    },
    {
      title: '部门',
      key: 'deptName',
      align: 'center'
    },
    {
      title: '创建时间',
      key: 'createTime',
      align: 'center',
      width: 160
    },
    {
      title: '更新时间',
      key: 'updateTime',
      align: 'center',
      width: 160
    }
  ]
}
export default table
