fix : 修复多次调用接口及其它问题
This commit is contained in:
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user