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

export const columns: BasicColumn[] = [
  {
    title: '表名',
    dataIndex: 'tableName',
  },
  {
    title: '备注',
    dataIndex: 'description',
  },
  {
    title: '状态',
    dataIndex: 'state',
    customRender: ({ record }) => {
      const status = record.state;
      let enable;
      if (status == '1') {
        enable = true;
      } else {
        enable = false;
      }
      const color = enable ? '#67c23a' : '#e6a23c';
      const text = enable ? '同步' : '异步';
      return h(Tag, { color: color }, () => text);
    },
  },
];
export const searchFormSchema: FormSchema[] = [
  {
    field: 'key',
    label: '关键字',
    component: 'Input',
    colProps: { span: 8 },
  },
];

export const importColumns: BasicColumn[] = [
  {
    title: '表名',
    dataIndex: 'name',
  },
  {
    title: '说明',
    dataIndex: 'description',
  },
];
