import { h } from 'vue';

export const columns = [
  {
    title: 'ID',
    dataIndex: 'id',
    fixed: 'left',
    width: 100,
  },
  {
    title: '任务名称',
    dataIndex: 'jobName',
    width: 200,
  },
  {
    title: '任务组名',
    dataIndex: 'jobGroup',
    width: 100,
  },
  {
    title: '任务触发器',
    dataIndex: 'jobTrigger',
    width: 200,
  },
  {
    title: '任务日志信息',
    dataIndex: 'jobMessage',
    width: 300,
  },
  {
    title: '执行表达式',
    dataIndex: 'cronExpression',
    width: 150,
  },
  {
    title: '执行状态',
    dataIndex: 'status',
    width: 100,
    customRender({ record }) {
      let typeText = '';
      switch (record.status) {
        case 0:
          typeText = '未发布';
          break;
        case 1:
          typeText = '运行中';
          break;
        case 2:
          typeText = '暂停';
          break;
        case 3:
          typeText = '删除';
          break;
        default:
          break;
      }
      return h('span', typeText || '-');
    },
  },
  {
    title: '任务开始时间',
    dataIndex: 'startTime',
    width: 180,
  },
  {
    title: '任务结束时间',
    dataIndex: 'startTime',
    width: 180,
  },
  {
    title: '任务执行时间',
    dataIndex: 'createTime',
    width: 180,
  },
  {
    title: '任务执行耗时',
    dataIndex: 'consumeTime',
    width: 120,
  },
  {
    title: '操作',
    fixed: 'right',
    dataIndex: 'action',
    key: 'action',
    width: 200,
  },
];
