NEZ-1779 fix : 恢复和删除接口功能实现

This commit is contained in:
zhangxiaolong
2022-04-12 14:34:55 +08:00
parent d2e47d836d
commit 898c0c01dc
2 changed files with 35 additions and 9 deletions

View File

@@ -14,8 +14,8 @@
<div class="col-resize-area"></div> <div class="col-resize-area"></div>
</template> </template>
<template slot-scope="scope" :column="item"> <template slot-scope="scope" :column="item">
<span v-if="item.prop === 'repeat'"> <span v-if="item.prop === 'schedule'">
{{ tableData[0].schedule && tableData[0].schedule.repeat }} {{ tableData[0].schedule && changeType(tableData[0].schedule.type)? changeType(tableData[0].schedule.type):''}}
</span> </span>
<span v-if="item.prop === 'retention'"> <span v-if="item.prop === 'retention'">
{{ tableData[0].retention }} {{ tableData[0].retention }}
@@ -113,15 +113,37 @@ export default {
methods: { methods: {
changeType(item){
if(item == 1){
return this.$t('backup.only')
}else if(item ==2){
return this.$t('backup.Daily')
}else if(item == 3 ){
return this.$t('backup.Weekly')
}else{
return this.$t('backup.Monthly')
}
},
Restore(row){ Restore(row){
put('/sys/backup/restore',{filename:row.fileName}).then(res=>{ put('/sys/backup/restore',{filename:row.fileName}).then(res=>{
if(res.code == 200){ if(res.code == 200){
this.$emit('getTableData','backup') this.$emit("getTableData",'recent')
}else {
this.$message.error(response.msg)
} }
}) })
}, },
del(item){ del(row){
console.log(item); this.$delete('/sys/backup?filename='+row.fileName).then(res=>{
if(res.code == 200){
this.$emit("getTableData",'recent')
}else {
this.$message.error(response.msg)
}
})
}, },
changeDate(item){ changeDate(item){
let time =Date.parse(item) let time =Date.parse(item)

View File

@@ -14,8 +14,9 @@
ref="backupsTable1" ref="backupsTable1"
:custom-table-title="customTableTitle" :custom-table-title="customTableTitle"
:is-configurations="true" :is-configurations="true"
@edit="edit"
:table-data="tableData" :table-data="tableData"
@edit="edit"
> >
</backups-table> </backups-table>
</template> </template>
@@ -38,6 +39,7 @@
:is-configurations="false" :is-configurations="false"
key="backups2" key="backups2"
:table-data2="tableData2" :table-data2="tableData2"
@getTableData="getTableData"
> >
</backups-table> </backups-table>
@@ -62,9 +64,9 @@ export default {
data () { data () {
return { return {
url: '/sys/backup/list', url: '/sys/backup',
customTableTitle: [ customTableTitle: [
{ label: this.$t('backup.schedule'), prop: 'repeat' }, { label: this.$t('backup.schedule'), prop: 'schedule' },
{ label: this.$t('backup.backupRetention'), prop: 'retention' }, { label: this.$t('backup.backupRetention'), prop: 'retention' },
{ label: this.$t('backup.last'), prop: 'last' }, { label: this.$t('backup.last'), prop: 'last' },
{ label: this.$t('backup.Enable'), prop: 'state' } { label: this.$t('backup.Enable'), prop: 'state' }
@@ -107,6 +109,7 @@ export default {
methods: { methods: {
getTableData (item) { getTableData (item) {
console.log(item);
if(!item){ if(!item){
this.$get('/sys/backup').then((res) => { this.$get('/sys/backup').then((res) => {
if (res.code === 200) { if (res.code === 200) {
@@ -149,6 +152,7 @@ export default {
} }
}) })
} }
console.log(this.tableData);
}, },
edit (row) { edit (row) {
this.object = { ...row , this.object = { ...row ,