apiAccessLog.data.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import { reactive } from 'vue'
  2. import { useI18n } from '@/hooks/web/useI18n'
  3. import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
  4. import { DICT_TYPE } from '@/utils/dict'
  5. const { t } = useI18n() // 国际化
  6. // CrudSchema
  7. const crudSchemas = reactive<CrudSchema[]>([
  8. {
  9. label: t('common.index'),
  10. field: 'id',
  11. type: 'index'
  12. },
  13. {
  14. label: '链路追踪',
  15. field: 'traceId'
  16. },
  17. {
  18. label: '用户编号',
  19. field: 'userId',
  20. search: {
  21. show: true
  22. }
  23. },
  24. {
  25. label: '用户类型',
  26. field: 'userType',
  27. dictType: DICT_TYPE.USER_TYPE,
  28. search: {
  29. show: true
  30. }
  31. },
  32. {
  33. label: '应用名',
  34. field: 'applicationName',
  35. search: {
  36. show: true
  37. }
  38. },
  39. {
  40. label: '请求方法名',
  41. field: 'requestMethod'
  42. },
  43. {
  44. label: '请求地址',
  45. field: 'requestUrl',
  46. search: {
  47. show: true
  48. }
  49. },
  50. {
  51. label: '请求时间',
  52. field: 'beginTime',
  53. search: {
  54. show: true,
  55. component: 'DatePicker',
  56. componentProps: {
  57. type: 'datetimerange',
  58. valueFormat: 'YYYY-MM-DD HH:mm:ss',
  59. defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]
  60. }
  61. }
  62. },
  63. {
  64. label: '执行时长',
  65. field: 'duration'
  66. },
  67. {
  68. label: '操作结果',
  69. field: 'resultCode',
  70. search: {
  71. show: true
  72. }
  73. },
  74. {
  75. label: t('table.action'),
  76. field: 'action',
  77. width: '300px',
  78. form: {
  79. show: false
  80. },
  81. detail: {
  82. show: false
  83. }
  84. }
  85. ])
  86. export const { allSchemas } = useCrudSchemas(crudSchemas)