Commit fd4bc8ccf4fd824bc3d7244dd962de455878002a

Authored by xingyu4j
1 parent dcd1b5fb

refactor: vxe

yudao-ui-admin-vue3/src/api/infra/apiAccessLog/index.ts
1 import request from '@/config/axios' 1 import request from '@/config/axios'
2 2
  3 +export interface ApiAccessLogVO {
  4 + id: number
  5 + traceId: string
  6 + userId: string
  7 + userType: string
  8 + applicationName: string
  9 + requestMethod: string
  10 + requestParams: string
  11 + requestUrl: string
  12 + beginTime: string
  13 + endTIme: string
  14 + duration: string
  15 + resultCode: number
  16 +}
  17 +
3 // 查询列表API 访问日志 18 // 查询列表API 访问日志
4 export const getApiAccessLogPageApi = (params) => { 19 export const getApiAccessLogPageApi = (params) => {
5 return request.get({ url: '/infra/api-access-log/page', params }) 20 return request.get({ url: '/infra/api-access-log/page', params })
yudao-ui-admin-vue3/src/api/infra/apiAccessLog/types.ts deleted
1 -export type ApiAccessLogVO = {  
2 - id: number  
3 - traceId: string  
4 - userId: string  
5 - userType: string  
6 - applicationName: string  
7 - requestMethod: string  
8 - requestParams: string  
9 - requestUrl: string  
10 - beginTime: string  
11 - endTIme: string  
12 - duration: string  
13 - resultCode: number  
14 -}  
yudao-ui-admin-vue3/src/api/infra/apiErrorLog/index.ts
1 import request from '@/config/axios' 1 import request from '@/config/axios'
2 2
  3 +export interface ApiErrorLogVO {
  4 + id: number
  5 + userId: string
  6 + userIp: string
  7 + userAgent: string
  8 + userType: string
  9 + applicationName: string
  10 + requestMethod: string
  11 + requestParams: string
  12 + requestUrl: string
  13 + exceptionTime: string
  14 + exceptionName: string
  15 + exceptionStackTrace: string
  16 + processUserId: string
  17 + processStatus: number
  18 + resultCode: number
  19 +}
  20 +
3 // 查询列表API 访问日志 21 // 查询列表API 访问日志
4 export const getApiErrorLogPageApi = (params) => { 22 export const getApiErrorLogPageApi = (params) => {
5 return request.get({ url: '/infra/api-error-log/page', params }) 23 return request.get({ url: '/infra/api-error-log/page', params })
yudao-ui-admin-vue3/src/api/infra/apiErrorLog/types.ts deleted
1 -export type ApiErrorLogVO = {  
2 - id: number  
3 - userId: string  
4 - userIp: string  
5 - userAgent: string  
6 - userType: string  
7 - applicationName: string  
8 - requestMethod: string  
9 - requestParams: string  
10 - requestUrl: string  
11 - exceptionTime: string  
12 - exceptionName: string  
13 - exceptionStackTrace: string  
14 - processUserId: string  
15 - processStatus: number  
16 - resultCode: number  
17 -}  
yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/dataTimePicker.tsx
@@ -13,6 +13,7 @@ VXETable.renderer.add('XDataTimePicker', { @@ -13,6 +13,7 @@ VXETable.renderer.add('XDataTimePicker', {
13 <ElDatePicker 13 <ElDatePicker
14 v-model={data[field]} 14 v-model={data[field]}
15 type={content ? (content as any) : 'datetimerange'} 15 type={content ? (content as any) : 'datetimerange'}
  16 + style="maxWidth: 330px"
16 value-format="YYYY-MM-DD HH:mm:ss" 17 value-format="YYYY-MM-DD HH:mm:ss"
17 range-separator="-" 18 range-separator="-"
18 start-placeholder={t('common.startTimeText')} 19 start-placeholder={t('common.startTimeText')}
yudao-ui-admin-vue3/src/views/infra/apiAccessLog/apiAccessLog.data.ts
1 import { reactive } from 'vue' 1 import { reactive } from 'vue'
2 -import { useI18n } from '@/hooks/web/useI18n'  
3 -import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'  
4 import { DICT_TYPE } from '@/utils/dict' 2 import { DICT_TYPE } from '@/utils/dict'
5 -const { t } = useI18n() // 国际化 3 +import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
6 4
7 // CrudSchema 5 // CrudSchema
8 -const crudSchemas = reactive<CrudSchema[]>([  
9 - {  
10 - label: t('common.index'),  
11 - field: 'id',  
12 - type: 'index'  
13 - },  
14 - {  
15 - label: '链路追踪',  
16 - field: 'traceId'  
17 - },  
18 - {  
19 - label: '用户编号',  
20 - field: 'userId',  
21 - search: {  
22 - show: true  
23 - }  
24 - },  
25 - {  
26 - label: '用户类型',  
27 - field: 'userType',  
28 - dictType: DICT_TYPE.USER_TYPE,  
29 - dictClass: 'number',  
30 - search: {  
31 - show: true  
32 - }  
33 - },  
34 - {  
35 - label: '应用名',  
36 - field: 'applicationName',  
37 - search: {  
38 - show: true  
39 - }  
40 - },  
41 - {  
42 - label: '请求方法名',  
43 - field: 'requestMethod'  
44 - },  
45 - {  
46 - label: '请求地址',  
47 - field: 'requestUrl',  
48 - search: {  
49 - show: true  
50 - }  
51 - },  
52 - {  
53 - label: '请求时间',  
54 - field: 'beginTime',  
55 - search: {  
56 - show: true,  
57 - component: 'DatePicker',  
58 - componentProps: {  
59 - type: 'datetimerange',  
60 - valueFormat: 'YYYY-MM-DD HH:mm:ss',  
61 - defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)] 6 +const crudSchemas = reactive<VxeCrudSchema>({
  7 + primaryKey: 'id',
  8 + primaryType: 'seq',
  9 + action: true,
  10 + actionWidth: '80px',
  11 + columns: [
  12 + {
  13 + title: '链路追踪',
  14 + field: 'traceId'
  15 + },
  16 + {
  17 + title: '用户编号',
  18 + field: 'userId',
  19 + isSearch: true
  20 + },
  21 + {
  22 + title: '用户类型',
  23 + field: 'userType',
  24 + dictType: DICT_TYPE.USER_TYPE,
  25 + dictClass: 'number',
  26 + isSearch: true
  27 + },
  28 + {
  29 + title: '应用名',
  30 + field: 'applicationName',
  31 + isSearch: true
  32 + },
  33 + {
  34 + title: '请求方法名',
  35 + field: 'requestMethod'
  36 + },
  37 + {
  38 + title: '请求地址',
  39 + field: 'requestUrl',
  40 + isSearch: true
  41 + },
  42 + {
  43 + title: '请求时间',
  44 + field: 'beginTime',
  45 + formatter: 'formatDate',
  46 + search: {
  47 + show: true,
  48 + itemRender: {
  49 + name: 'XDataTimePicker'
  50 + }
62 } 51 }
63 - }  
64 - },  
65 - {  
66 - label: '执行时长',  
67 - field: 'duration'  
68 - },  
69 - {  
70 - label: '操作结果',  
71 - field: 'resultCode',  
72 - search: {  
73 - show: true  
74 - }  
75 - },  
76 - {  
77 - label: t('table.action'),  
78 - field: 'action',  
79 - width: '300px',  
80 - form: {  
81 - show: false  
82 }, 52 },
83 - detail: {  
84 - show: false 53 + {
  54 + title: '执行时长',
  55 + field: 'duration',
  56 + table: {
  57 + slots: {
  58 + default: 'duration_default'
  59 + }
  60 + }
  61 + },
  62 + {
  63 + title: '操作结果',
  64 + field: 'resultCode',
  65 + isSearch: true,
  66 + table: {
  67 + slots: {
  68 + default: 'resultCode_default'
  69 + }
  70 + }
85 } 71 }
86 - }  
87 -])  
88 -export const { allSchemas } = useCrudSchemas(crudSchemas) 72 + ]
  73 +})
  74 +export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
yudao-ui-admin-vue3/src/views/infra/apiAccessLog/index.vue
1 -<script setup lang="ts">  
2 -import { ref } from 'vue'  
3 -import dayjs from 'dayjs'  
4 -import { DICT_TYPE } from '@/utils/dict'  
5 -import { useTable } from '@/hooks/web/useTable'  
6 -import { useI18n } from '@/hooks/web/useI18n'  
7 -import type { ApiAccessLogVO } from '@/api/infra/apiAccessLog/types'  
8 -import { allSchemas } from './apiAccessLog.data'  
9 -import * as ApiAccessLogApi from '@/api/infra/apiAccessLog'  
10 -const { t } = useI18n() // 国际化  
11 -  
12 -// ========== 列表相关 ==========  
13 -const { register, tableObject, methods } = useTable<ApiAccessLogVO>({  
14 - getListApi: ApiAccessLogApi.getApiAccessLogPageApi  
15 -})  
16 -const { getList, setSearchParams } = methods  
17 -  
18 -// ========== 详情相关 ==========  
19 -const detailRef = ref() // 详情 Ref  
20 -const dialogVisible = ref(false) // 是否显示弹出层  
21 -const dialogTitle = ref('') // 弹出层标题  
22 -  
23 -// 详情操作  
24 -const handleDetail = (row: ApiAccessLogVO) => {  
25 - // 设置数据  
26 - detailRef.value = row  
27 - dialogTitle.value = t('action.detail')  
28 - dialogVisible.value = true  
29 -}  
30 -// ========== 初始化 ==========  
31 -getList()  
32 -</script>  
33 -  
34 <template> 1 <template>
35 - <!-- 搜索工作区 -->  
36 - <ContentWrap>  
37 - <Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />  
38 - </ContentWrap>  
39 <ContentWrap> 2 <ContentWrap>
40 <!-- 列表 --> 3 <!-- 列表 -->
41 - <Table  
42 - :columns="allSchemas.tableColumns"  
43 - :selection="false"  
44 - :data="tableObject.tableList"  
45 - :loading="tableObject.loading"  
46 - :pagination="{  
47 - total: tableObject.total  
48 - }"  
49 - v-model:pageSize="tableObject.pageSize"  
50 - v-model:currentPage="tableObject.currentPage"  
51 - @register="register"  
52 - >  
53 - <template #userType="{ row }">  
54 - <DictTag :type="DICT_TYPE.USER_TYPE" :value="row.userType" />  
55 - </template>  
56 - <template #beginTime="{ row }">  
57 - <span>{{ dayjs(row.beginTime).format('YYYY-MM-DD HH:mm:ss') }}</span>  
58 - </template>  
59 - <template #duration="{ row }"> 4 + <vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar">
  5 + <template #duration_default="{ row }">
60 <span>{{ row.duration + 'ms' }}</span> 6 <span>{{ row.duration + 'ms' }}</span>
61 </template> 7 </template>
62 - <template #resultCode="{ row }"> 8 + <template #resultCode_default="{ row }">
63 <span>{{ row.resultCode === 0 ? '成功' : '失败(' + row.resultMsg + ')' }}</span> 9 <span>{{ row.resultCode === 0 ? '成功' : '失败(' + row.resultMsg + ')' }}</span>
64 </template> 10 </template>
65 - <template #action="{ row }">  
66 - <el-button  
67 - link  
68 - type="primary" 11 + <template #actionbtns_default="{ row }">
  12 + <!-- 操作:详情 -->
  13 + <XTextButton
  14 + preIcon="ep:view"
  15 + :title="t('action.detail')"
69 v-hasPermi="['infra:api-access-log:query']" 16 v-hasPermi="['infra:api-access-log:query']"
70 @click="handleDetail(row)" 17 @click="handleDetail(row)"
71 - >  
72 - <Icon icon="ep:view" class="mr-1px" /> {{ t('action.detail') }}  
73 - </el-button> 18 + />
74 </template> 19 </template>
75 - </Table> 20 + </vxe-grid>
76 </ContentWrap> 21 </ContentWrap>
77 -  
78 <XModal v-model="dialogVisible" :title="dialogTitle"> 22 <XModal v-model="dialogVisible" :title="dialogTitle">
79 <!-- 对话框(详情) --> 23 <!-- 对话框(详情) -->
80 <Descriptions :schema="allSchemas.detailSchema" :data="detailRef"> 24 <Descriptions :schema="allSchemas.detailSchema" :data="detailRef">
@@ -91,3 +35,33 @@ getList() @@ -91,3 +35,33 @@ getList()
91 </template> 35 </template>
92 </XModal> 36 </XModal>
93 </template> 37 </template>
  38 +
  39 +<script setup lang="ts">
  40 +import { ref } from 'vue'
  41 +import { useI18n } from '@/hooks/web/useI18n'
  42 +import { useVxeGrid } from '@/hooks/web/useVxeGrid'
  43 +import { VxeGridInstance } from 'vxe-table'
  44 +import { allSchemas } from './apiAccessLog.data'
  45 +import * as ApiAccessLogApi from '@/api/infra/apiAccessLog'
  46 +const { t } = useI18n() // 国际化
  47 +
  48 +// 列表相关的变量
  49 +const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref
  50 +const { gridOptions } = useVxeGrid<ApiAccessLogApi.ApiAccessLogVO>({
  51 + allSchemas: allSchemas,
  52 + topActionSlots: false,
  53 + getListApi: ApiAccessLogApi.getApiAccessLogPageApi
  54 +})
  55 +// ========== 详情相关 ==========
  56 +const detailRef = ref() // 详情 Ref
  57 +const dialogVisible = ref(false) // 是否显示弹出层
  58 +const dialogTitle = ref('') // 弹出层标题
  59 +
  60 +// 详情操作
  61 +const handleDetail = (row: ApiAccessLogApi.ApiAccessLogVO) => {
  62 + // 设置数据
  63 + detailRef.value = row
  64 + dialogTitle.value = t('action.detail')
  65 + dialogVisible.value = true
  66 +}
  67 +</script>
yudao-ui-admin-vue3/src/views/infra/apiErrorLog/apiErrorLog.data.ts
1 import { reactive } from 'vue' 1 import { reactive } from 'vue'
2 -import { useI18n } from '@/hooks/web/useI18n'  
3 -import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'  
4 import { DICT_TYPE } from '@/utils/dict' 2 import { DICT_TYPE } from '@/utils/dict'
5 -const { t } = useI18n() // 国际化 3 +import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
6 4
7 // CrudSchema 5 // CrudSchema
8 -const crudSchemas = reactive<CrudSchema[]>([  
9 - {  
10 - label: t('common.index'),  
11 - field: 'id',  
12 - type: 'index'  
13 - },  
14 - {  
15 - label: '链路追踪',  
16 - field: 'traceId'  
17 - },  
18 - {  
19 - label: '用户编号',  
20 - field: 'userId',  
21 - search: {  
22 - show: true  
23 - }  
24 - },  
25 - {  
26 - label: '用户类型',  
27 - field: 'userType',  
28 - dictType: DICT_TYPE.USER_TYPE,  
29 - search: {  
30 - show: true  
31 - }  
32 - },  
33 - {  
34 - label: '应用名',  
35 - field: 'applicationName',  
36 - search: {  
37 - show: true  
38 - }  
39 - },  
40 - {  
41 - label: '请求方法名',  
42 - field: 'requestMethod'  
43 - },  
44 - {  
45 - label: '请求地址',  
46 - field: 'requestUrl',  
47 - search: {  
48 - show: true  
49 - }  
50 - },  
51 - {  
52 - label: '异常发生时间',  
53 - field: 'exceptionTime',  
54 - search: {  
55 - show: true,  
56 - component: 'DatePicker',  
57 - componentProps: {  
58 - type: 'datetimerange',  
59 - valueFormat: 'YYYY-MM-DD HH:mm:ss',  
60 - defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)] 6 +const crudSchemas = reactive<VxeCrudSchema>({
  7 + primaryKey: 'id',
  8 + primaryType: 'seq',
  9 + action: true,
  10 + actionWidth: '300',
  11 + columns: [
  12 + {
  13 + title: '链路追踪',
  14 + field: 'traceId',
  15 + isTable: false
  16 + },
  17 + {
  18 + title: '用户编号',
  19 + field: 'userId',
  20 + isSearch: true
  21 + },
  22 + {
  23 + title: '用户类型',
  24 + field: 'userType',
  25 + dictType: DICT_TYPE.USER_TYPE,
  26 + isSearch: true
  27 + },
  28 + {
  29 + title: '应用名',
  30 + field: 'applicationName',
  31 + isSearch: true
  32 + },
  33 + {
  34 + title: '请求方法名',
  35 + field: 'requestMethod'
  36 + },
  37 + {
  38 + title: '请求地址',
  39 + field: 'requestUrl',
  40 + isSearch: true
  41 + },
  42 + {
  43 + title: '异常发生时间',
  44 + field: 'exceptionTime',
  45 + formatter: 'formatDate',
  46 + search: {
  47 + show: true,
  48 + itemRender: {
  49 + name: 'XDataTimePicker'
  50 + }
61 } 51 }
62 - }  
63 - },  
64 - {  
65 - label: '异常名',  
66 - field: 'exceptionName'  
67 - },  
68 - {  
69 - label: '处理状态',  
70 - field: 'processStatus',  
71 - dictType: DICT_TYPE.INFRA_API_ERROR_LOG_PROCESS_STATUS,  
72 - dictClass: 'number',  
73 - search: {  
74 - show: true  
75 - }  
76 - },  
77 - {  
78 - label: '处理人',  
79 - field: 'processUserId'  
80 - },  
81 - {  
82 - label: '处理时间',  
83 - field: 'processTime'  
84 - },  
85 - {  
86 - label: t('table.action'),  
87 - field: 'action',  
88 - width: '300px',  
89 - form: {  
90 - show: false  
91 }, 52 },
92 - detail: {  
93 - show: false 53 + {
  54 + title: '异常名',
  55 + field: 'exceptionName'
  56 + },
  57 + {
  58 + title: '处理状态',
  59 + field: 'processStatus',
  60 + dictType: DICT_TYPE.INFRA_API_ERROR_LOG_PROCESS_STATUS,
  61 + dictClass: 'number',
  62 + isSearch: true
  63 + },
  64 + {
  65 + title: '处理人',
  66 + field: 'processUserId',
  67 + isTable: false
  68 + },
  69 + {
  70 + title: '处理时间',
  71 + field: 'processTime',
  72 + formatter: 'formatDate',
  73 + isTable: false
94 } 74 }
95 - }  
96 -])  
97 -export const { allSchemas } = useCrudSchemas(crudSchemas) 75 + ]
  76 +})
  77 +export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
yudao-ui-admin-vue3/src/views/infra/apiErrorLog/index.vue
  1 +<template>
  2 + <ContentWrap>
  3 + <!-- 列表 -->
  4 + <vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar">
  5 + <!-- 操作:导出 -->
  6 + <template #toolbar_buttons>
  7 + <XButton
  8 + type="warning"
  9 + preIcon="ep:download"
  10 + :title="t('action.export')"
  11 + @click="handleExport()"
  12 + />
  13 + </template>
  14 + <template #duration_default="{ row }">
  15 + <span>{{ row.duration + 'ms' }}</span>
  16 + </template>
  17 + <template #resultCode_default="{ row }">
  18 + <span>{{ row.resultCode === 0 ? '成功' : '失败(' + row.resultMsg + ')' }}</span>
  19 + </template>
  20 + <template #actionbtns_default="{ row }">
  21 + <!-- 操作:详情 -->
  22 + <XTextButton
  23 + preIcon="ep:view"
  24 + :title="t('action.detail')"
  25 + v-hasPermi="['infra:api-access-log:query']"
  26 + @click="handleDetail(row)"
  27 + />
  28 + <XTextButton
  29 + preIcon="ep:cpu"
  30 + title="已处理"
  31 + v-if="row.processStatus === InfraApiErrorLogProcessStatusEnum.INIT"
  32 + v-hasPermi="['infra:api-error-log:update-status']"
  33 + @click="handleProcessClick(row, InfraApiErrorLogProcessStatusEnum.DONE, '已处理')"
  34 + />
  35 + <XTextButton
  36 + preIcon="ep:mute-notification"
  37 + title="已忽略"
  38 + v-if="row.processStatus === InfraApiErrorLogProcessStatusEnum.INIT"
  39 + v-hasPermi="['infra:api-error-log:update-status']"
  40 + @click="handleProcessClick(row, InfraApiErrorLogProcessStatusEnum.IGNORE, '已忽略')"
  41 + />
  42 + </template>
  43 + </vxe-grid>
  44 + </ContentWrap>
  45 + <XModal v-model="dialogVisible" :title="dialogTitle">
  46 + <!-- 对话框(详情) -->
  47 + <Descriptions :schema="allSchemas.detailSchema" :data="detailRef" />
  48 + <!-- 操作按钮 -->
  49 + <template #footer>
  50 + <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
  51 + </template>
  52 + </XModal>
  53 +</template>
1 <script setup lang="ts"> 54 <script setup lang="ts">
2 import { ref } from 'vue' 55 import { ref } from 'vue'
3 -import dayjs from 'dayjs'  
4 -import { DICT_TYPE } from '@/utils/dict'  
5 -import { useTable } from '@/hooks/web/useTable'  
6 import { useI18n } from '@/hooks/web/useI18n' 56 import { useI18n } from '@/hooks/web/useI18n'
7 -import type { ApiErrorLogVO } from '@/api/infra/apiErrorLog/types' 57 +import { useVxeGrid } from '@/hooks/web/useVxeGrid'
  58 +import { VxeGridInstance } from 'vxe-table'
8 import { allSchemas } from './apiErrorLog.data' 59 import { allSchemas } from './apiErrorLog.data'
9 import * as ApiErrorLogApi from '@/api/infra/apiErrorLog' 60 import * as ApiErrorLogApi from '@/api/infra/apiErrorLog'
10 import { InfraApiErrorLogProcessStatusEnum } from '@/utils/constants' 61 import { InfraApiErrorLogProcessStatusEnum } from '@/utils/constants'
@@ -13,113 +64,45 @@ const message = useMessage() @@ -13,113 +64,45 @@ const message = useMessage()
13 const { t } = useI18n() // 国际化 64 const { t } = useI18n() // 国际化
14 65
15 // ========== 列表相关 ========== 66 // ========== 列表相关 ==========
16 -const { register, tableObject, methods } = useTable<ApiErrorLogVO>({ 67 +const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref
  68 +const { gridOptions, getList, exportList } = useVxeGrid<ApiErrorLogApi.ApiErrorLogVO>({
  69 + allSchemas: allSchemas,
17 getListApi: ApiErrorLogApi.getApiErrorLogPageApi, 70 getListApi: ApiErrorLogApi.getApiErrorLogPageApi,
18 exportListApi: ApiErrorLogApi.exportApiErrorLogApi 71 exportListApi: ApiErrorLogApi.exportApiErrorLogApi
19 }) 72 })
20 -const { getList, setSearchParams, exportList } = methods  
21 -  
22 // ========== 详情相关 ========== 73 // ========== 详情相关 ==========
23 const detailRef = ref() // 详情 Ref 74 const detailRef = ref() // 详情 Ref
24 const dialogVisible = ref(false) // 是否显示弹出层 75 const dialogVisible = ref(false) // 是否显示弹出层
25 const dialogTitle = ref('') // 弹出层标题 76 const dialogTitle = ref('') // 弹出层标题
26 77
27 // 详情操作 78 // 详情操作
28 -const handleDetail = (row: ApiErrorLogVO) => { 79 +const handleDetail = (row: ApiErrorLogApi.ApiErrorLogVO) => {
29 // 设置数据 80 // 设置数据
30 detailRef.value = row 81 detailRef.value = row
31 dialogTitle.value = t('action.detail') 82 dialogTitle.value = t('action.detail')
32 dialogVisible.value = true 83 dialogVisible.value = true
33 } 84 }
  85 +// 导出
  86 +const handleExport = async () => {
  87 + await exportList(xGrid, '错误数据.xls')
  88 +}
34 // 异常处理操作 89 // 异常处理操作
35 -const handleProcessClick = (row: ApiErrorLogVO, processSttatus: number, type: string) => { 90 +const handleProcessClick = (
  91 + row: ApiErrorLogApi.ApiErrorLogVO,
  92 + processSttatus: number,
  93 + type: string
  94 +) => {
36 message 95 message
37 .confirm('确认标记为' + type + '?', t('common.reminder')) 96 .confirm('确认标记为' + type + '?', t('common.reminder'))
38 .then(async () => { 97 .then(async () => {
39 ApiErrorLogApi.updateApiErrorLogPageApi(row.id, processSttatus).then(() => { 98 ApiErrorLogApi.updateApiErrorLogPageApi(row.id, processSttatus).then(() => {
40 message.success(t('common.updateSuccess')) 99 message.success(t('common.updateSuccess'))
41 - getList()  
42 }) 100 })
43 }) 101 })
  102 + .finally(async () => {
  103 + // 刷新列表
  104 + await getList(xGrid)
  105 + })
44 .catch(() => {}) 106 .catch(() => {})
45 } 107 }
46 -// ========== 初始化 ==========  
47 -getList()  
48 </script> 108 </script>
49 -  
50 -<template>  
51 - <!-- 搜索工作区 -->  
52 - <ContentWrap>  
53 - <Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />  
54 - </ContentWrap>  
55 - <ContentWrap>  
56 - <el-button v-hasPermi="['infra:api-error-log:export']" @click="exportList('错误数据.xls')">  
57 - <Icon icon="ep:download" class="mr-5px" /> {{ t('action.export') }}  
58 - </el-button>  
59 - <!-- 列表 -->  
60 - <Table  
61 - :columns="allSchemas.tableColumns"  
62 - :selection="false"  
63 - :data="tableObject.tableList"  
64 - :loading="tableObject.loading"  
65 - :pagination="{  
66 - total: tableObject.total  
67 - }"  
68 - v-model:pageSize="tableObject.pageSize"  
69 - v-model:currentPage="tableObject.currentPage"  
70 - @register="register"  
71 - >  
72 - <template #userType="{ row }">  
73 - <DictTag :type="DICT_TYPE.USER_TYPE" :value="row.userType" />  
74 - </template>  
75 - <template #processStatus="{ row }">  
76 - <DictTag :type="DICT_TYPE.INFRA_API_ERROR_LOG_PROCESS_STATUS" :value="row.processStatus" />  
77 - </template>  
78 - <template #exceptionTime="{ row }">  
79 - <span>{{ dayjs(row.exceptionTime).format('YYYY-MM-DD HH:mm:ss') }}</span>  
80 - </template>  
81 - <template #processTime="{ row }">  
82 - <span v-if="row.processTime">{{  
83 - dayjs(row.processTime).format('YYYY-MM-DD HH:mm:ss')  
84 - }}</span>  
85 - </template>  
86 - <template #action="{ row }">  
87 - <el-button  
88 - link  
89 - type="primary"  
90 - v-hasPermi="['infra:api-error-log:export']"  
91 - @click="handleDetail(row)"  
92 - >  
93 - <Icon icon="ep:view" class="mr-1px" /> {{ t('action.detail') }}  
94 - </el-button>  
95 - <el-button  
96 - link  
97 - type="primary"  
98 - v-if="row.processStatus === InfraApiErrorLogProcessStatusEnum.INIT"  
99 - v-hasPermi="['infra:api-error-log:update-status']"  
100 - @click="handleProcessClick(row, InfraApiErrorLogProcessStatusEnum.DONE, '已处理')"  
101 - >  
102 - <Icon icon="ep:cpu" class="mr-1px" /> 已处理  
103 - </el-button>  
104 - <el-button  
105 - link  
106 - type="primary"  
107 - v-if="row.processStatus === InfraApiErrorLogProcessStatusEnum.INIT"  
108 - v-hasPermi="['infra:api-error-log:update-status']"  
109 - @click="handleProcessClick(row, InfraApiErrorLogProcessStatusEnum.IGNORE, '已忽略')"  
110 - >  
111 - <Icon icon="ep:mute-notification" class="mr-1px" /> 已忽略  
112 - </el-button>  
113 - </template>  
114 - </Table>  
115 - </ContentWrap>  
116 -  
117 - <XModal v-model="dialogVisible" :title="dialogTitle">  
118 - <!-- 对话框(详情) -->  
119 - <Descriptions :schema="allSchemas.detailSchema" :data="detailRef" />  
120 - <!-- 操作按钮 -->  
121 - <template #footer>  
122 - <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>  
123 - </template>  
124 - </XModal>  
125 -</template>  
yudao-ui-admin-vue3/src/views/system/errorCode/errorCode.data.ts
@@ -45,8 +45,8 @@ const crudSchemas = reactive&lt;VxeCrudSchema&gt;({ @@ -45,8 +45,8 @@ const crudSchemas = reactive&lt;VxeCrudSchema&gt;({
45 field: 'createTime', 45 field: 'createTime',
46 formatter: 'formatDate', 46 formatter: 'formatDate',
47 isForm: false, 47 isForm: false,
48 - isSearch: true,  
49 search: { 48 search: {
  49 + show: true,
50 itemRender: { 50 itemRender: {
51 name: 'XDataTimePicker' 51 name: 'XDataTimePicker'
52 } 52 }