importlist.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>layui</title>
  6. <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css" media="all">
  7. <script src="__PUBLIC__/layui/layui.js" charset="utf-8"></script>
  8. </head>
  9. <body style="padding:10px;">
  10. <div class="layui-tab">
  11. <ul class="layui-tab-title">
  12. <li><a href="{:url('admin/databackup/index')}" class="a_menu">备份</a></li>
  13. <li class="layui-this">还原</li>
  14. </ul>
  15. </div>
  16. <div class="layui-form" style="margin:20px 0;">
  17. <table class="layui-table" lay-even="" lay-skin="row" lay-size="sm">
  18. <colgroup>
  19. <col width="150">
  20. <col width="150">
  21. <col width="150">
  22. <col width="150">
  23. <col width="200">
  24. <col width="200">
  25. <col width="150">
  26. </colgroup>
  27. <thead>
  28. <tr>
  29. <th>备份名称</th>
  30. <th>卷数</th>
  31. <th>压缩</th>
  32. <th>数据大小</th>
  33. <th>备份时间</th>
  34. <th>状态</th>
  35. <th>操作</th>
  36. </tr>
  37. </thead>
  38. <tbody>
  39. {foreach name='list' item='data'}
  40. <tr>
  41. <td>{$data.time|date='Ymd-His',###}</td>
  42. <td>{$data.part}</td>
  43. <td>{$data.compress}</td>
  44. <td>{$data.size|format_bytes}</td>
  45. <td>{$key}</td>
  46. <td class="status">-</td>
  47. <td class="action">
  48. <a class="layui-btn layui-btn-xs db-import" href="{:url('admin/databackup/import',['time'=>$data['time']])}">还原</a>&nbsp;
  49. <a class="layui-btn layui-btn-xs ajax-get confirm delete" href="javascript:;" time="{$data.time}">删除</a>
  50. </td>
  51. </tr>
  52. {/foreach}
  53. </tbody>
  54. <script>
  55. layui.use(['jquery', 'layer'], function () {
  56. window.$ = layui.$;
  57. var layer = layui.layer;
  58. $(".db-import").click(function () {
  59. var self = this, status = ".";
  60. $(this).parent().prevAll('.status').html("").html('等待还原');
  61. $.get(self.href, success, "json");
  62. window.onbeforeunload = function () {
  63. return "正在还原数据库,请不要关闭!"
  64. }
  65. return false;
  66. function success(data) {
  67. if (data.code == 1) {
  68. $(self).parent().prev().text(data.msg + '-' + (data.data.start?data.data.start:''));
  69. if (data.data.part) {
  70. $.get(self.href,
  71. {"part": data.data.part, "start": data.data.start},
  72. success,
  73. "json"
  74. );
  75. } else {
  76. layer.alert(data.msg);
  77. //window.onbeforeunload = function(){ return null; }
  78. }
  79. } else {
  80. layer.alert(data.msg);
  81. }
  82. }
  83. });
  84. // $(".db-import").click(function(){
  85. // // console.log($(this).parents().find(".status").html() );//正常
  86. // // console.log($(this).parent().prevAll('.status').html() );
  87. // var statusem=$(this).parent().prevAll('.status');
  88. // $(this).parent().prevAll('.status').html("").html('等待还原');
  89. // thisobj=this;
  90. // $.post(this.href, function(data){
  91. // if(data.code==1){
  92. // // statusem.text(""); // 清空数据
  93. // // statusem.append('data');
  94. // // statusem.text("").append('132');
  95. // // $(this).parent().prevAll('.status').html("").html(data.msg);//error :异常原因无法获取当前节点
  96. // statusem.html(data.msg);
  97. // getdbimport(thisobj,data.data);
  98. // }
  99. // }, "json");
  100. // return false;
  101. // });
  102. $('.delete').click(function () {
  103. var time = $(this).attr('time');
  104. $.ajax({
  105. url: "{:url('admin/databackup/del')}",
  106. dataType: 'json',
  107. data: {time: time},
  108. success: function (res) {
  109. layer.msg(res.msg);
  110. if (res.code == 1) {
  111. setTimeout(function () {
  112. location.href = res.url;
  113. }, 1500)
  114. }
  115. }
  116. })
  117. })
  118. });
  119. </script>
  120. </table>
  121. </div>
  122. </body>
  123. </html>