feat: 请求日志增加TraceId (#154)

Co-authored-by: tk <fiyne1a@dingtalk.com>
This commit is contained in:
2024-07-08 20:50:53 +08:00
committed by GitHub
parent be5b9a160d
commit aaea28389a
38 changed files with 150 additions and 138 deletions

View File

@ -1,5 +1,6 @@
<template>
<el-cascader
v-bind="$attrs"
v-model="data"
:options="options"
:placeholder="placeholder"

View File

@ -1,7 +1,7 @@
<template>
<el-drawer v-model="visible" :size="size" :title="title" @closed="$emit('closed')" destroy-on-close>
<el-main>
<el-descriptions :column="1" border size="small">
<el-descriptions :column="1" border class="font-monospace" size="small">
<el-descriptions-item v-for="(item, i) in data" :key="i" :label="i" label-class-name="w15">
{{ item }}
</el-descriptions-item>

View File

@ -497,6 +497,10 @@ textarea {
margin-top: 2rem;
}
.mb-8 {
margin-bottom: 2rem;
}
.w100p {
width: 100%;
}

View File

@ -121,13 +121,13 @@
margin-top: 1rem;
border-bottom: 1px solid var(--el-border-color-light);
}
.adminui-main > .el-container > .el-container > .el-header {
.adminui-main > .el-container .el-header {
@extend .headerPublic;
}
.adminui-main > .el-container > .el-container > .el-header .left-panel {
.adminui-main > .el-container .el-header .left-panel {
display: block;
}
.adminui-main > .el-container > .el-container > .el-header .right-panel {
.adminui-main > .el-container .el-header .right-panel {
display: block;
margin-top: 1rem;
}

View File

@ -247,6 +247,10 @@ tool.groupSeparator = function (num) {
})
.replace(/\.$/, '')
}
// unicode解码
tool.unicodeDecode = function (str) {
return str.replace(/\\u([0-9a-fA-F]{4})/g, (match, grp) => String.fromCharCode(parseInt(grp, 16)))
}
// 属性排序
tool.sortProperties = function (obj) {
const sortedKeys = Object.keys(obj).sort()

View File

@ -1,6 +1,6 @@
<template>
<el-container>
<el-aside v-loading="loading" width="30rem">
<el-aside v-loading="loading" width="40rem">
<el-container>
<el-header>
<el-input v-model="filterText" :placeholder="$t('输入关键字进行过滤')" clearable></el-input>
@ -23,6 +23,7 @@
<span>{{ data.name }} {{ data.code }}</span>
<span class="btn">
<el-button-group size="small">
<el-button @click.stop="add(data.id, data.code)" icon="el-icon-plus"></el-button>
<el-button @click.stop="edit(data)" icon="el-icon-edit"></el-button>
<el-popconfirm :title="$t('确定删除 {item} 吗?', { item: data.name })" @confirm="del(data)" width="20rem">
<template #reference>
@ -36,7 +37,9 @@
</el-tree>
</el-main>
<el-footer>
<el-button @click="add" icon="el-icon-plus" size="small" style="width: 100%" type="primary">{{ $t('字典分类') }}</el-button>
<el-button @click="add(form.catalogId)" icon="el-icon-plus" size="small" style="width: 100%" type="primary">{{
$t('字典分类')
}}</el-button>
</el-footer>
</el-container>
</el-aside>
@ -105,8 +108,8 @@ export default {
return targetText.indexOf(value) !== -1
},
//字典目录增加
async add() {
this.dialog.save = { mode: 'add' }
async add(id, code) {
this.dialog.save = { mode: 'add', data: { catalogId: id, code: code + '>' } }
},
//字典目录编辑
async edit(data) {

View File

@ -16,7 +16,10 @@
ref="search" />
</div>
<div class="right-panel">
<el-button @click="this.dialog.save = { mode: 'add' }" icon="el-icon-plus" type="primary"></el-button>
<el-button
@click="this.dialog.save = { mode: 'add', data: { catalogId: this.catalogId } }"
icon="el-icon-plus"
type="primary"></el-button>
<na-button-bulk-del :api="$API.sys_dic.bulkDeleteContent" :vue="this" />
</div>
</el-header>

View File

@ -5,7 +5,7 @@
<el-tab-pane :label="$t('基本信息')">
<el-form :disabled="mode === 'view'" :model="form" :rules="rules" label-width="10rem" ref="dialogForm">
<el-form-item :label="$t('所属字典')" prop="catalogId">
<na-dic-catalog v-model="form.catalogId" />
<na-dic-catalog v-model="form.catalogId" class="w100p" />
</el-form-item>
<el-form-item :label="$t('项名')" prop="key">
<el-input v-model="form.key" clearable></el-input>
@ -63,6 +63,7 @@ export default {
this.visible = true
this.loading = true
this.mode = data.mode
this.form.catalogId = data.data?.catalogId
if (data.row?.id) {
const res = await this.$API.sys_dic.getContent.post({ id: data.row.id })
Object.assign(this.form, res.data)

View File

@ -8,7 +8,7 @@
<el-input v-model="form.code" :placeholder="$t('字典编码')" clearable></el-input>
</el-form-item>
<el-form-item :label="$t('父路径')" prop="parentId">
<na-dic-catalog v-model="form.parentId" />
<na-dic-catalog v-model="form.parentId" class="w100p" />
</el-form-item>
</el-form>
<template #footer>
@ -45,6 +45,8 @@ export default {
this.visible = true
this.loading = true
this.mode = data.mode
this.form.parentId = data.data?.catalogId
this.form.code = data.data?.code
if (data.row?.id) {
const res = await this.$API.sys_dic.getCatalog.post({ id: data.row.id })
Object.assign(this.form, res.data)

View File

@ -1,9 +1,15 @@
<template>
<el-tabs v-model="tabId" class="w100p" style="background: var(--el-bg-color-overlay); padding-left: 1rem">
<el-tab-pane :label="$t('所有作业')" name="all"></el-tab-pane>
<el-tab-pane :label="$t('异常作业')" name="fail"></el-tab-pane>
</el-tabs>
<component :is="tabId" :status-codes="['300,399', '400,499', '500,599', '900,999']" />
<el-container>
<el-header style="border: none">
<el-tabs v-model="tabId" class="w100p">
<el-tab-pane :label="$t('所有作业')" name="all"></el-tab-pane>
<el-tab-pane :label="$t('异常作业')" name="fail"></el-tab-pane>
</el-tabs>
</el-header>
<el-main class="nopadding">
<component :is="tabId" :status-codes="['300,399', '400,499', '500,599', '900,999']" />
</el-main>
</el-container>
</template>
<script>

View File

@ -159,10 +159,10 @@ export default {
async rowClick(row) {
this.dialog.info = true
await this.$nextTick()
const res = await this.$API.sys_log.query.post({
filter: { id: row.id },
const res = await this.$API.sys_log.get.post({
id: row.id,
})
this.$refs.info.open(this.$TOOL.sortProperties(res.data[0]), this.$t('日志详情:{id}', { id: row.id }))
this.$refs.info.open(this.$TOOL.sortProperties(res.data), this.$t('日志详情:{id}', { id: row.id }))
},
},
mounted() {

View File

@ -205,7 +205,7 @@ export default {
})
}
if (typeof form.dy.userId) {
if (typeof form.dy.userId === 'number' && form.dy.userId !== 0) {
this.query.dynamicFilter.filters.push({
field: 'userId',
operator: 'eq',
@ -234,10 +234,10 @@ export default {
async rowClick(row) {
this.dialog.info = true
await this.$nextTick()
const res = await this.$API.sys_log.query.post({
filter: { id: row.id },
const res = await this.$API.sys_log.get.post({
id: row.id,
})
this.$refs.info.open(this.$TOOL.sortProperties(res.data[0]), this.$t('日志详情:{id}', { id: row.id }))
this.$refs.info.open(this.$TOOL.sortProperties(res.data), this.$t('日志详情:{id}', { id: row.id }))
},
},
mounted() {