<%_ if (enableTranslation) { _%>
import { useI18n } from '@/hooks/web/useI18nOut';
<%_ } _%>

// 文件上传列表
export function createTableColumns(): any[] {
  <%_ if (enableTranslation) { _%>
  const { t } = useI18n();
  <%_ } _%>
  return [
    {
      field: 'thumbUrl',
      title: <% if (enableTranslation) { %>t('component.upload.legend')<% } else { %>'t$t('component.upload.legend')$t$'<% } %>,
      width: 100,
      slots: { default: 'thumbUrl' },
    },
    {
      field: 'name',
      title: <% if (enableTranslation) { %>t('component.upload.fileName')<% } else { %>'t$t('component.upload.fileName')$t$'<% } %>,
      align: 'left',
      slots: { default: 'name' },
    },
    {
      field: 'size',
      title: <% if (enableTranslation) { %>t('component.upload.fileSize')<% } else { %>'t$t('component.upload.fileSize')$t$'<% } %>,
      width: 100,
      formatter: ({ cellValue = 0 }) => {
        return cellValue && `${(cellValue / 1024).toFixed(2)}KB`;
      },
    },
    // {
    //   dataIndex: 'type',
    //   title: '文件类型',
    //   width: 100,
    // },
    {
      field: 'status',
      title: <% if (enableTranslation) { %>t('component.upload.fileStatue')<% } else { %>'t$t('component.upload.fileStatue')$t$'<% } %>,
      width: 100,
      slots: { default: 'status' },
    },
    {
      title: '操作',
      field: 'recordOperation',
      fixed: 'right',
      headerAlign: 'center',
      align: 'right',
      showOverflow: false,
      width: 140,
      slots: { default: 'recordAction' },
    },
  ];
}
// 文件预览列表
export function createPreviewColumns(): any[] {
  <%_ if (enableTranslation) { _%>
  const { t } = useI18n();
  <%_ } _%>
  return [
    {
      field: 'url',
      title: <% if (enableTranslation) { %>t('component.upload.legend')<% } else { %>'t$t('component.upload.legend')$t$'<% } %>,
      width: 100,
      slots: { default: 'url' },
    },
    {
      field: 'name',
      title: <% if (enableTranslation) { %>t('component.upload.fileName')<% } else { %>'t$t('component.upload.fileName')$t$'<% } %>,
      align: 'left',
    },
    {
      title: '操作',
      field: 'recordOperation',
      fixed: 'right',
      headerAlign: 'center',
      align: 'right',
      showOverflow: false,
      width: 140,
      slots: { default: 'recordAction' },
    },
  ];
}
