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

export const columns: BasicColumn[] = [
  {
    title: '名称',
    dataIndex: 'dbName',
  },
  {
    title: '编码',
    dataIndex: 'dbAlias',
  },
  {
    title: '类型',
    dataIndex: 'dbType',
  },
  {
    title: '数据库地址',
    dataIndex: 'serverAddress',
  },
];
export const searchFormSchema: FormSchema[] = [
  {
    field: 'keyWord',
    label: '名称',
    component: 'Input',
    colProps: { span: 8 },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'dbAlias',
    label: '编码',
    component: 'Input',
    required: true,
  },
  {
    field: 'dbName',
    label: '名称',
    component: 'Input',
    required: true,
  },
  {
    field: 'dbType',
    label: '类型',
    component: 'Select',
    componentProps: {
      options: [
        {
          label: 'MySql',
          value: 'MySql',
        },
        {
          label: 'SqlServer',
          value: 'SqlServer',
        },
        {
          label: 'Oracle',
          value: 'Oracle',
        },
        {
          label: 'PostgreSQL',
          value: 'PostgreSQL',
        },
        {
          label: '达梦',
          value: 'Dameng',
        },
        {
          label: '人大金仓',
          value: 'Kdbndp',
        },
      ],
    },
  },
  {
    field: 'serverAddress',
    label: '服务器地址',
    component: 'Input',
    required: true,
  },
  {
    field: 'dbConnection',
    label: '连接串',
    colProps: {
      span: 24,
    },
    rules: [
      {
        required: true,
        message: '请输入连接串',
      },
    ],
    slot: 'dbConnection',
  },
  {
    field: 'description',
    label: '说明',
    component: 'InputTextArea',
  },
];
