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

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