import { BasicColumn } from '/@/components/Table/src/types/table';
import { Time } from '/@/components/Time';
import { h } from 'vue';
import { Badge } from 'ant-design-vue';

export const sceneColumns: BasicColumn[] = [
  {
    title: '场景标题',
    dataIndex: 'sceneName',
    ellipsis: true,
    slots: { customRender: 'href' },
    resizable: true,
    minWidth: 150,
    width: 150,
  },
  {
    title: '场景码',
    dataIndex: 'num',
    ellipsis: true,
    width: 180,
  },
  {
    title: '计算完成时间',
    dataIndex: 'algorithmTime',
    width: 180,
  },
  {
    title: '场景大小',
    dataIndex: 'sceneSize',
    width: 80,
    customRender: ({ record }) => {
      return record.sceneSize && record.sceneSize != 0
        ? h('span', { class: 'sceneSize' }, Math.ceil(record.sceneSize / 1024 / 1024) + 'M')
        : '-';
    },
  },
  {
    title: '状态',
    dataIndex: 'status',
    width: 80,
    customRender: ({ record }) => {
      let str;
      switch (record.status - 0) {
        case 0:
          str = '计算中';
          break;
        case 1:
          str = '计算成功';
          break;
        case -2:
          str = '计算成功';
          break;
        case -1:
          str = '计算失败';
          break;
      }
      return record.payStatus == -2 ? '封存' : str;
    },
  },
];

export const diversityColumns: BasicColumn[] = [
  {
    title: '标题',
    dataIndex: 'sceneName',
    ellipsis: true,
    slots: { customRender: 'href' },
    resizable: true,
    minWidth: 150,
    width: 300,
  },
  // {
  //   title: '所属案件',
  //   dataIndex: 'caseTitle',
  //   slots: { customRender: 'caseTitle' },
  //   ellipsis: true,
  //   width: 140,
  // },
  {
    title: '人员编号',
    dataIndex: 'ryNo',
    ellipsis: true,
    width: 140,
  },
  // {
  //   title: '姓名',
  //   dataIndex: 'ryNickName',
  //   ellipsis: true,
  //   width: 140,
  // },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    width: 180,
    customRender: ({ record }) => {
      return record.createTime
        ? h(Time, {
            value: record.createTime,
            mode: 'datetime',
          })
        : '-';
    },
  },
];
