123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- {include file="public/layout" /}
- <body class="bodystyle" style="cursor: default; -moz-user-select: inherit;">
- <div id="append_parent"></div>
- <div id="ajaxwaitid"></div>
- <div class="page">
- {include file="tools/bar" /}
- <!-- 操作说明 -->
- <div id="explanation" class="explanation" style="color: rgb(44, 188, 163); background-color: rgb(237, 251, 248); width: 99%; height: 100%;">
- <div id="checkZoom" class="title"><i class="fa fa-lightbulb-o"></i>
- <h4 title="提示相关设置操作时应注意的要点">操作提示</h4>
- <span title="收起提示" id="explanationZoom" style="display: block;"></span>
- </div>
- <ul>
- <li>数据备份功能根据你的选择备份全部数据或指定数据,导出的数据文件可用“数据恢复”功能或 phpMyAdmin 导入</li>
- <li>建议定期备份数据库</li>
- </ul>
- </div>
- <div class="flexigrid">
- <div class="mDiv">
- <div class="ftitle">
- <h3>数据库表列表</h3>
- <h5>(共{$tableNum}条数据,共计{$total})</h5>
- </div>
- <div title="刷新数据" class="pReload"><i class="fa fa-refresh"></i></div>
- </div>
- <div class="hDiv">
- <div class="hDivBox">
- <table cellspacing="0" cellpadding="0" style="width: 100%">
- <thead>
- <tr>
- <th class="sign w40" axis="col0">
- <div class="tc">选择</div>
- </th>
- <th abbr="article_title" axis="col3">
- <div style="padding-left: 10px;" class="">数据库表</div>
- </th>
- <th abbr="ac_id" axis="col4" class="w80">
- <div class="tc">记录条数</div>
- </th>
- <th abbr="article_show" axis="col5" class="w80">
- <div class="tc">占用空间</div>
- </th>
- <th abbr="article_time" axis="col6" class="w120">
- <div class="tc">编码</div>
- </th>
- <th abbr="article_time" axis="col6" class="w160">
- <div class="tc">创建时间</div>
- </th>
- <th abbr="article_time" axis="col6" class="w80">
- <div class="tc">备份状态</div>
- </th>
- <th axis="col1" class="w80">
- <div class="tc">操作</div>
- </th>
- </tr>
- </thead>
- </table>
- </div>
- </div>
- <div class="bDiv" style="height: auto;">
- <div id="flexigrid" cellpadding="0" cellspacing="0" border="0">
- <form method="post" id="export-form" action="{:url('Tools/export')}">
- <table id="tb_flexigrid" style="width: 100%">
- <tbody>
- {empty name="list"}
- <tr>
- <td class="no-data" align="center" axis="col0" colspan="50">
- <i class="fa fa-exclamation-circle"></i>没有符合条件的记录
- </td>
- </tr>
- {else/}
- {foreach name="list" item="vo" key="k" }
- <tr data-id="{$vo.Name}">
- <td class="sign">
- <div class="w40 tc"><input type="checkbox" name="tables[]" value="{$vo.Name}" checked="checked"></div>
- </td>
- <td style="width: 100%">
- <div style="padding-left: 10px;">{$vo.Name}</div>
- </td>
- <td>
- <div class="w80 tc">{$vo.Rows}</div>
- </td>
- <td>
- <div class="w80 tc">{$vo.Data_length|format_bytes}</div>
- </td>
- <td>
- <div class="w120 tc">{$vo.Collation}</div>
- </td>
- <td>
- <div class="w160 tc">{$vo.Create_time}</div>
- </td>
- <td>
- <div class="info w80 tc">未备份</div>
- </td>
- <td>
- <div class="w80 tc">
- {eq name="$Think.const.CONTROLLER_NAME.'@optimize'|is_check_access" value="1"}
- <!-- <a href="{:url('Tools/optimize',array('tablename'=>$vo['Name']))}" class="btn blue"><i class="fa fa-magic"></i>优化</a> -->
- {/eq}
- {eq name="$Think.const.CONTROLLER_NAME.'@repair'|is_check_access" value="1"}
- <a class="btn green" href="{:url('Tools/repair',array('tablename'=>$vo['Name']))}"><i class="fa fa-wrench"></i>修复</a>
- {/eq}
- </div>
- </td>
-
- </tr>
- {/foreach}
- {/empty}
- </tbody>
- </table>
- </form>
- </div>
- <div class="iDiv" style="display: none;"></div>
- </div>
- <div class="tDiv">
- <div class="tDiv2">
- <div class="fbutton checkboxall">
- <input type="checkbox" onclick="javascript:$('input[name*=tables]').prop('checked',this.checked);" checked="checked">
- </div>
- {eq name="$Think.const.CONTROLLER_NAME.'@export'|is_check_access" value="1"}
- <div class="fbutton">
- <a id="ing_btn">
- <div class="add" title="数据备份">
- <span><i class="fa fa-book"></i><span id="export">数据备份</span></span>
- </div>
- </a>
- </div>
- {/eq}
- </div>
- <div style="clear:both"></div>
- </div>
- </div>
- </div>
- <script>
- $(document).ready(function(){
- // 表格行点击选中切换
- $('#tb_flexigrid >tbody >tr').click(function(){
- $(this).toggleClass('trSelected');
- });
- // 点击刷新数据
- $('.fa-refresh').click(function(){
- location.href = location.href;
- });
- });
- (function($){
- var $form = $("#export-form"), $export = $("#export"), tables
- $export.click(function(){
- if($("input[name^='tables']:checked").length == 0){
- layer.alert('请选中要备份的数据表', {icon: 2, title:false});
- return false;
- }
- $export.addClass("disabled");
- $export.html("正在发送备份请求...");
- $.post(
- "{:url('Tools/export', ['_ajax'=>1])}",
- $form.serialize(),
- function(res){
- if(res.status){
- tables = res.tables;
- var loading = layer.msg('正在备份表(<font id="upgrade_backup_table">'+res.tab.table+'</font>)……<font id="upgrade_backup_speed">0.01</font>%',
- {
- icon: 1,
- time: 3600000, //1小时后后自动关闭
- shade: [0.2] //0.1透明度的白色背景
- });
- $export.html(res.info + "开始备份,请不要关闭本页面!");
- backup(res.tab);
- window.onbeforeunload = function(){ return "正在备份数据库,请不要关闭!" }
- } else {
- layer.alert(res.info, {icon: 2, title:false});
- $export.removeClass("disabled");
- $export.html("立即备份");
- }
- },
- "json"
- );
- return false;
- });
- function backup(tab, status){
- status && showmsg(tab.id, "开始备份……(0%)");
- $.post("{:url('Tools/export', ['_ajax'=>1])}", tab, function(data){
- if(data.status){
- if (tab.table) {
- showmsg(tab.id, data.info);
- $('#upgrade_backup_table').html(tab.table);
- $('#upgrade_backup_speed').html(tab.speed);
- $export.html('初始化成功!正在备份表('+tab.table+')……'+tab.speed+'%,请不要关闭本页面!');
- } else {
- $export.html('初始化成功!开始备份……,请不要关闭本页面!');
- }
- if(!$.isPlainObject(data.tab)){
- var loading = layer.msg('备份完成……100%,请不要关闭本页面!',
- {
- icon: 1,
- time: 2000, //1小时后后自动关闭
- shade: [0.2] //0.1透明度的白色背景
- });
- $export.removeClass("disabled");
- $export.html("备份完成……100%,点击重新备份");
- setTimeout(function(){
- layer.closeAll();
- layer.alert('备份成功!', {icon: 6, title:false});
- }, 1000);
- window.onbeforeunload = function(){ return null }
- return;
- }
- backup(data.tab, tab.id != data.tab.id);
- } else {
- layer.closeAll();
- $export.removeClass("disabled");
- $export.html("立即备份");
- }
- }, "json");
- }
- function showmsg(id, msg){
- $form.find("input[value=" + tables[id] + "]").closest("tr").find(".info").html(msg);
- }
- })(jQuery);
- </script>
- {include file="public/footer" /}
|