|
@@ -4,33 +4,33 @@
|
|
|
<el-select v-model="databaseName" @change="changeSearch" filterable allow-create default-first-option clearable>
|
|
|
<el-option v-for="(item, index) in databaseOptions" :key="index" :label="item" :value="item" />
|
|
|
</el-select>
|
|
|
- <el-button style="margin-left: 20px" size="mini" type="primary" @click="addLog">新增备份</el-button>
|
|
|
- <el-button style="margin-left: 20px" size="mini" type="" @click="clickSearch">刷新</el-button>
|
|
|
- <span style="color: red; font-size: 12px;margin-left: 20px">注意:1、该功能只能在正式环境中使用,其他环境会出现问题;2、存储地址默认是/opt/v70/api/upload,因为映射的关系,在物理机上/mnt/ncs/upload可以找到备份文件;3、因为异步的关系,操作完成需要手动刷新数据。</span>
|
|
|
+ <el-button style="margin-left: 20px" size="mini" type="primary" @click="addLog">{{ this.$t('zy20240205.newBackup') }}</el-button>
|
|
|
+ <el-button style="margin-left: 20px" size="mini" type="" @click="clickSearch">{{ this.$t('zy20240205.flushed') }}</el-button>
|
|
|
+ <span style="color: red; font-size: 12px;margin-left: 20px">{{ this.$t('zy20240205.backupMsg') }}</span>
|
|
|
</div>
|
|
|
<div class="table-wrapper" style="padding-bottom: 10px;padding-left: 10px">
|
|
|
<el-table :data="tableData.data" id="myTableId" stripe border style="width: 100%" ref="refTable" height="520">
|
|
|
<!-- <el-table-column type="selection" width="55"></el-table-column>-->
|
|
|
- <el-table-column prop="database_name" min-width="100" label="数据库" align="center" />
|
|
|
+ <el-table-column prop="database_name" min-width="100" :label="this.$t('zy20240205.database')" align="center" />
|
|
|
<!-- <el-table-column prop="container_name" label="容器名称" min-width="100" align="center" />-->
|
|
|
- <el-table-column prop="backups_path" label="备份地址" min-width="130" align="center" />
|
|
|
- <el-table-column prop="backups_name" label="文件名" min-width="130" align="center" />
|
|
|
- <el-table-column prop="operation" label="操作次数" width="100" align="center" />
|
|
|
- <el-table-column prop="recovery_time" label="恢复时间" width="170" align="center" :formatter="fortDate"/>
|
|
|
- <el-table-column prop="create_time" label="备份时间" width="170" align="center" :formatter="fortDate" />
|
|
|
- <el-table-column prop="state" label="状态" width="100" align="center">
|
|
|
+ <el-table-column prop="backups_path" :label="this.$t('zy20240205.backupAddress')" min-width="130" align="center" />
|
|
|
+ <el-table-column prop="backups_name" :label="this.$t('action.uploadFileName')" min-width="130" align="center" />
|
|
|
+ <el-table-column prop="operation" :label="this.$t('zy20240205.operationsNumber')" width="100" align="center" />
|
|
|
+ <el-table-column prop="recovery_time" :label="this.$t('zy20240205.recoveryTime')" width="170" align="center" :formatter="fortDate"/>
|
|
|
+ <el-table-column prop="create_time" :label="this.$t('zy20240205.backupTime')" width="170" align="center" :formatter="fortDate" />
|
|
|
+ <el-table-column prop="state" :label="this.$t('action.state')" width="100" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-tag v-if="scope.row.status === 0" type="success" disable-transitions>正常</el-tag>
|
|
|
- <el-tag v-if="scope.row.status === 1" type="danger" disable-transitions>文件不存在</el-tag>
|
|
|
+ <el-tag v-if="scope.row.status === 0" type="success" disable-transitions>{{ this.$t('zy20240205.normal') }}</el-tag>
|
|
|
+ <el-tag v-if="scope.row.status === 1" type="danger" disable-transitions>{{ this.$t('zy20240205.fileError') }}</el-tag>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column style="text-align: left;" label="操作" width="120" fixed="right">
|
|
|
+ <el-table-column style="text-align: left;" :label="this.$t('action.handle')" width="120" fixed="right">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button v-if="scope.row.status === 0" type="success" size="mini" @click="handlerEdit(scope.row)">
|
|
|
- 还原
|
|
|
+ {{ this.$t('zy20240205.restore') }}
|
|
|
</el-button>
|
|
|
<el-button v-else type="info" size="mini" @click="handlerDel(scope.row.id)">
|
|
|
- 删除
|
|
|
+ {{ this.$t('action.delete') }}
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -47,10 +47,10 @@
|
|
|
:total="tableData.data_total">
|
|
|
</el-pagination>
|
|
|
</div>
|
|
|
- <el-dialog title="新增备份" :visible.sync="fromDialog" width="700px" :close-on-click-modal="false" :close-on-press-escape="false">
|
|
|
+ <el-dialog :title="this.$t('zy20240205.newBackup')" :visible.sync="fromDialog" width="700px" :close-on-click-modal="false" :close-on-press-escape="false">
|
|
|
<el-form :model="myForm" ref="myForm" :rules="formRules" label-width="140px">
|
|
|
- <el-form-item label="数据库" prop="database_name">
|
|
|
- <el-select v-model="myForm.database_name" filterable allow-create default-first-option placeholder="请选择或输入数据库">
|
|
|
+ <el-form-item :label="this.$t('zy20240205.database')" prop="database_name">
|
|
|
+ <el-select v-model="myForm.database_name" filterable allow-create default-first-option :placeholder="this.$t('zy20240205.inputDatabaseMsg')">
|
|
|
<el-option v-for="(item, index) in databaseOptions" :key="index" :label="item" :value="item"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
@@ -63,8 +63,8 @@
|
|
|
<!-- <el-form-item v-if="myForm.bool_docker" label="容器名称" prop="container_name">-->
|
|
|
<!-- <el-input v-model="myForm.container_name" placeholder="默认mysql" />-->
|
|
|
<!-- </el-form-item>-->
|
|
|
- <el-form-item label="备份地址" prop="backups_path">
|
|
|
- <el-input v-model="myForm.backups_path" placeholder="请输入备份地址" clearable />
|
|
|
+ <el-form-item :label="this.$t('zy20240205.backupAddress')" prop="backups_path">
|
|
|
+ <el-input v-model="myForm.backups_path" :placeholder="this.$t('zy20240205.inputBackupAddress')" clearable />
|
|
|
</el-form-item>
|
|
|
<!-- <el-form-item label="mysql服务器地址">-->
|
|
|
<!-- <el-input v-model="myForm.mysql_ip" placeholder="mysql服务器地址" />-->
|
|
@@ -73,8 +73,8 @@
|
|
|
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
- <el-button @click="fromDialog = false">取 消</el-button>
|
|
|
- <el-button type="primary" @click="handleConfirm">确 定</el-button>
|
|
|
+ <el-button @click="fromDialog = false">{{ this.$t('action.cancel') }}</el-button>
|
|
|
+ <el-button type="primary" @click="handleConfirm">{{ this.$t('action.yes') }}</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
@@ -107,10 +107,10 @@ export default {
|
|
|
bool_docker: false
|
|
|
},
|
|
|
formRules: {
|
|
|
- database_name: [{ required: true, message: '请选择或输入数据库', trigger: 'change' }],
|
|
|
- container_name: [{ required: true, message: '请输入容器名称', trigger: 'blur' }],
|
|
|
- backups_path: [{ required: true, message: '请输入文件存储地址', trigger: 'blur' }],
|
|
|
- mysql_ip: [{ required: true, message: '请输入mysql服务器地址', trigger: 'blur' }]
|
|
|
+ database_name: [{ required: true, message: this.$t('zy20240205.inputDatabaseMsg'), trigger: 'change' }],
|
|
|
+ container_name: [{ required: true, message: this.$t('zy20240205.inputContainerName'), trigger: 'blur' }],
|
|
|
+ backups_path: [{ required: true, message: this.$t('zy20240205.inputFileAddress'), trigger: 'blur' }],
|
|
|
+ mysql_ip: [{ required: true, message: this.$t('zy20240205.inputMysqlAddress'), trigger: 'blur' }]
|
|
|
},
|
|
|
databaseOptions:['wdkl_ncs', 'wdkl_nfc', 'kea'],
|
|
|
databaseName: '',
|
|
@@ -146,14 +146,14 @@ export default {
|
|
|
},
|
|
|
/** 点击每页显示数量 **/
|
|
|
fortDate(row, column, cellValue, index) {
|
|
|
- if (!cellValue) return '暂无'
|
|
|
+ if (!cellValue) return this.$t('customerManage.null')
|
|
|
return unix2Date(cellValue * 1000)
|
|
|
},
|
|
|
handlerEdit(row) {
|
|
|
- console.log('还原....',row)
|
|
|
- this.$confirm('您确定要恢复还原吗?', '警告', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
+ console.log(this.$t('zy20240205.restoreMsg'), row)
|
|
|
+ this.$confirm(this.$t('zy20240205.restoreMsg2'), this.$t('action.waring'), {
|
|
|
+ confirmButtonText: this.$t('action.yes'),
|
|
|
+ cancelButtonText: this.$t('action.cancel'),
|
|
|
type: 'warning'
|
|
|
}).then(() => {
|
|
|
// if (row.mysql_ip === this.API_GetIP()) {
|
|
@@ -171,14 +171,14 @@ export default {
|
|
|
// })
|
|
|
// }
|
|
|
}).catch(() => {
|
|
|
- console.log('取消删除')
|
|
|
+ console.log(this.$t('action.cancelDelete'))
|
|
|
})
|
|
|
},
|
|
|
/** 单条数据删除处理 */
|
|
|
handlerDel(ids) {
|
|
|
- this.$confirm('删除操作后数据不可复原,您确定要删除此数据?', '警告', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
+ this.$confirm(this.$t('zy20240205.deleteSqlMsg'), this.$t('action.waring'), {
|
|
|
+ confirmButtonText: this.$t('action.yes'),
|
|
|
+ cancelButtonText: this.$t('action.cancel'),
|
|
|
type: 'warning'
|
|
|
}).then(() => {
|
|
|
API_MysqlBackups.remove(ids).then(
|
|
@@ -186,12 +186,12 @@ export default {
|
|
|
this.GET_List()
|
|
|
this.$message({
|
|
|
type: 'success',
|
|
|
- message: '删除成功!'
|
|
|
+ message: this.$t('action.cancel')
|
|
|
})
|
|
|
}
|
|
|
)
|
|
|
}).catch(() => {
|
|
|
- console.log('取消删除')
|
|
|
+ console.log(this.$t('action.cancelDelete'))
|
|
|
})
|
|
|
},
|
|
|
handleConfirm() {
|
|
@@ -205,7 +205,7 @@ export default {
|
|
|
_this.$message.info(res.message)
|
|
|
})
|
|
|
} else {
|
|
|
- this.$message.error('表单填写有误,请检查!')
|
|
|
+ this.$message.error(this.$t('action.fromError'))
|
|
|
}
|
|
|
})
|
|
|
},
|