96 lines
1.8 KiB
TypeScript
96 lines
1.8 KiB
TypeScript
import { h } from 'vue';
|
|
import { NTag } from 'naive-ui';
|
|
|
|
export const columns = [
|
|
{
|
|
type: 'selection',
|
|
width: 50,
|
|
fixed: 'left',
|
|
},
|
|
{
|
|
title: 'ID',
|
|
key: 'id',
|
|
fixed: 'left',
|
|
width: 100,
|
|
},
|
|
{
|
|
title: '访客',
|
|
align: 'left',
|
|
render(record) {
|
|
return h('div', [
|
|
h(
|
|
'div',
|
|
{
|
|
style: { marginBottom: '5px' },
|
|
},
|
|
record.createUser,
|
|
),
|
|
h(
|
|
'div',
|
|
{
|
|
style: { marginBottom: '5px' },
|
|
},
|
|
record.ip,
|
|
),
|
|
h('div', record.location),
|
|
]);
|
|
},
|
|
},
|
|
{
|
|
title: '请求接口',
|
|
align: 'left',
|
|
render(record) {
|
|
return h('div', [
|
|
h(
|
|
NTag,
|
|
{
|
|
type: 'info',
|
|
style: { marginBottom: '5px' },
|
|
},
|
|
{
|
|
default: () => record.requestMethod,
|
|
},
|
|
),
|
|
h('div', '接口:' + record.url),
|
|
h('div', '名称:' + record.title),
|
|
]);
|
|
},
|
|
},
|
|
{
|
|
title: '接口响应',
|
|
align: 'left',
|
|
render(record) {
|
|
return h('div', [
|
|
h('span', '状态:'),
|
|
h(
|
|
NTag,
|
|
{
|
|
type: record.status == 0 ? 'success' : 'error',
|
|
style: { marginBottom: '5px' },
|
|
},
|
|
{
|
|
default: () => (record.status == 0 ? '正常' : '异常'),
|
|
},
|
|
),
|
|
h('div', '请求耗时:' + record.consumeTime + 'ms'),
|
|
]);
|
|
},
|
|
},
|
|
{
|
|
label: '操作来源',
|
|
align: 'left',
|
|
render(record) {
|
|
return h('div', [
|
|
h('div', '系统:' + record.os),
|
|
h('div', '类型:' + record.typeText),
|
|
h('div', '来源:' + record.sourceText),
|
|
]);
|
|
},
|
|
},
|
|
{
|
|
title: '创建时间',
|
|
key: 'createTime',
|
|
width: 180,
|
|
},
|
|
];
|