mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-19 23:50:25 +08:00
数据库某些表可以手工清理
This commit is contained in:
@@ -1,2 +1,24 @@
|
||||
{$layout}
|
||||
{$template "menu"}
|
||||
{$template "menu"}
|
||||
|
||||
<div class="ui message" v-if="isLoading">正在加载中...</div>
|
||||
|
||||
<table class="ui table selectable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>表名</th>
|
||||
<th>占用空间</th>
|
||||
<th>用途</th>
|
||||
<th class="two op">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr v-for="table in tables">
|
||||
<td>{{table.name}}</td>
|
||||
<td>{{table.size}}</td>
|
||||
<td>{{table.comment}}</td>
|
||||
<td>
|
||||
<a href="" v-if="table.canDelete" @click.prevent="deleteTable(table.name)">删除</a><span v-if="table.canDelete"> </span>
|
||||
<a href="" v-if="table.canClean" @click.prevent="truncateTable(table.name)">清空</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
49
web/views/@default/settings/database/clean.js
Normal file
49
web/views/@default/settings/database/clean.js
Normal file
@@ -0,0 +1,49 @@
|
||||
Tea.context(function () {
|
||||
this.tables = []
|
||||
this.isLoading = true
|
||||
|
||||
this.$delay(function () {
|
||||
this.reload()
|
||||
})
|
||||
|
||||
this.reload = function () {
|
||||
this.isLoading = true
|
||||
this.$post("$")
|
||||
.success(function (resp) {
|
||||
this.tables = resp.data.tables;
|
||||
})
|
||||
.done(function () {
|
||||
this.isLoading = false
|
||||
})
|
||||
}
|
||||
|
||||
this.deleteTable = function (tableName) {
|
||||
let that = this
|
||||
teaweb.confirm("html:确定要删除此数据表吗?<br/>删除后数据不能恢复!", function () {
|
||||
that.$post(".deleteTable")
|
||||
.params({
|
||||
table: tableName
|
||||
})
|
||||
.success(function () {
|
||||
teaweb.success("操作成功", function () {
|
||||
that.reload()
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
this.truncateTable = function (tableName) {
|
||||
let that = this
|
||||
teaweb.confirm("html:确定要清空此数据表吗?<br/>清空后数据不能恢复!", function () {
|
||||
that.$post(".truncateTable")
|
||||
.params({
|
||||
table: tableName
|
||||
})
|
||||
.success(function () {
|
||||
teaweb.success("操作成功", function () {
|
||||
that.reload()
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user