import { h } from 'vue';
import { NTag } from 'naive-ui';

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