operatelog.data.ts 2.2 KB

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