operatelog.data.ts 2.0 KB

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