fix : 修复多次调用接口及其它问题

This commit is contained in:
zhangxiaolong
2022-04-11 16:01:36 +08:00
parent 1ab110ad20
commit d2e47d836d
3 changed files with 85 additions and 98 deletions

View File

@@ -15,6 +15,7 @@
:custom-table-title="customTableTitle"
:is-configurations="true"
@edit="edit"
:table-data="tableData"
>
</backups-table>
</template>
@@ -35,6 +36,9 @@
ref="backupsTable2"
:custom-table-title="customTableTitle2"
:is-configurations="false"
key="backups2"
:table-data2="tableData2"
>
</backups-table>
</template>
@@ -60,7 +64,7 @@ export default {
url: '/sys/backup/list',
customTableTitle: [
{ label: this.$t('backup.frequency'), prop: 'repeat' },
{ label: this.$t('backup.schedule'), prop: 'repeat' },
{ label: this.$t('backup.backupRetention'), prop: 'retention' },
{ label: this.$t('backup.last'), prop: 'last' },
{ label: this.$t('backup.Enable'), prop: 'state' }
@@ -96,9 +100,56 @@ export default {
created () {},
mounted () {},
mounted () {
this.getTableData()
},
methods: {
getTableData (item) {
if(!item){
this.$get('/sys/backup').then((res) => {
if (res.code === 200) {
if (res.data) {
this.tableData[0].retention = res.data.retention
this.tableData[0].state = res.data.state == 1? true :false
for (const i in res.data.schedule) {
this.tableData[0].schedule[i] = res.data.schedule[i]
}
}
}
})
this.$post('/sys/backup/list').then((res) => {
if (res.code === 200) {
if (res.data) {
this.tableData2 = res.data
}
}
})
}else if(item == 'backup'){
this.$get('/sys/backup').then((res) => {
if (res.code === 200) {
if (res.data) {
this.tableData[0].retention = res.data.retention
this.tableData[0].state = res.data.state == 1? true :false
for (const i in res.data.schedule) {
this.tableData[0].schedule[i] = res.data.schedule[i]
}
}
}
})
}else if(item == 'recent'){
this.$post('/sys/backup/list').then((res) => {
if (res.code === 200) {
if (res.data) {
this.tableData2 = res.data
}
}
})
}
},
edit (row) {
this.object = { ...row ,
checkDay:'',
@@ -115,7 +166,7 @@ export default {
},
closeRightBox (refresh) {
if (refresh) {
this.$refs.backupsTable1.getTableData('backup')
this.getTableData('backup')
}
this.rightBoxshow = false
},