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"
:data="tableData"
:height="height"
tooltip-effect="light"
border
class="no-operation"
@header-dragend="dragend"
@@ -27,17 +28,32 @@
:sort-orders="['ascending', 'descending']"
:width="`${item.width}`"
class="data-column"
:show-overflow-tooltip="['params', 'response'].indexOf(item.prop) > -1"
>
<template #header>
<span class="data-column__span">{{item.label}}</span>
<div class="col-resize-area"></div>
</template>
<template #default="scope">
<span v-if="item.prop === 'time'">
{{scope.row[item.prop]}} ms
<span v-if="item.prop === 'duration'">
{{scope.row[item.prop]}}ms
</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 === '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>
</template>
</el-table-column>
@@ -46,11 +62,14 @@
<script>
import table from '@/mixins/table'
import { operationLogStateMapping } from '@/utils/constants'
export default {
name: 'roleTable',
mixins: [table],
data () {
return {
operationLogStateMapping: operationLogStateMapping,
tableTitle: [
{
label: this.$t('config.operationlog.id'),
@@ -99,18 +118,20 @@ export default {
},
{
label: this.$t('config.operationlog.time'),
prop: 'time',
prop: 'duration',
show: false
},
{
label: this.$t('config.operationlog.params'),
prop: 'params',
show: false
show: false,
width: 150
},
{
label: this.$t('config.operationlog.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)
localStorageTableTitle = localStorageTableTitle ? JSON.parse(localStorageTableTitle) : this.$refs.dataTable.tableTitle
this.tools.customTableTitle = this.$refs.dataTable.tableTitle.map((item, index) => { // 修复切换中英文的问题
if(localStorageTableTitle[index]){
item.show = localStorageTableTitle[index].show
}
return item
})
if (localStorageTableTitle && (localStorageTableTitle.length > this.$refs.dataTable.tableTitle.length)) {

View File

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