<title>用户操作日志</title>
|
<!--当前位置开始-->
|
<div class="layui-card layadmin-header">
|
<div class="layui-breadcrumb" lay-filter="breadcrumb">
|
<script type="text/html" template lay-done="layui.data.updateMainBreadcrumb();">
|
</script>
|
</div>
|
</div>
|
<!--当前位置结束-->
|
<style>
|
/* 重写样式 */
|
</style>
|
<script type="text/html" template lay-type="Post" lay-url="Api/SysUserOperationLog/GetIndex" lay-done="layui.data.done(d);">
|
|
</script>
|
<div class="table-body">
|
<table id="LAY-app-SysUserOperationLog-tableBox" lay-filter="LAY-app-SysUserOperationLog-tableBox"></table>
|
</div>
|
|
<script type="text/html" id="LAY-app-SysUserOperationLog-toolbar">
|
<div class="layui-form coreshop-toolbar-search-form">
|
<div class="layui-form-item">
|
<div class="layui-inline">
|
<label class="layui-form-label" for="userName">用户登录账号</label>
|
<div class="layui-input-inline">
|
<input type="text" name="userName" placeholder="请输入用户登录账号" class="layui-input">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" for="ip">IP地址</label>
|
<div class="layui-input-inline">
|
<input type="text" name="ip" placeholder="请输入IP地址" class="layui-input">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" for="beginTime">开始时间</label>
|
<div class="layui-input-inline" style="width: 260px;">
|
<input type="text" name="beginTime" id="searchTime-SysUserOperationLog-beginTime" placeholder="请输入开始时间" class="layui-input">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" for="requestMethod">请求方式</label>
|
<div class="layui-input-inline">
|
<input type="text" name="requestMethod" placeholder="请输入请求方式" class="layui-input">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" for="statusCode">状态码</label>
|
<div class="layui-input-inline">
|
<input type="text" name="statusCode" placeholder="请输入状态码" class="layui-input">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-SysUserOperationLog-search"><i class="layui-icon layui-icon-search"></i>筛选</button>
|
</div>
|
</div>
|
</div>
|
</script>
|
|
<script type="text/html" id="LAY-app-SysUserOperationLog-pagebar">
|
<div class="layui-btn-container">
|
<button class="layui-btn layui-btn-sm" lay-event="batchDelete"><i class="layui-icon layui-icon-delete"></i>批量删除</button>
|
</div>
|
</script>
|
|
<script type="text/html" id="LAY-app-SysUserOperationLog-tableBox-bar">
|
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
|
</script>
|
|
<script>
|
var indexData;
|
var debug = layui.setter.debug;
|
layui.data.done = function (d) {
|
//开启调试情况下获取接口赋值数据
|
if (debug) { console.log(d); }
|
|
indexData = d.data;
|
layui.use(['index', 'table', 'laydate', 'util', 'coredropdown', 'coreHelper'],
|
function () {
|
var $ = layui.$
|
, admin = layui.admin
|
, table = layui.table
|
, form = layui.form
|
, laydate = layui.laydate
|
, setter = layui.setter
|
, coreHelper = layui.coreHelper
|
, util = layui.util
|
, view = layui.view;
|
|
var searchwhere;
|
//监听搜索
|
form.on('submit(LAY-app-SysUserOperationLog-search)',
|
function (data) {
|
var field = data.field;
|
searchwhere = field;
|
//执行重载
|
table.reloadData('LAY-app-SysUserOperationLog-tableBox', { where: field });
|
});
|
//数据绑定
|
table.render({
|
elem: '#LAY-app-SysUserOperationLog-tableBox',
|
url: layui.setter.apiUrl + 'Api/SysUserOperationLog/GetPageList',
|
method: 'POST',
|
toolbar: '#LAY-app-SysUserOperationLog-toolbar',
|
pagebar: '#LAY-app-SysUserOperationLog-pagebar',
|
className: 'pagebarbox',
|
defaultToolbar: ['filter', 'print', 'exports'],
|
height: 'full-127',//面包屑142px,搜索框4行172,3行137,2行102,1行67
|
page: true,
|
limit: 30,
|
limits: [10, 15, 20, 25, 30, 50, 100, 200],
|
text: { none: '暂无相关数据' },
|
cols: [
|
[
|
{ type: "checkbox", fixed: "left" },
|
{ field: 'id', title: '序列', sort: false, width: 60 },
|
{ field: 'userName', title: '登录账号', sort: false, width: 80 },
|
//{ field: 'userNickName', title: '用户登录昵称', sort: false,width: 105 },
|
//{ field: 'userId', title: '用户序列', sort: false,width: 105 },
|
{ field: 'ip', title: 'IP地址', sort: false, width: 105 },
|
{ field: 'apiPath', title: '请求地址', sort: false, width: 205 },
|
{ field: 'beginTime', title: '开始时间', width: 130, sort: false },
|
{ field: 'endTime', title: '结束时间', width: 130, sort: false },
|
{ field: 'opTime', title: '耗时', sort: false, width: 80 },
|
{ field: 'requestMethod', title: '方式', sort: false, width: 60 },
|
//{ field: 'requestData', title: '请求数据', sort: false,width: 105 },
|
//{ field: 'responseBodyData', title: '返回数据', sort: false,width: 105 },
|
{ field: 'agent', title: '代理渠道', sort: false, width: 105 },
|
{ field: 'actionName', title: '动作方法名称', sort: false, width: 105 },
|
{ field: 'actionDescription', title: '动作方法描述', sort: false, width: 105 },
|
{ field: 'controllerName', title: '控制器名称', sort: false, width: 105 },
|
{ field: 'controllerDescription', title: '控制器名称', sort: false, width: 105 },
|
{ field: 'statusCode', title: '状态码', sort: false, width: 60 },
|
//{ field: 'createTime', title: '创建时间', width: 130, sort: false },
|
{ field: 'dataSources', title: '数据来源', sort: false, width: 105 },
|
{ width: 82, align: 'center', title: '操作', fixed: 'right', toolbar: '#LAY-app-SysUserOperationLog-tableBox-bar' }
|
]
|
]
|
});
|
//监听排序事件
|
table.on('sort(LAY-app-SysUserOperationLog-tableBox)', function (obj) {
|
table.reloadData('LAY-app-SysUserOperationLog-tableBox', {
|
initSort: obj, //记录初始排序,如果不设的话,将无法标记表头的排序状态。
|
where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式)
|
orderField: obj.field, //排序字段
|
orderDirection: obj.type //排序方式
|
}
|
});
|
});
|
//监听行双击事件
|
table.on('rowDouble(LAY-app-SysUserOperationLog-tableBox)', function (obj) {
|
//查看详情
|
doDetails(obj);
|
});
|
//头工具栏事件
|
table.on('pagebar(LAY-app-SysUserOperationLog-tableBox)', function (obj) {
|
var checkStatus = table.checkStatus(obj.config.id);
|
switch (obj.event) {
|
case 'batchDelete':
|
doBatchDelete(checkStatus);
|
break;
|
};
|
});
|
//监听工具条
|
table.on('tool(LAY-app-SysUserOperationLog-tableBox)',
|
function (obj) {
|
if (obj.event === 'detail') {
|
doDetails(obj);
|
} else if (obj.event === 'del') {
|
doDelete(obj);
|
}
|
});
|
//执行预览操作
|
function doDetails(obj) {
|
coreHelper.Post("Api/SysUserOperationLog/GetDetails", { id: obj.data.id }, function (e) {
|
if (e.code === 0) {
|
admin.popup({
|
shadeClose: false,
|
title: '查看详情',
|
area: ['90%', '90%'],
|
id: 'LAY-popup-SysUserOperationLog-details',
|
success: function (layero, index) {
|
view(this.id).render('system/sysuseroperationlog/details', { data: e.data }).done(function () {
|
form.render();
|
});
|
// 禁止弹窗出现滚动条
|
//$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
}
|
});
|
} else {
|
layer.msg(e.msg);
|
}
|
});
|
}
|
//执行单个删除
|
function doDelete(obj) {
|
coreHelper.Post("Api/SysUserOperationLog/DoDelete", { id: obj.data.id }, function (e) {
|
if (debug) { console.log(e); } //开启调试返回数据
|
table.reloadData('LAY-app-SysUserOperationLog-tableBox');
|
layer.msg(e.msg);
|
});
|
}
|
//执行批量删除
|
function doBatchDelete(checkStatus) {
|
var checkData = checkStatus.data;
|
if (checkData.length === 0) {
|
return layer.msg('请选择要删除的数据');
|
}
|
layer.confirm('确定删除吗?删除后将无法恢复。',
|
function (index) {
|
var delidsStr = [];
|
layui.each(checkData,
|
function (index, item) {
|
delidsStr.push(item.id);
|
});
|
coreHelper.Post("Api/SysUserOperationLog/DoBatchDelete", { id: delidsStr }, function (e) {
|
if (debug) { console.log(e); } //开启调试返回数据
|
table.reloadData('LAY-app-SysUserOperationLog-tableBox');
|
layer.msg(e.msg);
|
});
|
});
|
}
|
|
laydate.render({
|
elem: '#searchTime-SysUserOperationLog-beginTime',
|
type: 'datetime',
|
range: '到',
|
});
|
laydate.render({
|
elem: '#searchTime-SysUserOperationLog-endTime',
|
type: 'datetime',
|
range: '到',
|
});
|
laydate.render({
|
elem: '#searchTime-SysUserOperationLog-createTime',
|
type: 'datetime',
|
range: '到',
|
});
|
|
//监听 表格复选框操作
|
|
//重载form
|
form.render();
|
});
|
};
|
</script>
|