From 7633b946ef59f48602386eee11c72cce7a3c1a2c Mon Sep 17 00:00:00 2001 From: 13176889840 <13176889840@163.com> Date: Thu, 3 Mar 2022 13:46:44 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=AF=BC=E5=85=A5ddd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/communityService/sqzzz/index.vue | 65 ++++++++++++------- .../visual/communityParty/community.vue | 25 +++++-- 2 files changed, 63 insertions(+), 27 deletions(-) diff --git a/src/views/modules/communityService/sqzzz/index.vue b/src/views/modules/communityService/sqzzz/index.vue index c6e74ee5..0524e4f5 100644 --- a/src/views/modules/communityService/sqzzz/index.vue +++ b/src/views/modules/communityService/sqzzz/index.vue @@ -270,34 +270,53 @@ export default { } return fileType && isLt1M; }, - uploadHttpRequest(file) { + async uploadHttpRequest(file) { this.importLoading = true; this.importBtnTitle = "正在上传中..."; + this.$message({ + showClose: true, + message: '导入中,请到系统管理-导入记录中查看进度', + duration: 0 + }) const formData = new FormData(); //FormData对象,添加参数只能通过append('key', value)的形式添加 formData.append("file", file.file); //添加文件对象 - axios({ - url: - window.SITE_CONFIG["apiURL"] + - "/heart/iccommunityselforganization/importcommunityselforganization", - method: "post", - data: formData, - // responseType: "blob", - }) - .then((res) => { - this.importLoading = false; - this.importBtnTitle = "excel导入"; - console.log("resresresresresresres", res); - - this.getTableData(); - if (res.data.code == 0) { - return this.$message.success(res.data.data || "导入成功"); - } else { - return this.$message.error(res.data.msg); - } + await this.$http + .post('/heart/iccommunityselforganization/importcommunityselforganization', formData).then(res => { + console.log('res-up', res) + if (res.data.code == 0 && res.data.msg == 'success') { + this.$message.success('导入成功') + this.getTableData() + } else this.$message.error(res.data.msg) + }).catch(err => { + console.log('失败', err) + file.onError() //上传失败的文件会从文件列表中删除 + this.$message.error('导入失败') }) - .catch((err) => { - console.log("失败", err); - }); + // axios({ + // url: + // window.SITE_CONFIG["apiURL"] + + // "/heart/iccommunityselforganization/importcommunityselforganization", + // method: "post", + // data: formData, + // // responseType: "blob", + // }) + // .then((res) => { + // this.importLoading = false; + // this.importBtnTitle = "excel导入"; + // console.log("resresresresresresres", res); + + // this.getTableData(); + // if (res.data.code == 0) { + // return this.$message.success(res.data.data || "导入成功"); + // } else { + // return this.$message.error(res.data.msg); + // } + // }) + // .catch((err) => { + // console.log("失败", err); + // }); + this.importLoading = false + this.importBtnTitle = 'excel导入' this.$refs.upload.clearFiles(); }, diff --git a/src/views/modules/visual/communityParty/community.vue b/src/views/modules/visual/communityParty/community.vue index b550259b..1146ca2d 100644 --- a/src/views/modules/visual/communityParty/community.vue +++ b/src/views/modules/visual/communityParty/community.vue @@ -36,7 +36,8 @@ prefix-icon="el-icon-caret-bottom" value-format="yyyy-MM-dd HH:mm:ss" :clearable="false" - :default-time="['00:00:00', '23:59:59']"> + :default-time="['00:00:00', '23:59:59']" + @change="handleTimeChange"> @@ -121,6 +122,7 @@