数据新增修改

dev
Jo 3 years ago
parent ff1d6c3ce8
commit f781780a5b
  1. 20
      src/views/data/Framework.vue

@ -576,16 +576,32 @@ export default {
const checked = this.$refs.typeTree.getCheckedNodes() //
//
if(!checked.length) return this.$message.warning('请选择数据')
this.submited = true
const typeIds = checked.filter(e => !e.name).map(e => e.realId) // idid
this.getNames(typeIds).then(() => {
this.$post(this.api.saveTable, this.names).then(res => {
const data = this.names
const dataList = []
for (let i = 0, len = data.length; i < len; i += 3000) {
dataList.push(data.slice(i, i + 3000))
}
const promiseList = []
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.$message.success('导入成功')
this.getData()
this.importVisible = false
setTimeout(() => {
this.submited = false
},1000)
}).catch(res => {
}).catch(err => {
this.submited = false
})
})

Loading…
Cancel
Save