131 lines
3.5 KiB
HTML
131 lines
3.5 KiB
HTML
{extend name="public:base" /}
|
|
|
|
{block name="body"}
|
|
<div class="layui-fluid">
|
|
<div class="layui-card">
|
|
<div class="layui-card-header layuiadmin-card-header-auto">
|
|
<button class="layui-btn layuiadmin-btn-ledger" data-type="back">备份</button>
|
|
</div>
|
|
|
|
<div class="layui-progress layui-progress-big" lay-showpercent="true" lay-filter="demo">
|
|
<div class="layui-progress-bar layui-bg-red" lay-percent="0%"></div>
|
|
</div>
|
|
|
|
<div class="layui-card-body">
|
|
<table id="LAY-app-content-ledger" lay-filter="LAY-app-content-ledger"></table>
|
|
<script type="text/html" id="toolbarDemo">
|
|
<div class="layui-btn-container">
|
|
<button class="layui-btn layui-btn-sm" lay-event="getCheckData">获取选中行数据</button>
|
|
<button class="layui-btn layui-btn-sm" lay-event="getCheckLength">获取选中数目</button>
|
|
<button class="layui-btn layui-btn-sm" lay-event="isAll">验证是否全选</button>
|
|
</div>
|
|
</script>
|
|
<script type="text/html" id="tao-ledger">
|
|
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>备份</a>
|
|
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="down"><i class="layui-icon layui-icon-edit"></i>下载</a>
|
|
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-edit"></i>删除</a>
|
|
</script>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{/block}
|
|
|
|
{block name="js"}
|
|
<script>
|
|
|
|
layui.config({
|
|
base: '/static/admin/' //静态资源所在路径
|
|
}).extend({
|
|
index: 'lib/index' //主入口模块
|
|
}).use(['index','table','layer','element'], function(){
|
|
|
|
var table = layui.table,
|
|
layer = layui.layer,
|
|
element = layui.element;
|
|
var $ = layui.$;
|
|
|
|
var active = {
|
|
|
|
back: function backup(predate)
|
|
{
|
|
//var index = layer.load();
|
|
$.ajax({
|
|
url: "{:url('admin/Databackup/backup')}",
|
|
type: 'POST', //POST
|
|
async: true, //或false,是否异步
|
|
dataType: 'json',
|
|
data:predate,
|
|
success: function (data) {
|
|
|
|
if (data.totalpercentage >= 100)
|
|
{
|
|
//关闭
|
|
//layer.close(index);
|
|
layer.alert('备份完成', {icon: 1});
|
|
}
|
|
|
|
element.progress('demo', data.totalpercentage+'%');
|
|
|
|
//循环备份
|
|
if (data.totalpercentage < 100)
|
|
{
|
|
backup(data);
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//总帐信息
|
|
table.render({
|
|
elem: '#LAY-app-content-ledger'
|
|
,url: "{:url('admin/Database/index')}" //进列表接口
|
|
,toolbar: '#toolbarDemo' //开启头部工具栏,并为其绑定左侧模板
|
|
,defaultToolbar: ['filter', 'exports', 'print']
|
|
,cols: [[
|
|
{type: 'checkbox', fixed: 'left'}
|
|
,{field:'id', title:'ID', width:80, fixed: 'left', unresize: true, sort: true}
|
|
,{field: 'time', title: '备份时间',width: 180}
|
|
,{field: 'name', title: '备份名', minWidth: 200}
|
|
,{title: '操作', width: 150, align: 'center', toolbar: '#tao-ledger'}
|
|
]]
|
|
,page: true
|
|
,limit: 15
|
|
,limits: [10, 15, 20, 25, 30]
|
|
,text: '对不起,加载出现异常!'
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#back1').on('click',function(){
|
|
|
|
//询问框
|
|
layer.confirm('确定备份?', {
|
|
btn: ['确定','取消'] //按钮
|
|
}, function(){
|
|
console.log(123);
|
|
backup({});
|
|
//layer.msg('的确很重要', {icon: 1});
|
|
|
|
}
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
$('.layui-btn.layuiadmin-btn-ledger').on('click', function(){
|
|
var type = $(this).data('type');
|
|
active[type] ? active[type].call(this) : '';
|
|
});
|
|
});
|
|
</script>
|
|
{/block}
|