|
|
@ -519,7 +519,16 @@ export default { |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
handleId(res) |
|
|
|
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(() => { |
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
handleDisabled(res) |
|
|
|
this.importTypeList = res |
|
|
|
this.importTypeList = res |
|
|
|
},500) |
|
|
|
},500) |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
@ -581,9 +590,17 @@ export default { |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
saveSuccess() { |
|
|
|
|
|
|
|
this.$message.success('导入成功') |
|
|
|
|
|
|
|
this.getData() |
|
|
|
|
|
|
|
this.importVisible = false |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
this.submited = false |
|
|
|
|
|
|
|
},1000) |
|
|
|
|
|
|
|
}, |
|
|
|
confirmImport(){ |
|
|
|
confirmImport(){ |
|
|
|
if(this.submited) return false |
|
|
|
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('请选择数据') |
|
|
|
if(!checked.length) return this.$message.warning('请选择数据') |
|
|
|
this.submited = true |
|
|
|
this.submited = true |
|
|
@ -607,25 +624,50 @@ export default { |
|
|
|
dataList.push(data.slice(i, i + 2000)) |
|
|
|
dataList.push(data.slice(i, i + 2000)) |
|
|
|
} |
|
|
|
} |
|
|
|
const promiseList = [] |
|
|
|
const promiseList = [] |
|
|
|
dataList.map(e => { |
|
|
|
if (dataList.length > 6) { |
|
|
|
promiseList.push(new Promise((resolve,reject) => { |
|
|
|
dataList.slice(0, 6).map(e => { |
|
|
|
this.$post(this.api.saveTable, e).then(res => { |
|
|
|
promiseList.push(new Promise((resolve,reject) => { |
|
|
|
resolve() |
|
|
|
this.$post(this.api.saveTable, e).then(res => { |
|
|
|
}).catch(res => { |
|
|
|
resolve() |
|
|
|
reject() |
|
|
|
}).catch(res => { |
|
|
|
|
|
|
|
reject() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
})) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
Promise.all(promiseList).then(res => { |
|
|
|
|
|
|
|
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() |
|
|
|
Promise.all(promiseList).then(res => { |
|
|
|
}).catch(err => { |
|
|
|
this.$message.success('导入成功') |
|
|
|
this.submited = false |
|
|
|
this.getData() |
|
|
|
}) |
|
|
|
this.importVisible = false |
|
|
|
}).catch(err => { |
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
this.submited = false |
|
|
|
this.submited = false |
|
|
|
},1000) |
|
|
|
}) |
|
|
|
}).catch(err => { |
|
|
|
} else { |
|
|
|
this.submited = false |
|
|
|
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 { |
|
|
|
} else { |
|
|
|
this.$post(this.api.saveTable, tableIds).then(res => { |
|
|
|
this.$post(this.api.saveTable, tableIds).then(res => { |
|
|
|