import { h } from 'vue';
import { Tag } from 'ant-design-vue';

export const columns = [
  {
    title: 'ID',
    dataIndex: 'id',
    fixed: 'left',
    width: 50,
  },
  {
    title: '任务名称',
    dataIndex: 'jobName',
    width: 150,
  },
  {
    title: '任务分组',
    dataIndex: 'jobGroup',
    width: 100,
  },
  {
    title: '任务触发器',
    dataIndex: 'jobTrigger',
    width: 150,
  },
  {
    title: '执行表达式',
    dataIndex: 'cronExpression',
    width: 150,
  },
  {
    title: '执行策略',
    dataIndex: 'executePolicyText',
    width: 100,
  },
  {
    title: '同步任务',
    dataIndex: 'isSync',
    width: 100,
    customRender({ record }) {
      return h(
        Tag,
        {
          color: record.isSync == 1 ? 'processing' : 'warning',
        },
        {
          default: () => (record.isSync == 1 ? '同步' : '异步'),
        },
      );
    },
  },
  {
    title: 'URL',
    dataIndex: 'url',
    width: 150,
  },
  {
    title: '状态',
    key: 'status',
    dataIndex: 'status',
    width: 100,
  },
  {
    title: '备注',
    dataIndex: 'note',
    width: 200,
  },
  {
    title: '操作',
    fixed: 'right',
    dataIndex: 'action',
    key: 'action',
    width: 365,
  },
];
