<?php /*a:3:{s:60:"D:\phpstudy_pro\WWW\2022_09_zscq\view\admin\mysql\index.html";i:1630634070;s:59:"D:\phpstudy_pro\WWW\2022_09_zscq\view\admin\common\top.html";i:1625466448;s:62:"D:\phpstudy_pro\WWW\2022_09_zscq\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-normal layui-btn-xs" lay-event="dowonload">下载</a>
  <a class="layui-btn layui-btn-xs" lay-event="restore">恢复</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="back">备份</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 catepage=Math.floor(true_height/39);
  
  table.render({
    elem: '#list'
	,title:'回收站信息'
    ,url:'<?php echo url("Mysql/list_data"); ?>'
    ,cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
	,even: true
	,toolbar: '#tq_btn'
	,defaultToolbar: ['filter']
	,height: 'full-71'
	,cols: [[
      {field:'name', title: '备份'}
      ,{field:'size', title: '大小',sort:true}
      ,{field:'time', title: '时间',sort:true}
      ,{field:'id', width:166,align:'center',toolbar:'#barDemo', title: '操作'}
    ]]
	,initSort:{
	  field:'time',
	  type:'desc',
	}
  });
  
  
//监听工具条
table.on('tool(list)', function(obj){
	var data = obj.data;
	//删除
	if(obj.event === 'del'){
		window.top.mysql_ck(obj,'是否删除该备份?','del',iname);
	}
	//恢复
	if(obj.event === 'restore'){
		window.top.mysql_ck(obj,'是否恢复为该备份?','restore',iname);
	}
	//下载
	if(obj.event === 'dowonload'){
		window.top.mysql_ck(obj,'是否下载该备份?','dowonload',iname);
	}
		
});

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

	//新建备份
	if(obj.event==='back'){
		window.top.mysql_ck(obj,'是否新建备份?','backup',iname);
	}
	
});
  
});
//layui end;



//新建备份
function mysql_back(info,type){
	if(type=='backup'){
		var name='';
	}else{
		var name=info.data.name;
	}
	if(type=='dowonload'){
		window.location.href="<?php echo url('admin/Mysql/back',array('type'=>'dowonload')); ?>&name="+name+"";
		return false;
	}
	$.post('/admin/Mysql/back',{type:type,name:name},function(data){
		window.top.tq_alert(data.info,1);
		if(type=='backup'){
			setTimeout(function(){ window.location.reload(); },1500);
		}
		if(type=='del'){
			info.del();
		}
	});
}
</script>