From a1d7e81859f554f3a53680cc35f0f49bf1f77098 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 14 五月 2026 14:37:02 +0800
Subject: [PATCH] 导入项目
---
src/views/infra/apiErrorLog/index.vue | 252 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 252 insertions(+), 0 deletions(-)
diff --git a/src/views/infra/apiErrorLog/index.vue b/src/views/infra/apiErrorLog/index.vue
new file mode 100644
index 0000000..ca145a7
--- /dev/null
+++ b/src/views/infra/apiErrorLog/index.vue
@@ -0,0 +1,252 @@
+<template>
+ <doc-alert title="绯荤粺鏃ュ織" url="https://doc.iocoder.cn/system-log/" />
+
+ <ContentWrap>
+ <!-- 鎼滅储宸ヤ綔鏍� -->
+ <el-form
+ class="-mb-15px"
+ :model="queryParams"
+ ref="queryFormRef"
+ :inline="true"
+ label-width="68px"
+ >
+ <el-form-item label="鐢ㄦ埛缂栧彿" prop="userId">
+ <el-input
+ v-model="queryParams.userId"
+ placeholder="璇疯緭鍏ョ敤鎴风紪鍙�"
+ clearable
+ @keyup.enter="handleQuery"
+ class="!w-240px"
+ />
+ </el-form-item>
+ <el-form-item label="鐢ㄦ埛绫诲瀷" prop="userType">
+ <el-select
+ v-model="queryParams.userType"
+ placeholder="璇烽�夋嫨鐢ㄦ埛绫诲瀷"
+ clearable
+ class="!w-240px"
+ >
+ <el-option
+ v-for="dict in getIntDictOptions(DICT_TYPE.USER_TYPE)"
+ :key="dict.value"
+ :label="dict.label"
+ :value="dict.value"
+ />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="搴旂敤鍚�" prop="applicationName">
+ <el-input
+ v-model="queryParams.applicationName"
+ placeholder="璇疯緭鍏ュ簲鐢ㄥ悕"
+ clearable
+ @keyup.enter="handleQuery"
+ class="!w-240px"
+ />
+ </el-form-item>
+ <el-form-item label="寮傚父鏃堕棿" prop="exceptionTime">
+ <el-date-picker
+ v-model="queryParams.exceptionTime"
+ value-format="YYYY-MM-DD HH:mm:ss"
+ type="daterange"
+ start-placeholder="寮�濮嬫棩鏈�"
+ end-placeholder="缁撴潫鏃ユ湡"
+ :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
+ class="!w-240px"
+ />
+ </el-form-item>
+ <el-form-item label="澶勭悊鐘舵��" prop="processStatus">
+ <el-select
+ v-model="queryParams.processStatus"
+ placeholder="璇烽�夋嫨澶勭悊鐘舵��"
+ clearable
+ class="!w-240px"
+ >
+ <el-option
+ v-for="dict in getIntDictOptions(DICT_TYPE.INFRA_API_ERROR_LOG_PROCESS_STATUS)"
+ :key="dict.value"
+ :label="dict.label"
+ :value="dict.value"
+ />
+ </el-select>
+ </el-form-item>
+ <el-form-item>
+ <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 鎼滅储</el-button>
+ <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 閲嶇疆</el-button>
+ <el-button
+ type="success"
+ plain
+ @click="handleExport"
+ :loading="exportLoading"
+ v-hasPermi="['infra:api-error-log:export']"
+ >
+ <Icon icon="ep:download" class="mr-5px" /> 瀵煎嚭
+ </el-button>
+ </el-form-item>
+ </el-form>
+ </ContentWrap>
+
+ <!-- 鍒楄〃 -->
+ <ContentWrap>
+ <el-table v-loading="loading" :data="list">
+ <el-table-column label="鏃ュ織缂栧彿" align="center" prop="id" />
+ <el-table-column label="鐢ㄦ埛缂栧彿" align="center" prop="userId" />
+ <el-table-column label="鐢ㄦ埛绫诲瀷" align="center" prop="userType">
+ <template #default="scope">
+ <dict-tag :type="DICT_TYPE.USER_TYPE" :value="scope.row.userType" />
+ </template>
+ </el-table-column>
+ <el-table-column label="搴旂敤鍚�" align="center" prop="applicationName" width="200" />
+ <el-table-column label="璇锋眰鏂规硶" align="center" prop="requestMethod" width="80" />
+ <el-table-column label="璇锋眰鍦板潃" align="center" prop="requestUrl" width="180" />
+ <el-table-column
+ label="寮傚父鍙戠敓鏃堕棿"
+ align="center"
+ prop="exceptionTime"
+ width="180"
+ :formatter="dateFormatter"
+ />
+ <el-table-column label="寮傚父鍚�" align="center" prop="exceptionName" width="180" />
+ <el-table-column label="澶勭悊鐘舵��" align="center" prop="processStatus">
+ <template #default="scope">
+ <dict-tag
+ :type="DICT_TYPE.INFRA_API_ERROR_LOG_PROCESS_STATUS"
+ :value="scope.row.processStatus"
+ />
+ </template>
+ </el-table-column>
+ <el-table-column label="鎿嶄綔" align="center" width="200">
+ <template #default="scope">
+ <el-button
+ link
+ type="primary"
+ @click="openDetail(scope.row)"
+ v-hasPermi="['infra:api-error-log:query']"
+ >
+ 璇︾粏
+ </el-button>
+ <el-button
+ link
+ type="primary"
+ v-if="scope.row.processStatus === InfraApiErrorLogProcessStatusEnum.INIT"
+ @click="handleProcess(scope.row.id, InfraApiErrorLogProcessStatusEnum.DONE)"
+ v-hasPermi="['infra:api-error-log:update-status']"
+ >
+ 宸插鐞�
+ </el-button>
+ <el-button
+ link
+ type="primary"
+ v-if="scope.row.processStatus === InfraApiErrorLogProcessStatusEnum.INIT"
+ @click="handleProcess(scope.row.id, InfraApiErrorLogProcessStatusEnum.IGNORE)"
+ v-hasPermi="['infra:api-error-log:update-status']"
+ >
+ 宸插拷鐣�
+ </el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ <!-- 鍒嗛〉缁勪欢 -->
+ <Pagination
+ :total="total"
+ v-model:page="queryParams.pageNo"
+ v-model:limit="queryParams.pageSize"
+ @pagination="getList"
+ />
+ </ContentWrap>
+
+ <!-- 琛ㄥ崟寮圭獥锛氳鎯� -->
+ <ApiErrorLogDetail ref="detailRef" />
+</template>
+
+<script lang="ts" setup>
+import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
+import { dateFormatter } from '@/utils/formatTime'
+import download from '@/utils/download'
+import * as ApiErrorLogApi from '@/api/infra/apiErrorLog'
+import ApiErrorLogDetail from './ApiErrorLogDetail.vue'
+import { InfraApiErrorLogProcessStatusEnum } from '@/utils/constants'
+
+defineOptions({ name: 'InfraApiErrorLog' })
+
+const message = useMessage() // 娑堟伅寮圭獥
+
+const loading = ref(true) // 鍒楄〃鐨勫姞杞戒腑
+const total = ref(0) // 鍒楄〃鐨勬�婚〉鏁�
+const list = ref([]) // 鍒楄〃鐨勬暟鎹�
+const queryParams = reactive({
+ pageNo: 1,
+ pageSize: 10,
+ userId: null,
+ userType: null,
+ applicationName: null,
+ requestUrl: null,
+ processStatus: null,
+ exceptionTime: []
+})
+const queryFormRef = ref() // 鎼滅储鐨勮〃鍗�
+const exportLoading = ref(false) // 瀵煎嚭鐨勫姞杞戒腑
+
+/** 鏌ヨ鍒楄〃 */
+const getList = async () => {
+ loading.value = true
+ try {
+ const data = await ApiErrorLogApi.getApiErrorLogPage(queryParams)
+ list.value = data.list
+ total.value = data.total
+ } finally {
+ loading.value = false
+ }
+}
+
+/** 鎼滅储鎸夐挳鎿嶄綔 */
+const handleQuery = () => {
+ queryParams.pageNo = 1
+ getList()
+}
+
+/** 閲嶇疆鎸夐挳鎿嶄綔 */
+const resetQuery = () => {
+ queryFormRef.value.resetFields()
+ handleQuery()
+}
+
+/** 璇︽儏鎿嶄綔 */
+const detailRef = ref()
+const openDetail = (data: ApiErrorLogApi.ApiErrorLogVO) => {
+ detailRef.value.open(data)
+}
+
+/** 澶勭悊宸插鐞� / 宸插拷鐣ョ殑鎿嶄綔 **/
+const handleProcess = async (id: number, processStatus: number) => {
+ try {
+ // 鎿嶄綔鐨勪簩娆$‘璁�
+ const type = processStatus === InfraApiErrorLogProcessStatusEnum.DONE ? '宸插鐞�' : '宸插拷鐣�'
+ await message.confirm('纭鏍囪涓�' + type + '?')
+ // 鎵ц鎿嶄綔
+ await ApiErrorLogApi.updateApiErrorLogPage(id, processStatus)
+ await message.success(type)
+ // 鍒锋柊鍒楄〃
+ await getList()
+ } catch {}
+}
+
+/** 瀵煎嚭鎸夐挳鎿嶄綔 */
+const handleExport = async () => {
+ try {
+ // 瀵煎嚭鐨勪簩娆$‘璁�
+ await message.exportConfirm()
+ // 鍙戣捣瀵煎嚭
+ exportLoading.value = true
+ const data = await ApiErrorLogApi.exportApiErrorLog(queryParams)
+ download.excel(data, '寮傚父鏃ュ織.xls')
+ } catch {
+ } finally {
+ exportLoading.value = false
+ }
+}
+
+/** 鍒濆鍖� **/
+onMounted(() => {
+ getList()
+})
+</script>
--
Gitblit v1.8.0