index.vue 2.3 KB

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