e0b7cfc7ec088689cb987da35abb5c4a2c7c154f.svn-base 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import i18n from '@/i18n'
  2. export const sqlFunc = {
  3. sum: i18n.t('config.sum'),
  4. avg: i18n.t('config.avg'),
  5. max: i18n.t('config.max'),
  6. min: i18n.t('config.min'),
  7. count: i18n.t('config.count'),
  8. none: i18n.t('config.none')
  9. }
  10. export const filterOperator = [
  11. { operator: '=', name: 'config.is', paramNum: 1 },
  12. { operator: '>', name: 'config.greater', paramNum: 1 },
  13. { operator: '<', name: 'config.less', paramNum: 1 },
  14. { operator: '>=', name: 'config.greaterOrEqual', paramNum: 1 },
  15. { operator: '<=', name: 'config.lessorEqual', paramNum: 1 },
  16. { operator: '!=', name: 'config.isNot', paramNum: 1 },
  17. { operator: 'BETWEEN', name: 'config.between', paramNum: 2 },
  18. { operator: 'IN', name: 'config.in', paramNum: -1 },
  19. { operator: 'LIKE', name: 'config.like', paramNum: 1 }
  20. ]
  21. export function getFilterOperator() {
  22. return filterOperator.map(item => {
  23. const i18nItem = { ...item }
  24. i18nItem.name = i18n.t(item.name)
  25. return i18nItem
  26. })
  27. }
  28. export const dataType = [
  29. { name: 'tinyint', needQuotation: false, availableFunc: ['sum', 'avg', 'max', 'min', 'count', 'none'] },
  30. { name: 'smallint', needQuotation: false, availableFunc: ['sum', 'avg', 'max', 'min', 'count', 'none'] },
  31. { name: 'mediumint', needQuotation: false, availableFunc: ['sum', 'avg', 'max', 'min', 'count', 'none'] },
  32. { name: 'int', needQuotation: false, availableFunc: ['sum', 'avg', 'max', 'min', 'count', 'none'] },
  33. { name: 'bigint', needQuotation: false, availableFunc: ['sum', 'avg', 'max', 'min', 'count', 'none'] },
  34. { name: 'float', needQuotation: false, availableFunc: ['sum', 'avg', 'max', 'min', 'count', 'none'] },
  35. { name: 'double', needQuotation: false, availableFunc: ['sum', 'avg', 'max', 'min', 'count', 'none'] },
  36. { name: 'real', needQuotation: false, availableFunc: ['sum', 'avg', 'max', 'min', 'count', 'none'] },
  37. { name: 'decimal', needQuotation: false, availableFunc: ['sum', 'avg', 'max', 'min', 'count', 'none'] },
  38. { name: 'timestamp', needQuotation: false, availableFunc: ['count', 'none'] },
  39. { name: 'date', needQuotation: true, availableFunc: ['count', 'none'] },
  40. { name: 'time', needQuotation: true, availableFunc: ['count', 'none'] },
  41. { name: 'datetime', needQuotation: true, availableFunc: ['count', 'none'] },
  42. { name: 'year', needQuotation: true, availableFunc: ['count', 'none'] },
  43. { name: 'char', needQuotation: true, availableFunc: ['count', 'none'] },
  44. { name: 'varchar', needQuotation: true, availableFunc: ['count', 'none'] },
  45. { name: 'tinytext', needQuotation: true, availableFunc: ['count', 'none'] },
  46. { name: 'text', needQuotation: true, availableFunc: ['count', 'none'] },
  47. { name: 'mediumtext', needQuotation: true, availableFunc: ['count', 'none'] },
  48. { name: 'longtext', needQuotation: true, availableFunc: ['count', 'none'] },
  49. { name: 'integer', needQuotation: false, availableFunc: ['sum', 'avg', 'max', 'min', 'count', 'none'] }
  50. ]