import { BasicColumn } from '@/components/Table';
import { ElTag } from 'element-plus';
import { h } from 'vue';

export const columns: BasicColumn[] = [
  {
    label: '访问编号',
    prop: 'id',
  },
  {
    label: '用户名称',
    prop: 'userName',
  },
  {
    label: '登录ip',
    prop: 'loginIp',
  },
  {
    label: '登录地点',
    prop: 'loginAddress',
  },
  {
    label: '浏览器',
    prop: 'browser',
  },
  {
    label: '操作系统',
    prop: 'system',
  },
  {
    label: '登录状态',
    prop: 'loginStatus',
    render(record) {
      return h(
        ElTag,
        {
          type: record.row.loginStatus === 1 ? 'success' : 'danger',
        },
        {
          default: () => `${record.row.loginStatus === 1 ? '登录成功' : '登录失败'}`,
        },
      );
    },
  },
  {
    label: '登录信息',
    prop: 'content',
  },
  {
    label: '登录时间',
    prop: 'createTime',
  },
];
