mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2025-09-08 22:57:11 +08:00
refactor: 优化日志筛选与文本复制
This commit is contained in:
28
src/components/TextCopy/index.vue
Normal file
28
src/components/TextCopy/index.vue
Normal file
@@ -0,0 +1,28 @@
|
||||
<template>
|
||||
<div class="content">
|
||||
<icon-copy :size="16" @click="copyText"/>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { Message } from "@arco-design/web-vue"
|
||||
interface Props{
|
||||
value:any
|
||||
}
|
||||
const props = withDefaults(defineProps<Props>(), {})
|
||||
const copyText=()=>{
|
||||
const textarea = document.createElement('textarea')
|
||||
textarea.value = props.value
|
||||
document.body.appendChild(textarea)
|
||||
textarea.select()
|
||||
document.execCommand('copy')
|
||||
document.body.removeChild(textarea)
|
||||
Message.success('复制成功')
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.content{
|
||||
display: inline-block;
|
||||
margin-left: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
@@ -61,7 +61,6 @@ const filterChange = (values,record)=>{
|
||||
} catch (error) {
|
||||
search()
|
||||
}
|
||||
console.log(values,record)
|
||||
}
|
||||
const columns: TableInstance['columns'] = [
|
||||
{
|
||||
|
@@ -7,6 +7,7 @@
|
||||
:scroll="{ x: '100%', y: '100%', minWidth: 1000 }"
|
||||
:pagination="pagination"
|
||||
column-resizable
|
||||
@filterChange="filterChange"
|
||||
:disabledTools="['setting']"
|
||||
@refresh="search"
|
||||
>
|
||||
@@ -62,7 +63,16 @@ import OperationLogDetailDrawer from './OperationLogDetailDrawer.vue'
|
||||
import { useTable } from '@/hooks'
|
||||
|
||||
defineOptions({ name: 'OperationLog' })
|
||||
|
||||
const filterChange = (values,record)=>{
|
||||
try {
|
||||
const slotName = columns[values.split('_').pop()].slotName as string
|
||||
const value = record.join(',')
|
||||
queryForm[slotName] = value
|
||||
search()
|
||||
} catch (error) {
|
||||
search()
|
||||
}
|
||||
}
|
||||
const columns: TableInstance['columns'] = [
|
||||
{
|
||||
title: '序号',
|
||||
@@ -82,14 +92,14 @@ const columns: TableInstance['columns'] = [
|
||||
filters: [
|
||||
{
|
||||
text: '成功',
|
||||
value: 1
|
||||
value: '1'
|
||||
},
|
||||
{
|
||||
text: '失败',
|
||||
value: 2
|
||||
value: '2'
|
||||
}
|
||||
],
|
||||
filter: (value, record) => record.status == value,
|
||||
filter: () => true,
|
||||
alignLeft: true
|
||||
}
|
||||
},
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<a-drawer v-model:visible="visible" title="日志详情" :width="720" :footer="false">
|
||||
<a-descriptions title="基本信息" :column="2" size="large" class="general-description">
|
||||
<a-descriptions-item label="日志 ID">{{ operationLog?.id }}</a-descriptions-item>
|
||||
<a-descriptions-item label="Trace ID">{{ operationLog?.traceId }}</a-descriptions-item>
|
||||
<a-descriptions-item label="Trace ID" >{{ operationLog?.traceId }}<TextCopy :value="operationLog?.traceId"/></a-descriptions-item>
|
||||
<a-descriptions-item label="操作人">{{ operationLog?.createUserString }}</a-descriptions-item>
|
||||
<a-descriptions-item label="操作时间">{{ operationLog?.createTime }}</a-descriptions-item>
|
||||
<a-descriptions-item label="操作内容">{{ operationLog?.description }}</a-descriptions-item>
|
||||
@@ -25,7 +25,7 @@
|
||||
<a-tag v-else color="green">{{ operationLog?.timeTaken }} ms</a-tag>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="请求 URI" :span="2">
|
||||
{{ operationLog?.requestUrl }}
|
||||
{{ operationLog?.requestUrl }}<TextCopy :value="operationLog?.requestUrl"/>
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
<a-descriptions
|
||||
@@ -95,7 +95,6 @@
|
||||
import { getLog, type LogDetailResp } from '@/apis'
|
||||
import VueJsonPretty from 'vue-json-pretty'
|
||||
import 'vue-json-pretty/lib/styles.css'
|
||||
|
||||
const logId = ref('')
|
||||
const operationLog = ref<LogDetailResp | null>()
|
||||
// 查询详情
|
||||
|
Reference in New Issue
Block a user