|
@ -270,34 +270,53 @@ export default { |
|
|
} |
|
|
} |
|
|
return fileType && isLt1M; |
|
|
return fileType && isLt1M; |
|
|
}, |
|
|
}, |
|
|
uploadHttpRequest(file) { |
|
|
async uploadHttpRequest(file) { |
|
|
this.importLoading = true; |
|
|
this.importLoading = true; |
|
|
this.importBtnTitle = "正在上传中..."; |
|
|
this.importBtnTitle = "正在上传中..."; |
|
|
|
|
|
this.$message({ |
|
|
|
|
|
showClose: true, |
|
|
|
|
|
message: '导入中,请到系统管理-导入记录中查看进度', |
|
|
|
|
|
duration: 0 |
|
|
|
|
|
}) |
|
|
const formData = new FormData(); //FormData对象,添加参数只能通过append('key', value)的形式添加 |
|
|
const formData = new FormData(); //FormData对象,添加参数只能通过append('key', value)的形式添加 |
|
|
formData.append("file", file.file); //添加文件对象 |
|
|
formData.append("file", file.file); //添加文件对象 |
|
|
axios({ |
|
|
await this.$http |
|
|
url: |
|
|
.post('/heart/iccommunityselforganization/importcommunityselforganization', formData).then(res => { |
|
|
window.SITE_CONFIG["apiURL"] + |
|
|
console.log('res-up', res) |
|
|
"/heart/iccommunityselforganization/importcommunityselforganization", |
|
|
if (res.data.code == 0 && res.data.msg == 'success') { |
|
|
method: "post", |
|
|
this.$message.success('导入成功') |
|
|
data: formData, |
|
|
this.getTableData() |
|
|
// responseType: "blob", |
|
|
} else this.$message.error(res.data.msg) |
|
|
}) |
|
|
}).catch(err => { |
|
|
.then((res) => { |
|
|
console.log('失败', err) |
|
|
this.importLoading = false; |
|
|
file.onError() //上传失败的文件会从文件列表中删除 |
|
|
this.importBtnTitle = "excel导入"; |
|
|
this.$message.error('导入失败') |
|
|
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) => { |
|
|
// axios({ |
|
|
console.log("失败", err); |
|
|
// 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(); |
|
|
this.$refs.upload.clearFiles(); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|