From 977986c5c7ffc52702abfec93fabf89a8d45975f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E7=BA=A2=E4=B8=BD?= <1181930680@qq.com> Date: Thu, 21 Nov 2024 15:25:47 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E6=97=A5=E5=BF=97=E3=80=81?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E6=97=A5=E5=BF=97=E5=88=97=E8=A1=A8=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Table/src/Table.vue | 2 +- src/components/Table/src/hooks/useColumns.ts | 2 + src/views/system/logger/loginLog/columns.ts | 99 +++++++++--------- src/views/system/logger/operLog/columns.ts | 103 ++++++++++--------- 4 files changed, 109 insertions(+), 97 deletions(-) diff --git a/src/components/Table/src/Table.vue b/src/components/Table/src/Table.vue index 2d3e2f9..bea832f 100644 --- a/src/components/Table/src/Table.vue +++ b/src/components/Table/src/Table.vue @@ -96,7 +96,7 @@ - + diff --git a/src/components/Table/src/hooks/useColumns.ts b/src/components/Table/src/hooks/useColumns.ts index 7ca40aa..c488f8f 100644 --- a/src/components/Table/src/hooks/useColumns.ts +++ b/src/components/Table/src/hooks/useColumns.ts @@ -53,6 +53,8 @@ export function useColumns(propsRef: ComputedRef) { .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); diff --git a/src/views/system/logger/loginLog/columns.ts b/src/views/system/logger/loginLog/columns.ts index 28afe01..b08cbff 100644 --- a/src/views/system/logger/loginLog/columns.ts +++ b/src/views/system/logger/loginLog/columns.ts @@ -11,59 +11,66 @@ export const columns = [ width: 100, }, { - label: '操作用户', - prop: 'username', + label: '访客', + align:'left', + render(record){ + 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: '请求IP', - prop: 'ip', + 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: '浏览器', - prop: 'browser', - }, - { - label: '操作系统', - prop: 'os', - }, - { - label: '操作类型', - prop: 'typeText', + 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: '操作来源', - prop: 'sourceText', - }, - { - label: '请求方式', - prop: 'requestMethod', - }, - { - label: '请求URL', - prop: 'url', - }, - { - label: '请求地区', - prop: 'location', - }, - { - label: '请求耗时', - prop: 'consumeTime', - }, - { - label: '状态', - prop: 'status', - render(record) { - return h( - ElTag, - { - type: record.row.status == 0 ? 'success' : 'danger', - }, - { - default: () => (record.row.status == 0 ? '正常' : '异常'), - }, - ); - }, + align:'left', + render(record){ + return h('div', [ + h('div', '系统:'+record.row.os), + h('div', '类型:'+record.row.typeText), + h('div', '来源:'+record.row.sourceText), + ]) + } }, { label: '创建时间', diff --git a/src/views/system/logger/operLog/columns.ts b/src/views/system/logger/operLog/columns.ts index bf01666..4362b0b 100644 --- a/src/views/system/logger/operLog/columns.ts +++ b/src/views/system/logger/operLog/columns.ts @@ -11,63 +11,66 @@ export const columns = [ width: 100, }, { - label: '日志标题', - prop: 'title', + label: '访客', + align:'left', + render(record){ + 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: '操作用户', - prop: 'createUser', + 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: '请求IP', - prop: 'ip', - }, - { - label: '浏览器', - prop: 'browser', - }, - { - label: '操作系统', - prop: 'os', - }, - { - label: '操作类型', - prop: 'typeText', + 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: '操作来源', - prop: 'sourceText', - }, - { - label: '请求方式', - prop: 'requestMethod', - }, - { - label: '请求URL', - prop: 'url', - }, - { - label: '请求地区', - prop: 'location', - }, - { - label: '请求耗时', - prop: 'consumeTime', - }, - { - label: '状态', - prop: 'status', - render(record) { - return h( - ElTag, - { - type: record.row.status == 0 ? 'success' : 'danger', - }, - { - default: () => (record.row.status == 0 ? '正常' : '异常'), - }, - ); - }, + align:'left', + render(record){ + return h('div', [ + h('div', '系统:'+record.row.os), + h('div', '类型:'+record.row.typeText), + h('div', '来源:'+record.row.sourceText), + ]) + } }, { label: '创建时间',