新增数据修复

dev
Jo 3 years ago
parent 13b26d6c13
commit 12b6070cb4
  1. 56
      src/views/data/Framework.vue

@ -519,7 +519,16 @@ export default {
})
}
handleId(res)
function handleDisabled (list) {
list.map(e => {
if (e.children && e.children.length) {
if (e.children.every(e => e.disabled)) e.disabled = true
handleDisabled(e.children)
}
})
}
setTimeout(() => {
handleDisabled(res)
this.importTypeList = res
},500)
}).catch(res => {})
@ -581,9 +590,17 @@ export default {
}).catch(res => {})
})
},
saveSuccess() {
this.$message.success('导入成功')
this.getData()
this.importVisible = false
setTimeout(() => {
this.submited = false
},1000)
},
confirmImport(){
if(this.submited) return false
const checked = this.$refs.typeTree.getCheckedNodes() //
const checked = this.$refs.typeTree.getCheckedNodes().filter(e => !e.disabled) //
//
if(!checked.length) return this.$message.warning('请选择数据')
this.submited = true
@ -607,7 +624,8 @@ export default {
dataList.push(data.slice(i, i + 2000))
}
const promiseList = []
dataList.map(e => {
if (dataList.length > 6) {
dataList.slice(0, 6).map(e => {
promiseList.push(new Promise((resolve,reject) => {
this.$post(this.api.saveTable, e).then(res => {
resolve()
@ -617,15 +635,39 @@ export default {
}))
})
Promise.all(promiseList).then(res => {
this.$message.success('导入成功')
this.getData()
this.importVisible = false
setTimeout(() => {
dataList.slice(6).map(e => {
promiseList.push(new Promise((resolve,reject) => {
this.$post(this.api.saveTable, e).then(res => {
resolve()
}).catch(res => {
reject()
})
}))
})
Promise.all(promiseList).then(res => {
this.saveSuccess()
}).catch(err => {
this.submited = false
},1000)
})
}).catch(err => {
this.submited = false
})
} else {
dataList.map(e => {
promiseList.push(new Promise((resolve,reject) => {
this.$post(this.api.saveTable, e).then(res => {
resolve()
}).catch(res => {
reject()
})
}))
})
Promise.all(promiseList).then(res => {
this.saveSuccess()
}).catch(err => {
this.submited = false
})
}
})
} else {
this.$post(this.api.saveTable, tableIds).then(res => {

Loading…
Cancel
Save