¶Ô±ÈÐÂÎļþ |
| | |
| | | <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">æ£å¸¸</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> |