import { h } from 'vue';

export const columns = [
  {
    type: 'selection',
    width: 50,
    fixed: 'left',
  },
  {
    title: 'ID',
    key: 'id',
    fixed: 'left',
    width: 100,
  },
  {
    title: '任务名称',
    key: 'jobName',
    width: 200,
  },
  {
    title: '任务组名',
    key: 'jobGroup',
    width: 100,
  },
  {
    title: '任务触发器',
    key: 'jobTrigger',
    width: 200,
  },
  {
    title: '任务日志信息',
    key: 'jobMessage',
    width: 300,
  },
  {
    title: '执行表达式',
    key: 'cronExpression',
    width: 150,
  },
  {
    title: '执行状态',
    key: 'status',
    width: 100,
    render(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: '任务开始时间',
    key: 'startTime',
    width: 180,
  },
  {
    title: '任务结束时间',
    key: 'endTime',
    width: 180,
  },
  {
    title: '任务执行时间',
    key: 'createTime',
    width: 180,
  },
  {
    title: '任务执行耗时',
    key: 'consumeTime',
    width: 120,
  },
];
