1
1
<template >
2
- <content-wrap >
2
+ <ContentWrap >
3
3
<!-- 搜索工作栏 -->
4
4
<el-form
5
5
class =" -mb-15px"
25
25
class =" !w-240px"
26
26
>
27
27
<el-option
28
- v-for =" dict in getDictOptions (DICT_TYPE.USER_TYPE)"
29
- :key =" parseInt( dict.value) "
28
+ v-for =" dict in getIntDictOptions (DICT_TYPE.USER_TYPE)"
29
+ :key =" dict.value"
30
30
:label =" dict.label"
31
- :value =" parseInt( dict.value) "
31
+ :value =" dict.value"
32
32
/>
33
33
</el-select >
34
34
</el-form-item >
53
53
/>
54
54
</el-form-item >
55
55
<el-form-item label =" 处理状态" prop =" processStatus" >
56
- <el-select v-model =" queryParams.processStatus" placeholder =" 请选择处理状态" clearable >
56
+ <el-select
57
+ v-model =" queryParams.processStatus"
58
+ placeholder =" 请选择处理状态"
59
+ clearable
60
+ class =" !w-240px"
61
+ >
57
62
<el-option
58
- v-for =" dict in getDictOptions (DICT_TYPE.INFRA_API_ERROR_LOG_PROCESS_STATUS)"
59
- :key =" parseInt( dict.value) "
63
+ v-for =" dict in getIntDictOptions (DICT_TYPE.INFRA_API_ERROR_LOG_PROCESS_STATUS)"
64
+ :key =" dict.value"
60
65
:label =" dict.label"
61
- :value =" parseInt( dict.value) "
66
+ :value =" dict.value"
62
67
/>
63
68
</el-select >
64
69
</el-form-item >
76
81
</el-button >
77
82
</el-form-item >
78
83
</el-form >
79
- </content-wrap >
84
+ </ContentWrap >
85
+
80
86
<!-- 列表 -->
81
- <content-wrap >
87
+ <ContentWrap >
82
88
<el-table v-loading =" loading" :data =" list" >
83
89
<el-table-column label =" 日志编号" align =" center" prop =" id" />
84
90
<el-table-column label =" 用户编号" align =" center" prop =" userId" />
87
93
<dict-tag :type =" DICT_TYPE.USER_TYPE" :value =" scope.row.userType" />
88
94
</template >
89
95
</el-table-column >
90
- <el-table-column label =" 应用名" align =" center" prop =" applicationName" />
91
- <el-table-column label =" 请求方法名" align =" center" prop =" requestMethod" />
92
- <el-table-column label =" 请求地址" align =" center" prop =" requestUrl" width =" 250" />
93
- <el-table-column label =" 异常发生时间" align =" center" prop =" exceptionTime" width =" 180" >
94
- <template #default =" scope " >
95
- <span >{{ scope.row.exceptionTime }}</span >
96
- </template >
97
- </el-table-column >
98
- <el-table-column label =" 异常名" align =" center" prop =" exceptionName" width =" 250" />
96
+ <el-table-column label =" 应用名" align =" center" prop =" applicationName" width =" 200" />
97
+ <el-table-column label =" 请求方法" align =" center" prop =" requestMethod" width =" 80" />
98
+ <el-table-column label =" 请求地址" align =" center" prop =" requestUrl" width =" 180" />
99
+ <el-table-column
100
+ label =" 异常发生时间"
101
+ align =" center"
102
+ prop =" exceptionTime"
103
+ width =" 180"
104
+ :formatter =" dateFormatter"
105
+ />
106
+ <el-table-column label =" 异常名" align =" center" prop =" exceptionName" width =" 180" />
99
107
<el-table-column label =" 处理状态" align =" center" prop =" processStatus" >
100
108
<template #default =" scope " >
101
109
<dict-tag
104
112
/>
105
113
</template >
106
114
</el-table-column >
107
- <el-table-column label =" 操作" align =" center" >
115
+ <el-table-column label =" 操作" align =" center" width = " 200 " >
108
116
<template #default =" scope " >
109
117
<el-button
110
118
link
111
119
type =" primary"
112
- @click =" openModal (scope.row)"
120
+ @click =" openDetail (scope.row)"
113
121
v-hasPermi =" ['infra:api-access-log:query']"
114
122
>
115
123
详细
118
126
link
119
127
type =" primary"
120
128
v-if =" scope.row.processStatus === InfraApiErrorLogProcessStatusEnum.INIT"
121
- @click ="
122
- handleProcessClick(InfraApiErrorLogProcessStatusEnum.DONE, '已处理', scope.row.id)
123
- "
129
+ @click =" handleProcess(scope.row.id, InfraApiErrorLogProcessStatusEnum.DONE)"
124
130
v-hasPermi =" ['infra:api-error-log:update-status']"
125
131
>
126
132
已处理
127
133
</el-button >
128
134
<el-button
129
135
link
130
136
type =" primary"
131
- icon =" el-icon-check"
132
137
v-if =" scope.row.processStatus === InfraApiErrorLogProcessStatusEnum.INIT"
133
- @click ="
134
- handleProcessClick(InfraApiErrorLogProcessStatusEnum.IGNORE, '已忽略', scope.row.id)
135
- "
138
+ @click =" handleProcess(scope.row.id, InfraApiErrorLogProcessStatusEnum.IGNORE)"
136
139
v-hasPermi =" ['infra:api-error-log:update-status']"
137
140
>
138
141
已忽略
139
142
</el-button >
140
143
</template >
141
144
</el-table-column >
142
145
</el-table >
143
-
144
146
<!-- 分页组件 -->
145
147
<Pagination
146
148
:total =" total"
147
149
v-model:page =" queryParams.pageNo"
148
150
v-model:limit =" queryParams.pageSize"
149
151
@pagination =" getList"
150
152
/>
151
- </content-wrap >
153
+ </ContentWrap >
152
154
153
155
<!-- 表单弹窗:详情 -->
154
- <api-error-log-detail ref =" modalRef " />
156
+ <ApiErrorLogDetail ref =" detailRef " />
155
157
</template >
156
158
157
159
<script setup lang="ts" name="ApiErrorLog">
158
- import { DICT_TYPE , getDictOptions } from ' @/utils/dict'
160
+ import { DICT_TYPE , getIntDictOptions } from ' @/utils/dict'
161
+ import { dateFormatter } from ' @/utils/formatTime'
159
162
import download from ' @/utils/download'
160
163
import * as ApiErrorLogApi from ' @/api/infra/apiErrorLog'
161
- import ApiErrorLogDetail from ' ./detail .vue'
164
+ import ApiErrorLogDetail from ' ./ApiErrorLogDetail .vue'
162
165
import { InfraApiErrorLogProcessStatusEnum } from ' @/utils/constants'
166
+
163
167
const message = useMessage () // 消息弹窗
164
168
165
169
const loading = ref (true ) // 列表的加载中
@@ -182,13 +186,14 @@ const exportLoading = ref(false) // 导出的加载中
182
186
const getList = async () => {
183
187
loading .value = true
184
188
try {
185
- const data = await ApiErrorLogApi .getApiErrorLogPageApi (queryParams )
189
+ const data = await ApiErrorLogApi .getApiErrorLogPage (queryParams )
186
190
list .value = data .list
187
191
total .value = data .total
188
192
} finally {
189
193
loading .value = false
190
194
}
191
195
}
196
+
192
197
/** 搜索按钮操作 */
193
198
const handleQuery = () => {
194
199
queryParams .pageNo = 1
@@ -202,18 +207,19 @@ const resetQuery = () => {
202
207
}
203
208
204
209
/** 详情操作 */
205
- const modalRef = ref ()
206
- const openModal = (data : ApiErrorLogApi .ApiErrorLogVO ) => {
207
- modalRef .value .openModal (data )
210
+ const detailRef = ref ()
211
+ const openDetail = (data : ApiErrorLogApi .ApiErrorLogVO ) => {
212
+ detailRef .value .open (data )
208
213
}
209
214
210
215
/** 处理已处理 / 已忽略的操作 **/
211
- const handleProcessClick = async (processStatus : number , type : string , id : number ) => {
216
+ const handleProcess = async (id : number , processStatus : number ) => {
212
217
try {
213
218
// 操作的二次确认
219
+ const type = processStatus === InfraApiErrorLogProcessStatusEnum .DONE ? ' 已处理' : ' 已忽略'
214
220
await message .confirm (' 确认标记为' + type + ' ?' )
215
221
// 执行操作
216
- await ApiErrorLogApi .updateApiErrorLogPageApi (id , processStatus )
222
+ await ApiErrorLogApi .updateApiErrorLogPage (id , processStatus )
217
223
await message .success (type )
218
224
// 刷新列表
219
225
await getList ()
@@ -227,8 +233,8 @@ const handleExport = async () => {
227
233
await message .exportConfirm ()
228
234
// 发起导出
229
235
exportLoading .value = true
230
- const data = await ApiErrorLogApi .exportApiErrorLogApi (queryParams )
231
- download .excel (data , ' 操作日志 .xls' )
236
+ const data = await ApiErrorLogApi .exportApiErrorLog (queryParams )
237
+ download .excel (data , ' 异常日志 .xls' )
232
238
} catch {
233
239
} finally {
234
240
exportLoading .value = false
0 commit comments