operatelog.data.ts 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. import { useI18n } from '@/hooks/web/useI18n'
  2. import { DICT_TYPE } from '@/utils/dict'
  3. import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
  4. const { t } = useI18n() // 国际化
  5. const crudSchemas = reactive<VxeCrudSchema>({
  6. primaryKey: 'id',
  7. primaryType: 'seq',
  8. primaryTitle: '日志编号',
  9. action: true,
  10. actionWidth: '80px',
  11. columns: [
  12. {
  13. title: '操作模块',
  14. field: 'module',
  15. isSearch: true
  16. },
  17. {
  18. title: '操作名',
  19. field: 'name'
  20. },
  21. {
  22. title: '操作类型',
  23. field: 'type',
  24. dictType: DICT_TYPE.SYSTEM_OPERATE_TYPE,
  25. dictClass: 'number',
  26. isSearch: true
  27. },
  28. {
  29. title: '请求方法名',
  30. field: 'requestMethod',
  31. isTable: false
  32. },
  33. {
  34. title: '请求地址',
  35. field: 'requestUrl',
  36. isTable: false
  37. },
  38. {
  39. title: '操作人员',
  40. field: 'userNickname',
  41. isSearch: true
  42. },
  43. {
  44. title: '操作明细',
  45. field: 'content',
  46. isTable: false
  47. },
  48. {
  49. title: '用户 IP',
  50. field: 'userIp',
  51. isTable: false
  52. },
  53. {
  54. title: 'userAgent',
  55. field: 'userAgent'
  56. },
  57. {
  58. title: '操作结果',
  59. field: 'resultCode',
  60. table: {
  61. slots: {
  62. default: 'resultCode'
  63. }
  64. }
  65. },
  66. {
  67. title: '操作结果',
  68. field: 'success',
  69. isTable: false,
  70. isDetail: false,
  71. search: {
  72. show: true,
  73. itemRender: {
  74. name: '$select',
  75. props: { placeholder: t('common.selectText') },
  76. options: [
  77. { label: '成功', value: 'true' },
  78. { label: '失败', value: 'false' }
  79. ]
  80. }
  81. }
  82. },
  83. {
  84. title: '操作日期',
  85. field: 'startTime',
  86. formatter: 'formatDate',
  87. isForm: false,
  88. search: {
  89. show: true,
  90. itemRender: {
  91. name: 'XDataTimePicker'
  92. }
  93. }
  94. },
  95. {
  96. title: '执行时长',
  97. field: 'duration',
  98. table: {
  99. slots: {
  100. default: 'duration'
  101. }
  102. }
  103. }
  104. ]
  105. })
  106. export const { allSchemas } = useVxeCrudSchemas(crudSchemas)