import { BasicColumn } from '@/components/Table';
import { h } from 'vue';
import { Tag } from 'ant-design-vue';

export function getHistoryColumns(): BasicColumn[] {
  return [
    {
      title: 'id',
      dataIndex: 'id',
      ifShow: false,
    },
    {
      title: 'schemeInfoId',
      dataIndex: 'schemeInfoId',
      ifShow: false,
    },
    {
      title: 'scheme',
      dataIndex: 'scheme',
      ifShow: false,
    },
    {
      title: 'createUserId',
      dataIndex: 'createUserId',
      ifShow: false,
    },
    {
      title: '创建人',
      width: 150,
      dataIndex: 'createUserName',
    },
    {
      title: '创建时间',
      width: 150,
      dataIndex: 'createDate',
    },
    {
      title: 'tenantId',
      dataIndex: 'tenantId',
      ifShow: false,
    },
    {
      title: '状态',
      dataIndex: 'type',
      width: 80,
      customRender: ({ record }) => {
        if (!record.type || record.type === 2) {
          const color = 'gray';
          const text = '草稿';
          return h(Tag, { color: color }, () => text);
        } else {
          const color = 'green';
          const text = '正式';
          return h(Tag, { color: color }, () => text);
        }
      },
    },
    {
      title: '当前版本',
      dataIndex: 'currentVersion',
      width: 80,
    },
    {
      title: '操作',
      dataIndex: 'action',
      width: 80,
    },
  ];
}
