index.htm 11 KB

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