index.vue 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <BasicTable :ellipsis="true" @register="registerTable" :searchInfo="searchInfo" :columns="logColumns" :expand-column-width="16">
  3. <template #tableTitle>
  4. <a-tabs defaultActiveKey="4" @change="tabChange" size="small">
  5. <a-tab-pane tab="异常日志" key="4"></a-tab-pane>
  6. <a-tab-pane tab="登录日志" key="1"></a-tab-pane>
  7. <a-tab-pane tab="操作日志" key="2"></a-tab-pane>
  8. </a-tabs>
  9. </template>
  10. <template #expandedRowRender="{ record }">
  11. <div v-if="searchInfo.logType == 2">
  12. <div style="margin-bottom: 5px">
  13. <a-badge status="success" style="vertical-align: middle" />
  14. <span style="vertical-align: middle">请求方法:{{ record.method }}</span></div
  15. >
  16. <div>
  17. <a-badge status="processing" style="vertical-align: middle" />
  18. <span style="vertical-align: middle">请求参数:{{ record.requestParam }}</span></div
  19. >
  20. </div>
  21. <div v-if="searchInfo.logType == 4">
  22. <div style="margin-bottom: 5px">
  23. <a-badge status="success" style="vertical-align: middle" />
  24. <span class="error-box" style="vertical-align: middle">异常堆栈:{{ record.requestParam }}</span>
  25. </div>
  26. </div>
  27. </template>
  28. </BasicTable>
  29. </template>
  30. <script lang="ts" name="monitor-log" setup>
  31. import { ref } from 'vue';
  32. import { BasicTable, useTable, TableAction } from '/@/components/Table';
  33. import { getLogList } from './log.api';
  34. import {
  35. columns,
  36. searchFormSchema,
  37. operationLogColumn,
  38. operationSearchFormSchema,
  39. exceptionColumns
  40. } from './log.data';
  41. import { useMessage } from '/@/hooks/web/useMessage';
  42. import { useListPage } from '/@/hooks/system/useListPage';
  43. const { createMessage } = useMessage();
  44. const checkedKeys = ref<Array<string | number>>([]);
  45. const logColumns = ref<any>(columns);
  46. const searchSchema = ref<any>(searchFormSchema);
  47. const searchInfo = { logType: '4' };
  48. // 列表页面公共参数、方法
  49. const { prefixCls, tableContext } = useListPage({
  50. designScope: 'user-list',
  51. tableProps: {
  52. title: '日志列表',
  53. api: getLogList,
  54. expandRowByClick: true,
  55. showActionColumn: false,
  56. rowSelection: {
  57. columnWidth: 20,
  58. },
  59. formConfig: {
  60. schemas: searchSchema,
  61. fieldMapToTime: [['fieldTime', ['createTime_begin', 'createTime_end'], 'YYYY-MM-DD']],
  62. },
  63. },
  64. });
  65. const [registerTable, { reload }] = tableContext;
  66. // 日志类型
  67. function tabChange(key) {
  68. searchInfo.logType = key;
  69. //update-begin---author:wangshuai ---date:20220506 for:[VUEN-943]vue3日志管理列表翻译不对------------
  70. if (key == '2') {
  71. logColumns.value = operationLogColumn;
  72. searchSchema.value = operationSearchFormSchema;
  73. }else if(key == '4'){
  74. searchSchema.value = searchFormSchema;
  75. logColumns.value = exceptionColumns;
  76. } else {
  77. searchSchema.value = searchFormSchema;
  78. logColumns.value = columns;
  79. }
  80. //update-end---author:wangshuai ---date:20220506 for:[VUEN-943]vue3日志管理列表翻译不对--------------
  81. reload();
  82. }
  83. /**
  84. * 选择事件
  85. */
  86. function onSelectChange(selectedRowKeys: (string | number)[]) {
  87. checkedKeys.value = selectedRowKeys;
  88. }
  89. </script>
  90. <style lang="less" scoped>
  91. .error-box {
  92. white-space: break-spaces;
  93. }
  94. </style>