import { h } from 'vue';
import { ElTag } from 'element-plus';

export const columns = [
  {
    type: 'selection',
  },
  {
    label: 'ID',
    prop: 'id',
    fixed: 'left',
    width: 50,
  },
  {
    label: '数据源名称',
    prop: 'name',
    minWidth: 150,
  },
  {
    label: '数据库类型',
    prop: 'dbType',
    minWidth: 100,
    render(record) {
      let typeText = '';
      switch (record.row.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 || '-');
    },
  },
  {
    label: '数据源编码',
    prop: 'code',
    minWidth: 100,
  },
  {
    label: '数据库驱动类',
    prop: 'dbDriver',
    minWidth: 150,
  },
  {
    label: '数据源地址',
    prop: 'dbUrl',
    minWidth: 100,
  },
  {
    label: '数据库名称',
    prop: 'dbName',
    minWidth: 100,
  },
  {
    label: '数据库用户名',
    prop: 'dbUsername',
    minWidth: 120,
  },
  {
    label: '备注',
    prop: 'note',
    minWidth: 200,
  },
  {
    label: '创建人',
    prop: 'createUser',
    minWidth: 100,
  },
  {
    label: '创建时间',
    prop: 'createTime',
    width: 180,
  },
];
