index.ts 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. export interface BasicPageParams {
  2. pageIndex: number;
  3. pageSize: number;
  4. }
  5. export interface BasicFetchResult<T> {
  6. items: T[];
  7. total: number;
  8. }
  9. export interface StatusParams {
  10. id: number;
  11. status: number;
  12. }
  13. export interface TransferOptionResult {
  14. key: string;
  15. title: string;
  16. }
  17. export interface BasicOptionResult {
  18. label: string;
  19. value: boolean | number | string;
  20. disabled?: boolean;
  21. }
  22. export interface BasicTreeOptionResult extends BasicOptionResult {
  23. children: BasicTreeOptionResult[];
  24. parentId: number | string;
  25. }
  26. export interface RelationRequest {
  27. id: number;
  28. relationIds: number[] | string[];
  29. }
  30. export interface Condition {
  31. fieldName: string;
  32. fieldValue: any;
  33. conditionalType?: string;
  34. }
  35. export interface QueryParams {
  36. code: string;
  37. conditions?: Condition[];
  38. }
  39. export const statusOptions: BasicOptionResult[] = [
  40. { label: '启用', value: 1 },
  41. { label: '停用', value: 2 },
  42. ];
  43. export const formatterStatus = ({
  44. cellValue,
  45. }: {
  46. cellValue: number | string;
  47. }) => {
  48. const item = statusOptions.find((item) => item.value === cellValue);
  49. if (item) return item.label;
  50. return '';
  51. };
  52. export const boolOptions: BasicOptionResult[] = [
  53. { label: '是', value: true },
  54. { label: '否', value: false },
  55. ];
  56. export const dbTypeOptions: BasicOptionResult[] = [
  57. { label: 'MySql', value: 0 },
  58. { label: 'SqlServer', value: 1 },
  59. { label: 'Sqlite', value: 2 },
  60. { label: 'Oracle', value: 3 },
  61. { label: 'PostgreSQL', value: 4 },
  62. { label: 'Dm', value: 5 },
  63. { label: 'Kdbndp', value: 6 },
  64. { label: 'Oscar', value: 7 },
  65. { label: 'MySqlConnector', value: 8 },
  66. { label: 'Access', value: 9 },
  67. { label: 'OpenGauss', value: 10 },
  68. { label: 'QuestDB', value: 11 },
  69. { label: 'HG', value: 12 },
  70. { label: 'ClickHouse', value: 13 },
  71. { label: 'GBase', value: 14 },
  72. { label: 'Custom', value: 15 },
  73. ];
  74. export const connectTypeOptions: BasicOptionResult[] = [
  75. { label: '内联接', value: 0 },
  76. { label: '左联接', value: 1 },
  77. { label: '右联接', value: 2 },
  78. { label: '全联接', value: 3 },
  79. ];
  80. export const conditionalTypeOptions: BasicOptionResult[] = [
  81. { label: '等于', value: 0 },
  82. { label: '包含', value: 1 },
  83. { label: '大于', value: 2 },
  84. { label: '大于等于', value: 3 },
  85. { label: '小于', value: 4 },
  86. { label: '小于等于', value: 5 },
  87. { label: '介于', value: 6 },
  88. { label: '不介于', value: 7 },
  89. { label: '开始于', value: 8 },
  90. { label: '结束于', value: 9 },
  91. { label: '不等于', value: 10 },
  92. { label: '不为空', value: 11 },
  93. // { label: '不包含', value: 7 },
  94. // { label: '为空', value: 8 },
  95. // { label: '正则匹配', value: 14 },
  96. // { label: '不正则匹配', value: 15 },
  97. ];
  98. export const dataTypeOptions: BasicOptionResult[] = [
  99. { label: 'text', value: 'text' },
  100. { label: 'varchar', value: 'varchar' },
  101. { label: 'nvarchar', value: 'nvarchar' },
  102. { label: 'char', value: 'char' },
  103. { label: 'nchar', value: 'nchar' },
  104. { label: 'timestamp', value: 'timestamp' },
  105. { label: 'int', value: 'int' },
  106. { label: 'smallint', value: 'smallint' },
  107. { label: 'tinyint', value: 'tinyint' },
  108. { label: 'bigint', value: 'bigint' },
  109. { label: 'bit', value: 'bit' },
  110. { label: 'decimal', value: 'decimal' },
  111. { label: 'datetime', value: 'datetime' },
  112. { label: 'date', value: 'date' },
  113. { label: 'blob', value: 'blob' },
  114. { label: 'clob', value: 'clob' },
  115. { label: 'boolean', value: 'boolean' },
  116. ];