import { h } from 'vue';
import { NTag } from 'naive-ui';

export const columns = [
  {
    title: '用户ID',
    key: 'id',
    width: 100,
  },
  {
    title: '登录用户名',
    key: 'user_name',
    width: 150,
  },
  {
    title: '姓名',
    key: 'nickname',
    width: 150,
  },
  {
    title: '绑定角色',
    key: 'roleName',
    render(row) {
      return h(
        NTag,
        {
          type: 'info',
        },
        {
          default: () => row.roleName,
        }
      );
    },
    width: 150,
  },
  {
    title: '用户状态',
    key: 'status',
    render(row) {
      return h(
        NTag,
        {
          type: row.status === 1 ? 'success' : 'error',
        },
        {
          default: () => (row.status === 1 ? '正常' : '已禁用'),
        }
      );
    },
    width: 150,
  },
  {
    title: '创建时间',
    key: 'created_at',
    width: 180,
  },
];
