From 7ff2b8c9c049f16835225a093dc5024dd84896bb Mon Sep 17 00:00:00 2001 From: 13176889840 <13176889840@163.com> Date: Tue, 9 Nov 2021 15:20:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/modules/base/resi.vue | 42 +++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/src/views/modules/base/resi.vue b/src/views/modules/base/resi.vue index cc50d488..b7f6f7c6 100644 --- a/src/views/modules/base/resi.vue +++ b/src/views/modules/base/resi.vue @@ -24,7 +24,7 @@ :before-upload="beforeExcelUpload" :http-request="uploadHttpRequest" > - 导入人口数据 + {{importBtnTitle}} @@ -233,6 +233,8 @@ export default { }, data() { return { + importBtnTitle: '导入人员数据', + importLoading: false, rowVisible: false, tableLoading: false, btnLoading: false, @@ -392,23 +394,27 @@ export default { return fileType && isLt1M }, uploadHttpRequest(file) { - const formData = new FormData() //FormData对象,添加参数只能通过append('key', value)的形式添加 - formData.append('file', file.file) //添加文件对象 - this.$http - .post('/epmetuser/icresiuser/importExcel', formData) - .then(({ data: res }) => { - // if(res.code === 0) { - // // this.$refs.upload.submit() - // file.onSuccess() - // console.log('res-ooooo---', res) - // } - console.log('res-ooooo---', res) - this.download(res, 'info.xlsx') - }) - .catch( err => { - console.log('失败', err) - param.onError() //上传失败的文件会从文件列表中删除 - }) + this.importLoading = true + this.importBtnTitle = '正在上传中...' + const formData = new FormData() //FormData对象,添加参数只能通过append('key', value)的形式添加 + formData.append('file', file.file) //添加文件对象 + this.$http + .post('/epmetuser/icresiuser/importExcel', formData) + .then(({ data: res }) => { + // if(res.code === 0) { + // // this.$refs.upload.submit() + // file.onSuccess() + // console.log('res-ooooo---', res) + // } + this.importLoading = false + this.importBtnTitle = '导入人员数据' + console.log('res-ooooo---', res) + this.download(res, 'info.xlsx') + }) + .catch( err => { + console.log('失败', err) + param.onError() //上传失败的文件会从文件列表中删除 + }) }, handleClick(tab, event) { console.log(tab, event)