restore.html 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. {include file='common/header' /}
  2. <div class="LM-container">
  3. <div class="LM-main">
  4. <div class="admin-main layui-anim layui-anim-upbit">
  5. <fieldset class="layui-elem-field layui-field-title">
  6. <legend>备份文件{:lang('list')}</legend>
  7. </fieldset>
  8. <table class="layui-table" id="list" lay-filter="list"></table>
  9. </div>
  10. </div>
  11. </div>
  12. {include file="common/footer"/}
  13. <script type="text/html" id="action">
  14. <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="recover">恢复</a>
  15. <a href="{:url('downFile')}?time={{d.time}}" class="layui-btn layui-btn-xs">下载</a>
  16. <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">{:lang('del')}</a>
  17. </script>
  18. <script type="text/html" id="time">
  19. {{layui.util.toDateString(d.time*1000, 'yyyy-MM-dd HH:mm:ss')}}
  20. </script>
  21. <script>
  22. layui.use('table', function() {
  23. var table = layui.table, $ = layui.jquery;
  24. table.render({
  25. elem: '#list'
  26. ,url: '{:url("restore")}',
  27. method:'post'
  28. ,cols: [[
  29. {field:'name', title: '文件名称', width:250},
  30. {field:'size', title: '文件大小', width:200,sort:true},
  31. {field:'time', title: '备份时间', width:200,sort:true,templet: '#time'},
  32. {title:'操作',minWidth:150, toolbar: '#action',align:"center"} , ]]
  33. });
  34. table.on('tool(list)', function(obj) {
  35. var data = obj.data;
  36. if (obj.event === 'recover') {
  37. layer.confirm('确认要导入数据吗?',{icon: 0}, function (index) {
  38. loading = layer.load(1, {shade: [0.1, '#fff']});
  39. $.post("{:url('import')}",{time:data.time},function(res){
  40. layer.close(loading);
  41. if(res.code==1){
  42. layer.msg(res.msg, {time: 1000,icon:1});
  43. }else{
  44. layer.msg(res.msg, {time: 1000,icon:2});
  45. }
  46. });
  47. layer.close(index);
  48. });
  49. }else if(obj.event === 'del'){
  50. layer.confirm('确认要删除该备份文件吗?', {icon: 3}, function (index) {
  51. loading = layer.load(1, {shade: [0.1, '#fff']});
  52. $.post('{:url("delSqlFiles")}',{time: data.time}, function (res) {
  53. layer.close(loading);
  54. if (res.code == 1) {
  55. layer.msg(res.msg, {time: 1000,icon:1});
  56. obj.del();
  57. }else{
  58. layer.msg(res.msg,{time: 1000,icon:2});
  59. }
  60. });
  61. layer.close(index);
  62. });
  63. }
  64. });
  65. });
  66. </script>