From f781780a5bf5ffe4c19dcf5acdfe172994bc4036 Mon Sep 17 00:00:00 2001 From: Jo <479214531@qq.com> Date: Wed, 24 Nov 2021 01:15:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=96=B0=E5=A2=9E=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/data/Framework.vue | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/views/data/Framework.vue b/src/views/data/Framework.vue index 930e3e3..e1a1a4c 100644 --- a/src/views/data/Framework.vue +++ b/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) // 先筛选出分类id,再获取分类真正的id 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 }) })