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

@@ -65,7 +65,7 @@
</template>
<script>
import { get, post ,put} from '@/http'
import { post ,put} from '@/http'
import lodash from 'lodash'
import bus from '@/libs/bus'
@@ -78,29 +78,31 @@ export default {
loading: Boolean,
customTableTitle: Array,
isConfigurations: Boolean,
tableData: Array,
tableData2: Array,
},
data () {
return {
tableData: [
{
retention: '',
state: '',
schedule: {
repeat: '',
stime: '',
type: '',
nums: []
}
}
],
tableData2: [
{
fileName: '',
time: '',
size: ''
}
]
// tableData: [
// {
// retention: '',
// state: '',
// schedule: {
// repeat: '',
// stime: '',
// type: '',
// nums: []
// }
// }
// ],
// tableData2: [
// {
// fileName: '',
// time: '',
// size: ''
// }
// ]
}
},
@@ -108,17 +110,13 @@ export default {
computed: {},
created () {},
mounted () {
this.getTableData()
},
methods: {
Restore(row){
put('/sys/backup/restore',{filename:row.fileName}).then(res=>{
if(res.code == 200){
this.getTableData('backup')
this.$emit('getTableData','backup')
}
})
},
@@ -133,57 +131,9 @@ export default {
getNum(item){
return bus.getNumStr(item)
},
async getTableData (item) {
if(!item){
await 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]
}
}
}
})
await post('/sys/backup/list').then((res) => {
if (res.code === 200) {
if (res.data) {
this.tableData2 = res.data
}
}
})
}else if(item == 'backup'){
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.$forceUpdate();
}else if(item == 'recent'){
post('/sys/backup/list').then((res) => {
if (res.code === 200) {
if (res.data) {
this.tableData2 = res.data
}
}
})
this.$forceUpdate();
}
},
backupNow (item) {
post('/sys/backup').then((res) => {
console.log(res)
// console.log(res)
})
},
edit () {