{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 mr10" data-type="doDelete" data-href="{:url('delformcon')}">批量删除</a>
                <a class="btn" href="{:url('formcon',['fid'=>$fid,'type'=>'daochu'])}" target="_blank">记录导出</a>
				<div class="table">
					<table class="layuitable">
						<thead>
							<tr>
								<th width="50"><input type="checkbox" class="selected-all" id="selected-all"></th>
								<th width="60"><span>ID</span></th>
                                {volist name="fieldlist" id="v"}
                                <th ><span>{$v.title}</span></th>
                                {/volist}
								<th width="150"><span>提交时间</span></th>
                                <th width="100"><span>IP</span></th>
                                <th width="100"><span>推荐</span></th>
                                <th width="100"><span>状态</span></th>
								<th width="150"><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].id}}" value="true"><ins class="iCheck-helper"></ins></div>  
                                </td>
			                    <td>{{d[i].id}}</td>
                                {volist name="fieldlist" id="v"}
                                <td>{{d[i].{$v.field}}}</td>
                                {/volist}
			                    <td>{{d[i].create_time}}</td>
                                <td>{{d[i].ip}}</td>
                                <td>
                                	{{# if(d[i].istop==1){ }}
                                		推荐
                                    {{# } }}
                               	</td>
			                    <td>
			                    	{{# if(d[i].look==1){ }}
                                        已读
                                    {{# }else{ }}
                                        <font color="red">未读</font>
                                    {{# } }}
			                    </td>

			                    <td>
		                            <a class="btn do-action" data-type="doEdit" data-href="{:url('editformcon')}" data-id="{{d[i].id}}">编辑</a>
		                            <a class="btn do-action" data-type="doDelOne" data-href="{:url('delformcon')}" data-id="{{d[i].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 type="text/javascript">
var laytpl,laypage;
    var url='{:url("diyform/formcon",['fid'=>$fid])}';
    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>