<!DOCTYPE html>

<html>

	<head>
		<meta charset="utf-8">
		<title>日志管理</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<link rel="stylesheet" href="<?= RESOURCES ?>/layuiadmin/layuiadmin/layui/css/layui.css" media="all">
		<link rel="stylesheet" href="<?= RESOURCES ?>/layuiadmin/layuiadmin/style/admin.css" media="all">
	</head>

	<body>
		<div class="layui-fluid">
			<div class="layui-row layui-col">
				<div class="layui-col-md12">
					<div class="layui-card">
						<!--<div class="layui-card-header">操作日志</div>-->
						<div class="layui-card-body">
							<table class="layui-hide" id="test-table-operate" lay-filter="test-table-operate"></table>
						</div>
					</div>
				</div>
			</div>
		</div>

		<script src="<?= RESOURCES ?>/layuiadmin/layuiadmin/layui/layui.js"></script>
		<script>
			layui.config({
				base: '<?= RESOURCES ?>/layuiadmin/layuiadmin/' //静态资源所在路径
			}).extend({
				index: 'lib/index' //主入口模块
			}).use(['index', 'table'], function() {
				var table = layui.table,
					admin = layui.admin;

				table.render({
					elem: '#test-table-operate',
					url: '/<?= ADMIN_NAME ?>/log/getloglist',
					cellMinWidth: 80, //全局定义常规单元格的最小宽度，layui 2.2.1 新增
					height: 'full-100',
					cols: [
						[{
								field: 'id',
								width: 80,
								title: 'ID',
								sort: true,
								fixed: 'left'
							}, {
								field: 'u1',
								width: 100,
								title: '操作人'
							}, {
								field: 'u2',
								title: '日志说明'
							}, {
								field: 'u3',
								width: 120,
								title: '访问ip'
							}, {
								field: 'u4',
								width: 120,
								title: '日志类型'
							}, {
								field: 'dtime',
								width: 200,
								title: '记录日期'
							}

						]
					],
					page: true,
					limit: 20,
				});

				//监听表格复选框选择
				table.on('checkbox(test-table-operate)', function(obj) {
					console.log(obj)
				});
				//监听工具条
				table.on('tool(test-table-operate)', function(obj) {
					var data = obj.data;
					if(obj.event === 'del') {
						layer.confirm('真的删除么', function(index) {
							layer.close(index);
							var id = data.id;
							window.location.href="/<?= ADMIN_NAME ?>/group/delete?id="+id;
						});
					} else if(obj.event === 'edit') {
						var id = data.id;
						layOpen("修改用户组权限","/<?= ADMIN_NAME ?>/group/edit?id="+id);
						
					}
				});

			});
		</script>

	</body>

</html>