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: 'name',
    width: 150,
  },
  {
    title: '数据库类型',
    key: 'dbType',
    width: 100,
    render(record) {
      let typeText = '';
      switch (record.dbType) {
        case 1:
          typeText = 'MySQL';
          break;
        case 2:
          typeText = 'PostgreSQL';
          break;
        case 3:
          typeText = 'SQLServer';
          break;
        case 4:
          typeText = 'Oracle';
          break;
        case 5:
          typeText = 'Sqlite';
          break;
        default:
          break;
      }
      return h('span', typeText || '-');
    },
  },
  {
    title: '数据源编码',
    key: 'code',
    width: 100,
  },
  {
    title: '数据库驱动类',
    key: 'dbDriver',
    width: 100,
  },
  {
    title: '数据源地址',
    key: 'dbUrl',
    width: 100,
  },
  {
    title: '数据库名称',
    key: 'dbName',
    width: 100,
  },
  {
    title: '数据库用户名',
    key: 'dbUsername',
    width: 100,
  },
  {
    title: '备注',
    key: 'note',
    width: 100,
  },
  {
    title: '创建人',
    key: 'createUser',
    width: 100,
  },
  {
    title: '创建时间',
    key: 'createTime',
    width: 180,
  },
];
