index.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <div class="table-box">
  3. <ProTable ref="proTable" :columns="columns" row-key="infoId" :request-api="listLogininforApi" :init-param="initParam"> </ProTable>
  4. <ImportExcel ref="dialogRef" />
  5. </div>
  6. </template>
  7. <script setup lang="tsx" name="Logininfor">
  8. import { ref, reactive } from 'vue'
  9. import ProTable from '@/components/ProTable/index.vue'
  10. import ImportExcel from '@/components/ImportExcel/index.vue'
  11. import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
  12. import { listLogininforApi } from '@/api/modules/monitor/logininfor'
  13. import { getDictsApi } from '@/api/modules/system/dictData'
  14. // ProTable 实例
  15. const proTable = ref<ProTableInstance>()
  16. // 如果表格需要初始化请求参数,直接定义传给 ProTable (之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据)
  17. const initParam = reactive({ type: 1 })
  18. // 批量添加系统访问记录
  19. const dialogRef = ref<InstanceType<typeof ImportExcel> | null>(null)
  20. // 表格配置项
  21. const columns = reactive<ColumnProps<any>[]>([
  22. { prop: 'infoId', label: '访问ID' },
  23. {
  24. prop: 'userName',
  25. label: '用户账号',
  26. search: {
  27. el: 'input'
  28. }
  29. },
  30. {
  31. prop: 'ipaddr',
  32. label: '登录IP地址',
  33. search: {
  34. el: 'input'
  35. }
  36. },
  37. {
  38. prop: 'loginLocation',
  39. label: '登录地点',
  40. search: {
  41. el: 'input'
  42. }
  43. },
  44. {
  45. prop: 'browser',
  46. label: '浏览器类型',
  47. search: {
  48. el: 'input'
  49. }
  50. },
  51. {
  52. prop: 'os',
  53. label: '操作系统',
  54. search: {
  55. el: 'input'
  56. }
  57. },
  58. {
  59. prop: 'status',
  60. label: '登录状态',
  61. tag: true,
  62. enum: () => getDictsApi('sys_common_status'),
  63. fieldNames: {
  64. label: 'dictLabel',
  65. value: 'dictValue'
  66. },
  67. search: {
  68. el: 'input'
  69. }
  70. },
  71. {
  72. prop: 'msg',
  73. label: '提示消息',
  74. search: {
  75. el: 'input'
  76. }
  77. },
  78. {
  79. prop: 'loginTime',
  80. label: '访问时间',
  81. search: {
  82. el: 'date-picker',
  83. props: { type: 'datetimerange', valueFormat: 'YYYY-MM-DD HH:mm:ss' }
  84. }
  85. }
  86. ])
  87. </script>