From 5e440a7dc434c43eb828fa62cf9c12b0078b8565 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子Li <15040126243@163.com> Date: 星期一, 20 一月 2025 11:36:18 +0800 Subject: [PATCH] !173 发布 5.3.0-BETA 公测版本 Merge pull request !173 from 疯狂的狮子Li/dev --- src/views/monitor/operlog/oper-info-dialog.vue | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 111 insertions(+), 0 deletions(-) diff --git a/src/views/monitor/operlog/oper-info-dialog.vue b/src/views/monitor/operlog/oper-info-dialog.vue new file mode 100644 index 0000000..66491e2 --- /dev/null +++ b/src/views/monitor/operlog/oper-info-dialog.vue @@ -0,0 +1,111 @@ +<template> + <el-dialog v-model="open" title="鎿嶄綔鏃ュ織璇︾粏" width="700px" append-to-body close-on-click-modal @closed="info = null"> + <el-descriptions v-if="info" :column="1" border> + <el-descriptions-item label="鎿嶄綔鐘舵��"> + <template #default> + <el-tag v-if="info.status === 0" type="success">姝e父</el-tag> + <el-tag v-else-if="info.status === 1" type="danger">澶辫触</el-tag> + </template> + </el-descriptions-item> + <el-descriptions-item label="鐧诲綍淇℃伅"> + <template #default> {{ info.operName }} / {{ info.deptName }} / {{ info.operIp }} / {{ info.operLocation }} </template> + </el-descriptions-item> + <el-descriptions-item label="璇锋眰淇℃伅"> + <template #default> {{ info.requestMethod }} {{ info.operUrl }} </template> + </el-descriptions-item> + <el-descriptions-item label="鎿嶄綔妯″潡"> + <template #default> {{ info.title }} / {{ typeFormat(info) }} </template> + </el-descriptions-item> + <el-descriptions-item label="鎿嶄綔鏂规硶"> + <template #default> + {{ info.method }} + </template> + </el-descriptions-item> + <el-descriptions-item label="璇锋眰鍙傛暟"> + <template #default> + <div class="max-h-300px overflow-y-auto"> + <VueJsonPretty :data="formatToJsonObject(info.operParam)" /> + </div> + </template> + </el-descriptions-item> + <el-descriptions-item label="杩斿洖鍙傛暟"> + <template #default> + <div class="max-h-300px overflow-y-auto"> + <VueJsonPretty :data="formatToJsonObject(info.jsonResult)" /> + </div> + </template> + </el-descriptions-item> + <el-descriptions-item label="娑堣�楁椂闂�"> + <template #default> + <span> {{ info.costTime }}ms </span> + </template> + </el-descriptions-item> + <el-descriptions-item label="鎿嶄綔鏃堕棿"> + <template #default> {{ proxy.parseTime(info.operTime) }}</template> + </el-descriptions-item> + <el-descriptions-item v-if="info.status === 1" label="寮傚父淇℃伅"> + <template #default> + <span class="text-danger"> {{ info.errorMsg }}</span> + </template> + </el-descriptions-item> + </el-descriptions> + </el-dialog> +</template> + +<script setup lang="ts"> +import type { OperLogForm } from '@/api/monitor/operlog/types'; +import VueJsonPretty from 'vue-json-pretty'; +import 'vue-json-pretty/lib/styles.css'; + +const open = ref(false); +const info = ref<OperLogForm | null>(null); +function openDialog(row: OperLogForm) { + info.value = row; + open.value = true; +} + +function closeDialog() { + open.value = false; +} + +defineExpose({ + openDialog, + closeDialog +}); + +/** + * json杞负瀵硅薄 + * @param data 鍘熷鏁版嵁 + */ +function formatToJsonObject(data: string) { + try { + return JSON.parse(data); + } catch (error) { + return data; + } +} + +/** + * 瀛楀吀淇℃伅 + */ +const { proxy } = getCurrentInstance() as ComponentInternalInstance; +const { sys_oper_type } = toRefs<any>(proxy?.useDict('sys_oper_type')); +const typeFormat = (row: OperLogForm) => { + return proxy?.selectDictLabel(sys_oper_type.value, row.businessType); +}; +</script> + +<style scoped> +/** +label瀹藉害鍥哄畾 +*/ +:deep(.el-descriptions__label) { + min-width: 100px; +} +/** +鏂囧瓧瓒呰繃 鎹㈣鏄剧ず +*/ +:deep(.el-descriptions__content) { + max-width: 300px; +} +</style> -- Gitblit v1.9.3