import { h } from 'vue';
import { ElTag } from 'element-plus';

export const columns = [
  {
    type: 'selection',
  },
  {
    label: 'ID',
    prop: 'id'
  },
  {
    label: '操作用户',
    prop: 'username',
  },
  {
    label: '请求ip',
    prop: 'ip',
  },
  {
    label: '浏览器',
    prop: 'browser',
  },
  {
    label: '操作系统',
    prop: 'os',
  },
  {
    label: '操作类型',
    prop: 'typeText',
  },
  {
    label: '操作来源',
    prop: 'sourceText',
  },
  {
    label: '请求方式',
    prop: 'requestMethod',
  },
  {
    label: '请求URL',
    prop: 'url',
  },
  {
    label: '请求地区',
    prop: 'location',
  },
  {
    label: '请求耗时',
    prop: 'consumeTime',
  },
  {
    label: '状态',
    prop: 'status',
    render(record) {
      return h(
        ElTag,
        {
          type: record.row.status ==0 ? 'success' : 'danger',
        },
        {
          default: () => (record.row.status ==0 ? '正常' : '异常'),
        },
      );
    },
  },
  {
    label: '创建时间',
    prop: 'createTime',
  },
];
