123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>layui</title>
- <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css" media="all">
- <script src="__PUBLIC__/layui/layui.js" charset="utf-8"></script>
- </head>
- <body style="padding:10px;">
- <div class="layui-tab">
- <ul class="layui-tab-title">
- <li><a href="{:url('admin/databackup/index')}" class="a_menu">备份</a></li>
- <li class="layui-this">还原</li>
- </ul>
- </div>
- <div class="layui-form" style="margin:20px 0;">
- <table class="layui-table" lay-even="" lay-skin="row" lay-size="sm">
- <colgroup>
- <col width="150">
- <col width="150">
- <col width="150">
- <col width="150">
- <col width="200">
- <col width="200">
- <col width="150">
- </colgroup>
- <thead>
- <tr>
- <th>备份名称</th>
- <th>卷数</th>
- <th>压缩</th>
- <th>数据大小</th>
- <th>备份时间</th>
- <th>状态</th>
- <th>操作</th>
- </tr>
- </thead>
- <tbody>
- {foreach name='list' item='data'}
- <tr>
- <td>{$data.time|date='Ymd-His',###}</td>
- <td>{$data.part}</td>
- <td>{$data.compress}</td>
- <td>{$data.size|format_bytes}</td>
- <td>{$key}</td>
- <td class="status">-</td>
- <td class="action">
- <a class="layui-btn layui-btn-xs db-import" href="{:url('admin/databackup/import',['time'=>$data['time']])}">还原</a>
- <a class="layui-btn layui-btn-xs ajax-get confirm delete" href="javascript:;" time="{$data.time}">删除</a>
- </td>
- </tr>
- {/foreach}
- </tbody>
- <script>
- layui.use(['jquery', 'layer'], function () {
- window.$ = layui.$;
- var layer = layui.layer;
- $(".db-import").click(function () {
- var self = this, status = ".";
- $(this).parent().prevAll('.status').html("").html('等待还原');
- $.get(self.href, success, "json");
- window.onbeforeunload = function () {
- return "正在还原数据库,请不要关闭!"
- }
- return false;
- function success(data) {
- if (data.code == 1) {
- $(self).parent().prev().text(data.msg + '-' + (data.data.start?data.data.start:''));
- if (data.data.part) {
- $.get(self.href,
- {"part": data.data.part, "start": data.data.start},
- success,
- "json"
- );
- } else {
- layer.alert(data.msg);
- //window.onbeforeunload = function(){ return null; }
- }
- } else {
- layer.alert(data.msg);
- }
- }
- });
- // $(".db-import").click(function(){
- // // console.log($(this).parents().find(".status").html() );//正常
- // // console.log($(this).parent().prevAll('.status').html() );
- // var statusem=$(this).parent().prevAll('.status');
- // $(this).parent().prevAll('.status').html("").html('等待还原');
- // thisobj=this;
- // $.post(this.href, function(data){
- // if(data.code==1){
- // // statusem.text(""); // 清空数据
- // // statusem.append('data');
- // // statusem.text("").append('132');
- // // $(this).parent().prevAll('.status').html("").html(data.msg);//error :异常原因无法获取当前节点
- // statusem.html(data.msg);
- // getdbimport(thisobj,data.data);
- // }
- // }, "json");
- // return false;
- // });
- $('.delete').click(function () {
- var time = $(this).attr('time');
- $.ajax({
- url: "{:url('admin/databackup/del')}",
- dataType: 'json',
- data: {time: time},
- success: function (res) {
- layer.msg(res.msg);
- if (res.code == 1) {
- setTimeout(function () {
- location.href = res.url;
- }, 1500)
- }
- }
- })
- })
- });
- </script>
- </table>
- </div>
- </body>
- </html>
|