| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- /**
- * 配置元信息相关常量定义
- */
-
- // 字段类型枚举
- export const FIELD_TYPES = ['string', 'int', 'bool', 'config', 'array'] as const;
- export type FieldType = typeof FIELD_TYPES[number];
-
- // 配置名称常量
- export const CONFIG_NAMES = ['app', 'database', 'redis', 'logger', 'cache'] as const;
-
- // Tabulator字段映射:前端字段名 -> 后端字段名
- export const FIELD_MAPPING: Record<string, string> = {
- 'id': 'id',
- 'configName': 'configName',
- 'fieldName': 'fieldName',
- 'fieldType': 'fieldType',
- 'yamlName': 'yamlName',
- 'fieldDesc': 'fieldDesc',
- 'description': 'fieldDesc', // 兼容别名
- 'creator': 'creator',
- 'createdAt': 'createdAt'
- } as const;
-
- // Tabulator操作符映射:Tabulator操作符 -> 后端操作符
- export const OPERATOR_MAPPING: Record<string, string> = {
- '=': '=',
- '!=': '!=',
- 'like': 'like',
- '>': '>',
- '<': '<',
- '>=': '>=',
- '<=': '<=',
- 'in': 'in'
- } as const;
-
- // 调试信息默认值
- export const DEBUG_INFO_DEFAULTS = {
- dataSource: '',
- recordCount: 0,
- lastUpdated: '',
- useMockData: false,
- registerUrl: '',
- listUrl: '',
- currentPage: 1,
- totalPages: 1,
- pageSize: 100 // 与组件中的paginationPageSize保持一致
- } as const;
-
- // Tabulator列配置工厂函数
- export function createTabulatorColumns() {
- return [
- {
- title: 'ID',
- field: 'id',
- width: 120,
- sorter: 'string',
- headerFilter: true,
- headerFilterPlaceholder: '筛选ID...'
- },
- {
- title: '配置名称',
- field: 'configName',
- width: 150,
- sorter: 'string',
- headerFilter: true,
- headerFilterFunc: 'like',
- headerFilterPlaceholder: '筛选配置名称...'
- },
- {
- title: '字段名',
- field: 'fieldName',
- width: 150,
- sorter: 'string',
- headerFilter: true,
- headerFilterPlaceholder: '筛选字段名...'
- },
- {
- title: '字段类型',
- field: 'fieldType',
- width: 120,
- sorter: 'string',
- headerFilter: 'select',
- headerFilterParams: {
- values: [...FIELD_TYPES],
- clearable: true
- },
- headerFilterPlaceholder: '选择类型...'
- },
- {
- title: 'YAML名称',
- field: 'yamlName',
- width: 150,
- sorter: 'string',
- headerFilter: true,
- headerFilterFunc: 'like',
- headerFilterPlaceholder: '筛选YAML名称...'
- },
- {
- title: '字段描述',
- field: 'fieldDesc',
- width: 200,
- sorter: 'string',
- headerFilter: true,
- headerFilterPlaceholder: '筛选描述...'
- },
- {
- title: '创建者',
- field: 'creator',
- width: 120,
- sorter: 'string',
- headerFilter: true,
- headerFilterPlaceholder: '筛选创建者...'
- },
- {
- title: '创建时间',
- field: 'createdAt',
- width: 180,
- sorter: 'date',
- headerFilter: true,
- headerFilterPlaceholder: 'YYYY-MM-DD...'
- }
- ];
- }
|