登录日志、操作日志列表样式

This commit is contained in:
陈红丽 2024-11-21 15:25:47 +08:00
parent a38b804c4b
commit 977986c5c7
4 changed files with 109 additions and 97 deletions

View File

@ -96,7 +96,7 @@
<slot :name="item.value" :scope="scope"/>
</template>
</el-table-column>
<el-table-column v-else :prop="item.prop" v-bind="item" show-overflow-tooltip align="center">
<el-table-column v-else :prop="item.prop" v-bind="item" show-overflow-tooltip>
<template #default="scope" v-if="item.render">
<Render :column="item" :row="scope.row" :render="item.render" :index="scope.$index" />
</template>

View File

@ -53,6 +53,8 @@ export function useColumns(propsRef: ComputedRef<BasicTableProps>) {
.map((column: BasicColumn) => {
//默认 ellipsis 为true
column.ellipsis = typeof column.ellipsis === 'undefined' ? { tooltip: true } : false;
// align 默认为center
column.align = typeof column.align === 'undefined' ? 'center' : column.align;
const { edit } = column;
if (edit) {
column.render = renderEditCell(column);

View File

@ -11,59 +11,66 @@ export const columns = [
width: 100,
},
{
label: '操作用户',
prop: 'username',
},
{
label: '请求IP',
prop: 'ip',
},
{
label: '浏览器',
prop: 'browser',
},
{
label: '操作系统',
prop: 'os',
},
{
label: '操作类型',
prop: 'typeText',
},
{
label: '操作来源',
prop: 'sourceText',
},
{
label: '请求方式',
prop: 'requestMethod',
},
{
label: '请求URL',
prop: 'url',
},
{
label: '请求地区',
prop: 'location',
},
{
label: '请求耗时',
prop: 'consumeTime',
},
{
label: '状态',
prop: 'status',
label: '访客',
align:'left',
render(record){
return h(
ElTag,
return h('div', [
h('div',{
style: {marginBottom:'5px'}
}, record.row.username),
h('div',{
style: { marginBottom:'5px'}
}, record.row.ip),
h('div', record.row.location),
])
}
},
{
label: '请求接口',
align:'left',
render(record){
return h('div', [
h(ElTag,
{
type: 'info',
style: {marginBottom:'5px'}
},
{
default: () => (record.row.requestMethod),
}),
h('div', '接口:'+record.row.url),
])
}
},
{
label: '接口响应',
align:'left',
render(record){
return h('div', [
h('span', '状态:'),
h(ElTag,
{
type: record.row.status == 0 ? 'success' : 'danger',
style: {marginBottom:'5px'}
},
{
default: () => (record.row.status == 0 ? '正常' : '异常'),
}),
h('div', '请求耗时:'+record.row.consumeTime+'ms'),
])
}
},
);
},
{
label: '操作来源',
align:'left',
render(record){
return h('div', [
h('div', '系统:'+record.row.os),
h('div', '类型:'+record.row.typeText),
h('div', '来源:'+record.row.sourceText),
])
}
},
{
label: '创建时间',

View File

@ -11,63 +11,66 @@ export const columns = [
width: 100,
},
{
label: '日志标题',
prop: 'title',
},
{
label: '操作用户',
prop: 'createUser',
},
{
label: '请求IP',
prop: 'ip',
},
{
label: '浏览器',
prop: 'browser',
},
{
label: '操作系统',
prop: 'os',
},
{
label: '操作类型',
prop: 'typeText',
},
{
label: '操作来源',
prop: 'sourceText',
},
{
label: '请求方式',
prop: 'requestMethod',
},
{
label: '请求URL',
prop: 'url',
},
{
label: '请求地区',
prop: 'location',
},
{
label: '请求耗时',
prop: 'consumeTime',
},
{
label: '状态',
prop: 'status',
label: '访客',
align:'left',
render(record){
return h(
ElTag,
return h('div', [
h('div',{
style: {marginBottom:'5px'}
}, record.row.createUser),
h('div',{
style: { marginBottom:'5px'}
}, record.row.ip),
h('div', record.row.location),
])
}
},
{
label: '请求接口',
align:'left',
render(record){
return h('div', [
h(ElTag,
{
type: 'info',
style: {marginBottom:'5px'}
},
{
default: () => (record.row.requestMethod),
}),
h('div', '接口:'+record.row.url),
h('div', '名称:'+record.row.title),
])
}
},
{
label: '接口响应',
align:'left',
render(record){
return h('div', [
h('span', '状态:'),
h(ElTag,
{
type: record.row.status == 0 ? 'success' : 'danger',
style: {marginBottom:'5px'}
},
{
default: () => (record.row.status == 0 ? '正常' : '异常'),
}),
h('div', '请求耗时:'+record.row.consumeTime+'ms'),
])
}
},
);
},
{
label: '操作来源',
align:'left',
render(record){
return h('div', [
h('div', '系统:'+record.row.os),
h('div', '类型:'+record.row.typeText),
h('div', '来源:'+record.row.sourceText),
])
}
},
{
label: '创建时间',