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

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