{include file="public/header" /}
</head>
<body>
    <div id="main-container">
        {include file="public/menu" /}
        <div class="main">
            <div class="notice">{$position.url}</div>
            <div class="main_content">
                <div class="title">
                    <span>{$position.name}</span>
                </div>
                <a class="btn do-action" data-type="doDelete" data-href="{:url('dellog')}">删除</a>
				<div class="table">
					<table class="layuitable">
						<thead>
							<tr>
								<th width="50"><input type="checkbox" class="selected-all" id="selected-all"></th>
								<th width="50"><span>ID</span></th>
								<th width="100"><span>用户ID</span></th>
								<th width="100"><span>操作用户</span></th>
								<th><span>描述</span></th>
								<th width="100"><span>操作IP</span></th>
								<th><span>地址</span></th>
                                <th width="100"><span>状态</span></th>
                                <th width="150"><span>操作时间</span></th>
                                <th width="80"><span>操作</span></th>
							</tr>
						</thead>
						<script id="arlist" type="text/html">
                            {{# for(var i=0;i<d.length;i++){  }}
                            <tr class="long-td">
                                <td>
                                    <div class="icheckbox_square-green diychk" style="position: relative;"><input type="checkbox" style="position: absolute; opacity: 0;width:0px;height:0px;" name="ck" ids="{{d[i].log_id}}" value="true"><ins class="iCheck-helper"></ins></div>  
                                </td>
                                <td>{{d[i].log_id}}</td>
                                <td>{{d[i].admin_id}}</td>
                                <td>{{d[i].admin_name}}</td>
                                <td>{{d[i].description}}</td>
                                <td>{{d[i].ip}}</td>
                                <td>{{d[i].ipaddr.country}}{{d[i].ipaddr.area}}</td>
                                <td>
                                    {{# if(d[i].status==1){ }}
                                        操作成功
                                    {{# }else{ }}
                                        <span style="color: red">操作失败</span>
                                    {{# } }}
                                </td>
                                <td>{{d[i].add_time}}</td>
                                <td>
                                    <a class="btn do-action" data-type="doDelOne" data-href="{:url('dellog')}" data-id="{{d[i].log_id}}">删除</a>
                                </td>
                            </tr>
                            {{# } }}
                        </script>
                        <tbody id="article_list"></tbody>
					</table>
				</div>
                <div id="AjaxPage" style="float: right;margin-top:-10px;margin-left:10px;"></div>
                <div class="CountPage" style="float: right; line-height:30px;">
                    共 {$count} 条&nbsp;&nbsp;
                    <select name="list_rows" id="list_rows" class="list_rows">
                        <option value="10" {if config('sys.admin_list_rows') eq 10}selected{/if}>10 条/页</option>
                        <option value="20" {if config('sys.admin_list_rows') eq 20}selected{/if}>20 条/页</option>
                        <option value="50" {if config('sys.admin_list_rows') eq 50}selected{/if}>50 条/页</option>
                        <option value="100" {if config('sys.admin_list_rows') eq 100}selected{/if}>100 条/页</option>
                    </select>            
                </div>
                <div style="clear:both;"></div>
			</div>
		</div>
	</div>
<script>
    var laytpl,laypage;
    var url='{:url("log/index")}';
    var allpages='{$allpage}';
    layui.use(['layer', 'form','laypage','common', 'icheck','laytpl'], function () {
        var $ = layui.jquery, layer = layui.layer, common = layui.common, form = layui.form();
        $form = $('form');
        laytpl =layui.laytpl;
        laypage = layui.laypage;
        
        common.Ajaxpage();

        //加载单选框样式
        $(("[type='checkbox']")).iCheck({
            checkboxClass: 'icheckbox_square-green',
        });

        //全选
        $(document).on('ifChanged','.selected-all', function (event) {
            var $input = $('.layuitable tbody tr td').find('input');
            if ($('.selected-all').prop("checked")) {
                $("#article_list .diychk").addClass('checked');
                $("#article_list .diychk").children('input:checkbox').prop("checked", true);
            }else{
                $("#article_list .diychk").removeClass('checked');
                $("#article_list .diychk").children('input:checkbox').prop("checked", false);
            }
        });
        $(document).on('click','.diychk', function () {
            if ($(this).hasClass('checked')) {
                $(this).removeClass('checked');
                $(this).children('input:checkbox').prop("checked", false);
            }else{
                $(this).addClass('checked');
                $(this).children('input:checkbox').prop("checked", true);
            }
        });

        $(document).on('change','#list_rows', function () {
            var list_rows = $(this).val();
            $.ajax({
                url: '{:url("system/listrows")}',
                dataType: "json",
                data:{'list_rows':list_rows},
                type: "POST",
                success: function(data){
                    location.href = location.href;
                    
                }
            }); 
        });

    });

</script>
</body>
</html>