apiAccessLog.data.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. dictData: 'number',
  29. search: {
  30. show: true
  31. }
  32. },
  33. {
  34. label: '应用名',
  35. field: 'applicationName',
  36. search: {
  37. show: true
  38. }
  39. },
  40. {
  41. label: '请求方法名',
  42. field: 'requestMethod'
  43. },
  44. {
  45. label: '请求地址',
  46. field: 'requestUrl',
  47. search: {
  48. show: true
  49. }
  50. },
  51. {
  52. label: '请求时间',
  53. field: 'beginTime',
  54. search: {
  55. show: true,
  56. component: 'DatePicker',
  57. componentProps: {
  58. type: 'datetimerange',
  59. valueFormat: 'YYYY-MM-DD HH:mm:ss',
  60. defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]
  61. }
  62. }
  63. },
  64. {
  65. label: '执行时长',
  66. field: 'duration'
  67. },
  68. {
  69. label: '操作结果',
  70. field: 'resultCode',
  71. search: {
  72. show: true
  73. }
  74. },
  75. {
  76. label: t('table.action'),
  77. field: 'action',
  78. width: '300px',
  79. form: {
  80. show: false
  81. },
  82. detail: {
  83. show: false
  84. }
  85. }
  86. ])
  87. export const { allSchemas } = useCrudSchemas(crudSchemas)