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

export const columns = [
  {
    type: 'selection',
  },
  {
    label: 'ID',
    prop: 'id',
    fixed: 'left',
    width: 50,
  },
  {
    label: '文件名称',
    prop: 'originalName',
    minWidth: 200,
    render(record) {
      return h(
        'a',
        {
          href: record.row.filePath,
          target: '_blank',
        },
        record.row.originalName,
      );
    },
  },
  {
    label: '日志类型',
    prop: 'type',
    minWidth: 100,
    render(record) {
      let typeText = '';
      switch (record.row.type) {
        case 0:
          typeText = '单个文件';
          break;
        case 1:
          typeText = '多个文件';
          break;
        case 2:
          typeText = '其他';
          break;
        default:
          break;
      }
      return h('span', typeText || '-');
    },
  },
  {
    label: '文件类型',
    prop: 'fileType',
    minWidth: 100,
  },
  {
    label: '文件大小',
    prop: 'fileSize',
    minWidth: 100,
    render(record) {
      return h('span', record.row.fileSize + 'B');
    },
  },
  {
    label: '文件后缀',
    prop: 'fileExtension',
    minWidth: 100,
  },
  {
    label: '创建人',
    prop: 'createUser',
    minWidth: 100,
  },
  {
    label: '创建时间',
    prop: 'createTime',
    width: 180,
  },
];
