설명 없음
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.htm 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. {include file="public/layout" /}
  2. <body class="bodystyle" style="cursor: default; -moz-user-select: inherit;">
  3. <div id="append_parent"></div>
  4. <div id="ajaxwaitid"></div>
  5. <div class="page">
  6. {include file="tools/bar" /}
  7. <!-- 操作说明 -->
  8. <div id="explanation" class="explanation">
  9. <div id="checkZoom" class="title"><i class="fa fa-lightbulb-o"></i>
  10. <h4 title="提示相关设置操作时应注意的要点">提示</h4>
  11. <span title="收起提示" id="explanationZoom" style="display: block;"></span>
  12. </div>
  13. <ul>
  14. <li>数据备份功能根据你的选择备份全部数据或指定数据,导出的数据文件可用“数据恢复”功能或 phpMyAdmin 导入</li>
  15. <li>建议定期备份数据库</li>
  16. </ul>
  17. </div>
  18. <div class="flexigrid">
  19. <div class="mDiv">
  20. {eq name="$Think.const.CONTROLLER_NAME.'@export'|is_check_access" value="1"}
  21. <div class="fbutton">
  22. <a id="ing_btn">
  23. <div class="add" title="数据备份" onclick="$('.export_btn').trigger('click');">
  24. <span><i class="fa fa-book"></i><span>数据备份</span></span>
  25. </div>
  26. </a>
  27. </div>
  28. {/eq}
  29. </div>
  30. <div class="hDiv">
  31. <div class="hDivBox">
  32. <table cellspacing="0" cellpadding="0" style="width: 100%">
  33. <thead>
  34. <tr>
  35. <th class="sign w40" axis="col0">
  36. <div class="tc"><input type="checkbox" autocomplete="off" onclick="javascript:$('input[name*=tables]').prop('checked',this.checked);" checked="checked"></div>
  37. </th>
  38. <th abbr="article_title" axis="col3">
  39. <div style="padding-left: 10px;" class="">数据库表</div>
  40. </th>
  41. <th abbr="ac_id" axis="col4" class="w80">
  42. <div class="tc">记录条数</div>
  43. </th>
  44. <th abbr="article_show" axis="col5" class="w80">
  45. <div class="tc">占用空间</div>
  46. </th>
  47. <th abbr="article_time" axis="col6" class="w120">
  48. <div class="tc">编码</div>
  49. </th>
  50. <th abbr="article_time" axis="col6" class="w160">
  51. <div class="tc">创建时间</div>
  52. </th>
  53. <th abbr="article_time" axis="col6" class="w80">
  54. <div class="tc">备份状态</div>
  55. </th>
  56. <th axis="col1" class="w80">
  57. <div class="tc">操作</div>
  58. </th>
  59. </tr>
  60. </thead>
  61. </table>
  62. </div>
  63. </div>
  64. <div class="bDiv" style="height: auto;">
  65. <div id="flexigrid" cellpadding="0" cellspacing="0" border="0">
  66. <form method="post" id="export-form" action="{:url('Tools/export')}">
  67. <table id="tb_flexigrid" style="width: 100%">
  68. <tbody>
  69. {empty name="list"}
  70. <tr>
  71. <td class="no-data" align="center" axis="col0" colspan="50">
  72. <div class="no_row">
  73. <div class="no_pic"><img src="__SKIN__/images/null-data.png"></div>
  74. </div>
  75. </td>
  76. </tr>
  77. {else/}
  78. {foreach name="list" item="vo" key="k" }
  79. <tr data-id="{$vo.Name}">
  80. <td class="sign">
  81. <div class="w40 tc"><input type="checkbox" autocomplete="off" name="tables[]" value="{$vo.Name}" checked="checked"></div>
  82. </td>
  83. <td style="width: 100%">
  84. <div style="padding-left: 10px;">{$vo.Name}</div>
  85. </td>
  86. <td>
  87. <div class="w80 tc">{$vo.Rows}</div>
  88. </td>
  89. <td>
  90. <div class="w80 tc">{$vo.Data_length|format_bytes}</div>
  91. </td>
  92. <td>
  93. <div class="w120 tc">{$vo.Collation}</div>
  94. </td>
  95. <td>
  96. <div class="w160 tc">{$vo.Create_time}</div>
  97. </td>
  98. <td>
  99. <div class="info w80 tc">未备份</div>
  100. </td>
  101. <td>
  102. <div class="w80 tc">
  103. {eq name="$Think.const.CONTROLLER_NAME.'@optimize'|is_check_access" value="1"}
  104. <!-- <a href="{:url('Tools/optimize',array('tablename'=>$vo['Name']))}" class="btn blue"><i class="fa fa-magic"></i>优化</a> -->
  105. {/eq}
  106. {eq name="$Think.const.CONTROLLER_NAME.'@repair'|is_check_access" value="1"}
  107. <a class="btn green" href="{:url('Tools/repair',array('tablename'=>$vo['Name']))}"><i class="fa fa-wrench"></i>修复</a>
  108. {/eq}
  109. </div>
  110. </td>
  111. </tr>
  112. {/foreach}
  113. {/empty}
  114. </tbody>
  115. </table>
  116. </form>
  117. </div>
  118. <div class="iDiv" style="display: none;"></div>
  119. </div>
  120. <div class="tDiv">
  121. <div class="tDiv2">
  122. <div class="fbutton checkboxall">
  123. <input type="checkbox" autocomplete="off" onclick="javascript:$('input[name*=tables]').prop('checked',this.checked);" checked="checked">
  124. </div>
  125. {eq name="$Think.const.CONTROLLER_NAME.'@export'|is_check_access" value="1"}
  126. <div class="fbutton export_btn">
  127. <a id="ing_btn" class="layui-btn layui-btn-primary">
  128. <span>数据备份</span>
  129. </a>
  130. </div>
  131. {/eq}
  132. <div class="fbuttonr" style="margin-right: 15px;">
  133. <div class="total">
  134. <h5>共{$tableNum}条数据,共计{$total}</h5>
  135. </div>
  136. </div>
  137. </div>
  138. <div style="clear:both"></div>
  139. </div>
  140. </div>
  141. </div>
  142. <script>
  143. $(document).ready(function(){
  144. // 表格行点击选中切换
  145. $('#tb_flexigrid >tbody >tr').click(function(){
  146. $(this).toggleClass('trSelected');
  147. });
  148. // 点击刷新数据
  149. $('.fa-refresh').click(function(){
  150. location.href = location.href;
  151. });
  152. });
  153. (function($){
  154. var $form = $("#export-form"), $export = $(".export_btn"), tables
  155. $export.click(function(){
  156. if($("input[name^='tables']:checked").length == 0){
  157. layer.alert('请选中要备份的数据表', {icon: 5, title:false, closeBtn:false});
  158. return false;
  159. }
  160. $export.addClass("disabled");
  161. $export.find('a').html("正在发送备份请求...");
  162. $.post(
  163. "{:url('Tools/export', ['_ajax'=>1])}",
  164. $form.serialize(),
  165. function(res){
  166. if(res.code){
  167. tables = res.tables;
  168. var loading = layer.msg('正在备份表(<font id="upgrade_backup_table">'+res.tab.table+'</font>)……<font id="upgrade_backup_speed">0.01</font>%',
  169. {
  170. icon: 1,
  171. time: 3600000, //1小时后后自动关闭
  172. shade: [0.2] //0.1透明度的白色背景
  173. });
  174. $export.find('a').html(res.msg + "开始备份,请不要关闭本页面!");
  175. backup(res.tab);
  176. window.onbeforeunload = function(){ return "正在备份数据库,请不要关闭!" }
  177. } else {
  178. layer.alert(res.msg, {icon: 5, title:false, closeBtn:false});
  179. $export.removeClass("disabled");
  180. $export.find('a').html("立即备份");
  181. }
  182. },
  183. "json"
  184. );
  185. return false;
  186. });
  187. function backup(tab, status){
  188. status && showmsg(tab.id, "开始备份……(0%)");
  189. $.post("{:url('Tools/export', ['_ajax'=>1])}", tab, function(res){
  190. if(res.code){
  191. if (tab.table) {
  192. showmsg(tab.id, res.msg);
  193. $('#upgrade_backup_table').html(tab.table);
  194. $('#upgrade_backup_speed').html(tab.speed);
  195. $export.find('a').html('初始化成功!正在备份表('+tab.table+')……'+tab.speed+'%,请不要关闭本页面!');
  196. } else {
  197. $export.find('a').html('初始化成功!开始备份……,请不要关闭本页面!');
  198. }
  199. if(!$.isPlainObject(res.tab)){
  200. var loading = layer.msg('备份完成……100%,请不要关闭本页面!',
  201. {
  202. icon: 1,
  203. time: 2000, //1小时后后自动关闭
  204. shade: [0.2] //0.1透明度的白色背景
  205. });
  206. $export.removeClass("disabled");
  207. $export.find('a').html("备份完成……100%,点击重新备份");
  208. setTimeout(function(){
  209. layer.closeAll();
  210. layer.alert('备份成功!', {icon: 6, title:false, closeBtn:false});
  211. }, 1000);
  212. window.onbeforeunload = function(){ return null }
  213. return;
  214. }
  215. setTimeout(function () {
  216. backup(res.tab, tab.id != res.tab.id);
  217. }, 350);
  218. } else {
  219. layer.closeAll();
  220. $export.removeClass("disabled");
  221. $export.find('a').html("立即备份");
  222. }
  223. }, "json");
  224. }
  225. function showmsg(id, msg){
  226. $form.find("input[value=" + tables[id] + "]").closest("tr").find(".info").html(msg);
  227. }
  228. })(jQuery);
  229. </script>
  230. {include file="public/footer" /}