优化日志显示;

This commit is contained in:
2022-04-19 22:32:26 +08:00
parent 7852f602bb
commit c32d41348c
2 changed files with 32 additions and 6 deletions

View File

@@ -6,10 +6,20 @@
</div> </div>
<style> <style>
[data-field="content"] .layui-table-cell { [data-field="content"] .layui-table-cell {
white-space: normal; white-space: normal !important;
height: auto !important;
color: #333;
} }
.layui-table-view .layui-table[lay-size="sm"] [data-field="content"] .layui-table-cell { .log-group-0 {
height: auto; background-color: #e6e6e6;
}
.log-group-1 {
background-color: #f9f9f9;
}
.layui-table-view .layui-table td {
padding: 0
} }
</style> </style>

View File

@@ -14,6 +14,7 @@ define(["jquery", "easy-admin"], function ($, ea) {
var Controller = { var Controller = {
index: function () { index: function () {
var uidList = [];
ea.table.render({ ea.table.render({
init: init, init: init,
size: 'sm', size: 'sm',
@@ -21,9 +22,24 @@ define(["jquery", "easy-admin"], function ($, ea) {
cols: [[ cols: [[
{ type: 'checkbox' }, { type: 'checkbox' },
{ field: 'id', title: 'id' }, { field: 'id', title: 'id' },
{ field: 'uid', title: 'uid', minWidth: 140 }, {
{ field: 'level', title: 'level' }, field: 'uid', title: 'uid', minWidth: 120,
{ field: 'content', title: '日志内容', minWidth: 400, align: 'left', style: 'background-color:#eee' }, },
{ field: 'level', title: 'level', minWidth: 70 },
{
field: 'content', title: '日志内容', minWidth: 450, align: 'left', templet: function (data) {
if (uidList.indexOf(data.uid) < 0) {
uidList.push(data.uid);
}
var currentUidIndex = uidList.indexOf(data.uid);
var className = 'log-group log-group-' + (currentUidIndex % 2)
return '<div class="' + className + '">' + data.content + '</div>'
}
},
{ field: 'create_time', title: 'create_time', minWidth: 160 }, { field: 'create_time', title: 'create_time', minWidth: 160 },
{ field: 'app_name', title: 'app_name' }, { field: 'app_name', title: 'app_name' },
{ field: 'controller_name', title: 'controller_name', }, { field: 'controller_name', title: 'controller_name', },