CN-208 operation log 展示修改

This commit is contained in:
hyx
2021-10-24 20:23:24 +08:00
parent 49b8c0959c
commit 7cd2aa9ba3
3 changed files with 35 additions and 6 deletions

View File

@@ -4,6 +4,7 @@
ref="dataTable" ref="dataTable"
:data="tableData" :data="tableData"
:height="height" :height="height"
tooltip-effect="light"
border border
class="no-operation" class="no-operation"
@header-dragend="dragend" @header-dragend="dragend"
@@ -27,17 +28,32 @@
:sort-orders="['ascending', 'descending']" :sort-orders="['ascending', 'descending']"
:width="`${item.width}`" :width="`${item.width}`"
class="data-column" class="data-column"
:show-overflow-tooltip="['params', 'response'].indexOf(item.prop) > -1"
> >
<template #header> <template #header>
<span class="data-column__span">{{item.label}}</span> <span class="data-column__span">{{item.label}}</span>
<div class="col-resize-area"></div> <div class="col-resize-area"></div>
</template> </template>
<template #default="scope"> <template #default="scope">
<span v-if="item.prop === 'time'"> <span v-if="item.prop === 'duration'">
{{scope.row[item.prop]}}ms {{scope.row[item.prop]}}ms
</span> </span>
<span v-else-if="item.prop === 'state'">
<template v-if="scope.row[item.prop]==operationLogStateMapping.success">
{{$t('operationLog.state.success')}}
</template>
<template v-else-if="scope.row[item.prop]==operationLogStateMapping.fail">
{{$t('operationLog.state.fail')}}
</template>
<template v-else>
{{scope.row[item.prop]}}
</template>
</span>
<span v-else-if="item.prop === 'username'">{{formatUsername(scope.row)}}</span> <span v-else-if="item.prop === 'username'">{{formatUsername(scope.row)}}</span>
<span v-else-if="item.prop === 'ctime'">{{utcTimeToSysTime(scope.row[item.prop])}}</span> <span v-else-if="item.prop === 'ctime'">{{utcTimeToSysTime(scope.row[item.prop])}}</span>
<template v-else-if="item.prop === 'params' || item.prop === 'response'">
<span>{{scope.row[item.prop]}}</span>
</template>
<span v-else>{{scope.row[item.prop]}}</span> <span v-else>{{scope.row[item.prop]}}</span>
</template> </template>
</el-table-column> </el-table-column>
@@ -46,11 +62,14 @@
<script> <script>
import table from '@/mixins/table' import table from '@/mixins/table'
import { operationLogStateMapping } from '@/utils/constants'
export default { export default {
name: 'roleTable', name: 'roleTable',
mixins: [table], mixins: [table],
data () { data () {
return { return {
operationLogStateMapping: operationLogStateMapping,
tableTitle: [ tableTitle: [
{ {
label: this.$t('config.operationlog.id'), label: this.$t('config.operationlog.id'),
@@ -99,18 +118,20 @@ export default {
}, },
{ {
label: this.$t('config.operationlog.time'), label: this.$t('config.operationlog.time'),
prop: 'time', prop: 'duration',
show: false show: false
}, },
{ {
label: this.$t('config.operationlog.params'), label: this.$t('config.operationlog.params'),
prop: 'params', prop: 'params',
show: false show: false,
width: 150
}, },
{ {
label: this.$t('config.operationlog.response'), label: this.$t('config.operationlog.response'),
prop: 'response', prop: 'response',
show: false show: false,
width: 150
} }
] ]
} }

View File

@@ -179,7 +179,9 @@ export default {
let localStorageTableTitle = localStorage.getItem('cn-tableTitle-' + localStorage.getItem('cn-username') + '-' + this.tableId) let localStorageTableTitle = localStorage.getItem('cn-tableTitle-' + localStorage.getItem('cn-username') + '-' + this.tableId)
localStorageTableTitle = localStorageTableTitle ? JSON.parse(localStorageTableTitle) : this.$refs.dataTable.tableTitle localStorageTableTitle = localStorageTableTitle ? JSON.parse(localStorageTableTitle) : this.$refs.dataTable.tableTitle
this.tools.customTableTitle = this.$refs.dataTable.tableTitle.map((item, index) => { // 修复切换中英文的问题 this.tools.customTableTitle = this.$refs.dataTable.tableTitle.map((item, index) => { // 修复切换中英文的问题
if(localStorageTableTitle[index]){
item.show = localStorageTableTitle[index].show item.show = localStorageTableTitle[index].show
}
return item return item
}) })
if (localStorageTableTitle && (localStorageTableTitle.length > this.$refs.dataTable.tableTitle.length)) { if (localStorageTableTitle && (localStorageTableTitle.length > this.$refs.dataTable.tableTitle.length)) {

View File

@@ -39,6 +39,12 @@ export const panelTypeAndRouteMapping = {
appEntityDetail: 6 appEntityDetail: 6
} }
/* operationLog state 执行状态属性 值与名称之间的映射 */
export const operationLogStateMapping = {
success: 1,
fail: 0
}
export const position = { export const position = {
tableHeight: { tableHeight: {
normal: 'calc(100% - 48px)' // 常规高度,特例在下方定义 normal: 'calc(100% - 48px)' // 常规高度,特例在下方定义