<?php /*a:3:{s:63:"/www/wwwroot/btn.millet-mirth.com/view/admin/recycle/index.html";i:1630634076;s:60:"/www/wwwroot/btn.millet-mirth.com/view/admin/common/top.html";i:1625466448;s:63:"/www/wwwroot/btn.millet-mirth.com/view/admin/common/bottom.html";i:1629163316;}*/ ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<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, maximum-scale=1">
<title><?php echo config('common.CMS_NAME'); ?></title>
<link rel="stylesheet" href="/static/tqcms/css/common.css">
<link rel="stylesheet" href="/static/tqcms/layui/css/layui.css"><!--layui css-->
<link rel="stylesheet" href="/static/tqcms/css/skin.css">
<script src="/static/tqcms/js/jquery.js"></script>
</head>
<body>
<div class="body_top">
	<ul class="title">
    	<li class="active"><a href="<?php echo url('index'); ?>">回收站管理</a></li>
    </ul>
</div>

<div class="body_content_list">

<script type="text/html" id="barDemo">
<span class="tq_table_bar">
  <a class="layui-btn layui-btn-xs" lay-event="back">恢复</a>
  <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</span>
</script>

<script type="text/html" id="tq_btn">
  	<a class="layui-btn layui-btn-normal layui-btn-sm" lay-event="check_all">全选</a>
  	<a class="layui-btn layui-btn-normal layui-btn-sm" lay-event="back">恢复</a>
  	<a class="layui-btn layui-btn-normal layui-btn-sm" lay-event="list_delete">删除</a>
</script>
<table class="layui-hide" id="list" lay-filter="list"></table>

</div>

<script src="/static/tqcms/layui/layui.js"></script><!--layui js-->
<script src="/static/tqcms/layui/laytq.js"></script><!--layui js-->
<script src="/static/tqcms/js/common.js"></script>
<script src="/static/tqcms/js/md5.js"></script>
<script src="/static/tqcms/js/url.js"></script>
</body>
</html>
<script>
iname=self.frameElement.name;
layui.use('table', function(){
  var table = layui.table,form = layui.form;
  var table_height=$('.body_content_list').height();
  var true_height=table_height-52-38-51-13;//自适应每页条数
  var auto_page='<?php echo htmlentities($auto_page); ?>';
  if(auto_page==1){
	  var catepage=Math.floor(true_height/39);
  }else{
	  var catepage='<?php echo htmlentities($auto_page_num); ?>';
  }
  
  table.render({
    elem: '#list'
	,title:'回收站信息'
    ,url:'<?php echo url("Recycle/list_data"); ?>'
    ,cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
	,even: true
	,toolbar: '#tq_btn'
	,defaultToolbar: ['filter']
	,height: 'full-71'
	,page: { //支持传入 laypage 组件的所有参数（某些参数除外，如：jump/elem） - 详见文档
      layout: ['limit','count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
	  ,limit:catepage //每页显示的数据条数
	  ,limits:[catepage, 20, 30]
      ,groups:8 //只显示 1 个连续页码
	  ,theme: 'leng'
    }
	,cols: [[
      {type: 'checkbox', width:40}
      ,{field:'id', width:80, title: '编号', sort: true}
      ,{field:'title', title: '标题'}
      ,{field:'catename', title: '所属栏目'}
      ,{field:'id', width:130,align:'center',toolbar:'#barDemo', title: '操作'}
    ]]
  });
  
  
//监听工具条
table.on('tool(list)', function(obj){
	var data = obj.data;
	//删除
	if(obj.event === 'del'){
		window.top.delete_c(obj,iname);
	}
	if(obj.event === 'back'){
		window.top.back_id(obj,iname);
	}
		
});

//表头操作
table.on('toolbar(list)', function(obj){

	//全选
	if(obj.event==='check_all'){
		$('input[name="layTableCheckbox"]+').click();
	}
	
	//批量属性
	var checkStatus = table.checkStatus(obj.config.id);
	var data = checkStatus.data;
	var idArray = new Array();
	for(j=0,len=data.length; j<len; j++) {
		idArray.push(data[j].id);
	}

	//批量恢复
	if(obj.event==='back'){
		if(data.length==0){
			window.top.tq_alert('请至少选择一条信息','',2);
			return false;
		}
		window.top.back_ids(idArray,iname);
	}

	//批量真删除
	if(obj.event==='list_delete'){
		if(data.length==0){
			window.top.tq_alert('请至少选择一条信息','',2);
			return false;
		}
		window.top.delete_ids(idArray,iname);
	}


});

//监听状态操作
form.on('switch(is_effect)', function(obj){
	var is_effect=obj.elem.checked==true?2:1;
	$.post('/admin/Common/is_edit',{id:this.value,is_effect:is_effect,dbname:'images'},function(data){ });
});

form.on('switch(is_new)', function(obj){
	var is_new=obj.elem.checked==true?2:1;

	console.log(this.value);
	$.post('/admin/Common/is_edit',{id:this.value,is_new:is_new,dbname:'images'},function(data){ });
});

  
});
//layui end;


//批量恢复
function back_recycle(info){
	$.post('/admin/Common/list_back',{id:info},function(data){
		window.location.reload();
	});
}

//恢复
function back_id(info){
	$.post('/admin/Common/back_id',{id:info.data.id},function(data){ 
		info.del();
	});
}

//传入三级article页批量删除
function delete_er(info){
	$.post('/admin/Common/list_delete_true',{id:info,table:'article'},function(data){
		window.location.reload();
	});
}

//删除-父级返回
function delete_id(info){
	$.post('/admin/Common/delete_id',{id:info.data.id,table:'article'},function(data){ 
		info.del();
	});
}
</script>