初始化项目
This commit is contained in:
111
UI/Views/Log/Index.cshtml
Normal file
111
UI/Views/Log/Index.cshtml
Normal file
@@ -0,0 +1,111 @@
|
||||
|
||||
@{
|
||||
ViewBag.Title = "日志管理";
|
||||
|
||||
Layout = "~/Views/Shared/_LayoutDefaule.cshtml";
|
||||
|
||||
}
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">日志信息</h3>
|
||||
</div>
|
||||
<div class="card-body" id="cardbody" style="padding:5px;">
|
||||
@* <div class="table-responsive">*@
|
||||
<table class="table table-borderless" style="overflow:hidden;display:block;" id="dataTable">
|
||||
<thead><tr><td></td></tr></thead>
|
||||
<tbody style="overflow:hidden;display:block;width:100%;">
|
||||
</tbody>
|
||||
</table>
|
||||
@* </div> *@
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function ShowLog(that, content, client, location, ip) {
|
||||
let s = $(that).find(".rowinfo");
|
||||
let data = `<div class="rowinfo" style=" padding:5px; margin: 0; line-height: 1; "><div>内容:` + content + `</div><div>客户端:` + client + `</div> <div>地点:` + location + `</div><div>IP:` + ip + `</div> </div>`;
|
||||
if (s.length<=0) {
|
||||
$(that).find('td').append(data);
|
||||
return;
|
||||
}
|
||||
$($(s).get(0)).toggle()
|
||||
};
|
||||
</script>
|
||||
<!-- DataTables & Plugins -->
|
||||
<script src="~/Lib/plugins/datatables/jquery.dataTables.min.js"></script>
|
||||
<script src="~/Lib/plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
|
||||
<script>
|
||||
$(function () {
|
||||
$('#dataTable').DataTable({
|
||||
"paging":true,
|
||||
"serverSide": true,
|
||||
"ajax": {
|
||||
url: '/Api/GetLog',
|
||||
type: 'POST'
|
||||
},
|
||||
//时间
|
||||
//'searchDelay': 1000,
|
||||
"autoWidth": false,
|
||||
'aLengthMenu': [50,15,25, 35,], //设置每页显示记录的下拉菜单
|
||||
"language": {
|
||||
"sProcessing": "处理中...",
|
||||
"sLengthMenu": "显示 _MENU_ 项结果",
|
||||
"sZeroRecords": "没有匹配结果",
|
||||
"sInfo": "显示第 _START_ 至 _END_ 项结果,共 _TOTAL_ 项",
|
||||
"sInfoEmpty": "显示第 0 至 0 项结果,共 0 项",
|
||||
"sInfoFiltered": "(由 _MAX_ 项结果过滤)",
|
||||
"sInfoPostFix": "",
|
||||
"sSearch": "搜索:",
|
||||
"sUrl": "",
|
||||
"sEmptyTable": "表中数据为空",
|
||||
"sLoadingRecords": "载入中...",
|
||||
"sInfoThousands": ",",
|
||||
"oPaginate": {
|
||||
"sFirst": "首页",
|
||||
"sPrevious": "上页",
|
||||
"sNext": "下页",
|
||||
"sLast": "末页"
|
||||
},
|
||||
"oAria": {
|
||||
"sSortAscending": ": 以升序排列此列",
|
||||
"sSortDescending": ": 以降序排列此列"
|
||||
}
|
||||
}
|
||||
,"columns": [
|
||||
{
|
||||
'sTitle': '',
|
||||
'render': function (data, type, row) {
|
||||
return `
|
||||
<td class="info-box-content" style="padding: 0; margin: 0; line-height: 1; overflow: hidden;display:block;width:100%;">
|
||||
<p style="margin:2px;margin:0; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; /*控制在1行*/ -webkit-line-clamp:1; -webkit-box-orient: vertical; ">
|
||||
`+row.Content+`
|
||||
</p>
|
||||
<p style="margin: 2px; margin: 0; ">
|
||||
<span class="text-gray">
|
||||
`+ row.Id + `
|
||||
`+ Gotimestamp(row.CreateTime, true) +`
|
||||
`+ row.Uid +`
|
||||
`+ (row.Type == 0 ? "新增" : row.Type == 1 ? "更新" : "删除") + `
|
||||
`+ (row.location == null ? "" : row.location) +`
|
||||
</span>
|
||||
</p>
|
||||
</td>`
|
||||
}
|
||||
}
|
||||
],
|
||||
"fnCreatedRow": function (nRow, aData, iDataIndex) {
|
||||
$(nRow).addClass('info-box');
|
||||
$(nRow).attr('style', "overflow: hidden; display: block; width:100%;padding: 5px; margin: 5px 0; min-height: auto !important; line-height: 1; ");
|
||||
$(nRow).click(
|
||||
function () {
|
||||
ShowLog(nRow, aData.Content, aData.Client, aData.location, aData.Ip);
|
||||
}
|
||||
)
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user