-
{{$t('login.pin')}}
-
+
{{$t('backup.restorePoint')}}
+
+
+ {{$t('overall.time')}}:
+ {{utcTimeToTimezoneStr(restoreForm.file.time)}}
+
+
+ {{$t('backup.File')}}:
+ {{restoreForm.file.fileName}}
+
+
+ {{$t('overall.remark')}}:
+ {{restoreForm.file.remark}}
+
+
+
{{$t('backup.enterPassword')}}
+
+
+
+
+
{{$t('backup.restoreData')}}
+
{{$t('backup.restoreRestart')}}
+
-
-
-
-
+
+
@@ -121,7 +167,11 @@ export default {
restoreDialog: false,
restoreForm: {
pin: '',
- filename: ''
+ file: {}
+ },
+ backupDialog: false,
+ backupForm: {
+ remark: ''
}
// tableData: [
// {
@@ -158,11 +208,37 @@ export default {
return this.$t('backup.Monthly')
}
},
+ backupConfirm () {
+ this.$store.dispatch('dispatchHomeLoading', true)
+ this.$post('/sys/backup', this.backupForm).then((res) => {
+ this.$store.dispatch('dispatchHomeLoading', false)
+ if (res.code == 200) {
+ this.$message.success(this.$t('backup.backupNow'))
+ bus.$emit('backupNow')
+ } else {
+ this.$message.error(res.msg)
+ }
+ })
+ this.closeBackup()
+ },
+ closeBackup () {
+ this.backupDialog = false
+ this.backupForm = {
+ remark: ''
+ }
+ },
+ backupNow () {
+ this.backupDialog = true
+ },
restoreConfirm () {
this.prevent_opt.save = true
- put('/sys/backup/restore', this.restoreForm).then(res => {
+ const param = {
+ pin: this.restoreForm.pin,
+ filename: this.restoreForm.file.fileName
+ }
+ put('/sys/backup/restore', param).then(res => {
if (res.code == 200) {
- this.closeDialog()
+ this.closeRestore()
this.$emit('getTableData', 'recent')
this.$message.success(this.$t('backup.recoverySuccess'))
} else {
@@ -171,16 +247,16 @@ export default {
this.prevent_opt.save = false
})
},
- closeDialog () {
+ closeRestore () {
this.restoreDialog = false
this.restoreForm = {
pin: '',
- filename: ''
+ file: {}
}
},
restore (row) {
this.restoreDialog = true
- this.restoreForm.filename = row.fileName
+ this.restoreForm.file = row
},
changeDate (item) {
const time = this.utcTimeToTimezoneStr(item)
@@ -190,31 +266,18 @@ export default {
getNum (item) {
return bus.getNumStr(item)
},
- backupNow (item) {
- this.$store.dispatch('dispatchHomeLoading', true)
- this.$post('/sys/backup').then((res) => {
- this.$store.dispatch('dispatchHomeLoading', false)
- if (res.code == 200) {
- this.$message.success(this.$t('backup.backupNow'))
- bus.$emit('backupNow')
- } else {
- this.$message.error(res.msg)
- }
- })
- },
edit () {
this.$emit('edit', this.tableData[0])
},
- tableOperation ([command, row]) {
+ tableOperation ([command, row, param]) {
switch (command) {
- case 'delete': {
- this.$set(row, 'name', row.fileName)
- if (this.singleDelete.length === 0) {
- this.singleDelete.push(row)
- } else {
- this.singleDelete = []
- this.singleDelete.push(row)
- }
+ case 'delete-rel': {
+ row.name = row.fileName
+ this.$store.dispatch('deleteTableRel', {
+ row: row,
+ url: '/sys/backup',
+ ...param
+ })
break
}
case 'restore': {
diff --git a/nezha-fronted/src/components/page/config/backups.vue b/nezha-fronted/src/components/page/config/backups.vue
index 505867011..a74710bd1 100644
--- a/nezha-fronted/src/components/page/config/backups.vue
+++ b/nezha-fronted/src/components/page/config/backups.vue
@@ -8,6 +8,7 @@
:data="tableData"
border
from="backups"
+ :hideDelete="true"
>