Files
orico-official-website-old/app/admin/view/dbmanager/lists.html
2024-10-29 14:04:59 +08:00

162 lines
7.9 KiB
HTML
Executable File

<div class="content-wrapper" id="pjax-container">
<section class="content-header">
<h1>
数据库
<small>数据库中共有<?php echo $tablenums;?>张表,共计<?php echo $total;?></small>
</h1>
</section>
<section class="content">
<div class="row">
<div class="col-md-12">
<div class="box box-primary">
<div class="box-header">
<button type="button" class="btn btn-default btn-sm checkbox-toggle"><i class="fa fa-square-o"></i></button>
<button type="button" class="btn btn-primary btn-sm" data-cod="refresh"> 刷新</button>
<button type="button" class="btn btn-sm btn-primary btn-backupall"><i class="fa fa-download"></i> 全表备份</button>
</div>
<!-- /.box-header -->
<div class="box-body table-responsive no-padding lists-table">
<table class="table table-hover">
<tr>
<th width="35rem"> </th>
<th>ID</th>
<th>数据库表</th>
<th class="text-center">记录条数</th>
<th class="text-center">占用空间</th>
<th class="text-center">编码</th>
<th class="text-center">创建时间</th>
<th class="text-center">说明</th>
<th class="text-center">操作</th>
</tr>
<?php foreach($list as $k=>$table):?>
<tr>
<td><input type="checkbox" name="ids[]" value="<?php echo $table['name'];?>"/></td>
<td><?php echo $k;?></td>
<td><?php echo $table['name'];?></td>
<td class="text-center"><?php echo $table['rows'];?></td>
<td class="text-center"><?php echo $table['size'];?></td>
<td class="text-center"><?php echo $table['collation'];?></td>
<td class="text-center"><?php echo $table['create_time'];?></td>
<td class="text-center"><?php echo $table['comment'];?></td>
<td class="text-center">
<button type="button" class="btn btn-success btn-sm btn-optimize" data-table="<?php echo $table['name'];?>">优化</button>
<button type="button" class="btn btn-info btn-sm btn-repair" data-table="<?php echo $table['name'];?>">修复</button>
<button type="button" class="btn btn-info btn-sm btn-backup" data-table="<?php echo $table['name'];?>">备份</button>
</td>
</tr>
<?php endforeach;?>
</table>
</div>
<div class="box-footer clearfix">
</div>
<!-- /.box-body -->
</div>
</div>
</div>
</section>
<style>
.table thead > tr > td, .table tbody > tr > td {
vertical-align: middle;
}
</style>
<script type="text/javascript">
$(function() {
$(".btn-backupall").bind("click", function(event) {
var that = this;
$(this).tooltip({trigger: 'manual', placement: 'top', html: 'true', title: '<i class="fa fa-spinner fa-spin"></i> 提示!正在处理中...'});
$(this).tooltip('show');
$.ajax({
type: "POST",
url: "<?php echo url('/admin/dbmanager/backupall');?>",
dataType: 'json',
success: function(data, status, xhr) {
if (data.code) {
alert(data.msg);
} else {
alert(data.msg);
}
},
complete: function(xhr, status) {
setTimeout(function() {
$(that).tooltip('hide');
}, 1000);
}
});
});
$(".btn-optimize").bind("click", function(event) {
var that = this;
var tablename = $(this).data('table');
$(this).tooltip({trigger: 'manual', placement: 'top', html: 'true', title: '<i class="fa fa-spinner fa-spin"></i> 提示!正在处理中...'});
$(this).tooltip('show');
$.ajax({
type: "POST",
url: "<?php echo url('/admin/dbmanager/optimize');?>",
data: {'tablename': tablename, 'flag': 0},
dataType: 'json',
success: function(data, status, xhr) {
if (data.code) {
alert(data.msg);
} else {
alert(data.msg);
}
},
complete: function(xhr, status) {
setTimeout(function() {
$(that).tooltip('hide');
}, 1000);
}
});
});
$(".btn-repair").bind("click", function(event) {
var that = this;
var tablename = $(this).data('table');
$(this).tooltip({trigger: 'manual', placement: 'top', html: 'true', title: '<i class="fa fa-spinner fa-spin"></i> 提示!正在处理中...'});
$(this).tooltip('show');
$.ajax({
type: "POST",
url: "<?php echo url('/admin/dbmanager/repair');?>",
data: {'tablename': tablename, 'flag': 0},
dataType: 'json',
success: function(data, status, xhr) {
if (data.code) {
alert(data.msg);
} else {
alert(data.msg);
}
},
complete: function(xhr, status) {
setTimeout(function() {
$(that).tooltip('hide');
}, 1000);
}
});
});
$(".btn-backup").bind("click", function(event) {
var that = this;
var tablename = $(this).data('table');
$(this).tooltip({trigger: 'manual', placement: 'top', html: 'true', title: '<i class="fa fa-spinner fa-spin"></i> 提示!正在处理中...'});
$(this).tooltip('show');
$.ajax({
type: "POST",
url: "<?php echo url('/admin/dbmanager/backup');?>",
data: {'tablename': tablename, 'flag': 0},
dataType: 'json',
success: function(data, status, xhr) {
if (data.code) {
alert(data.msg);
} else {
alert(data.msg);
}
},
complete: function(xhr, status) {
setTimeout(function() {
$(that).tooltip('hide');
}, 1000);
}
});
});
});
</script>
</div>