|
|
@ -287,36 +287,58 @@ export default { |
|
|
|
} |
|
|
|
return fileType && isLt1M; |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
async uploadHttpRequest(file) { |
|
|
|
this.$message({ |
|
|
|
showClose: true, |
|
|
|
dangerouslyUseHTMLString: true, |
|
|
|
message: |
|
|
|
"导入中,请到系统管理-<a id='clickA' style='cursor: pointer;'>导入记录</a>中查看进度", |
|
|
|
duration: 3000, |
|
|
|
}); |
|
|
|
let than = this; |
|
|
|
document.getElementById("clickA").addEventListener("click", function () { |
|
|
|
than.$router.replace("/main/importRecord-index"); |
|
|
|
}); |
|
|
|
const formData = new FormData(); //FormData对象,添加参数只能通过append('key', value)的形式添加 |
|
|
|
formData.append("file", file.file); //添加文件对象 |
|
|
|
await this.$http |
|
|
|
.post("/actual/base/resiHousingNature/import", formData) |
|
|
|
.then((res) => { |
|
|
|
console.log("res-up", res); |
|
|
|
if (res.data.code == 0 && res.data.msg == "success") { |
|
|
|
this.$message.success("导入成功"); |
|
|
|
this.getTableData(); |
|
|
|
this.$refs.upload.clearFiles(); |
|
|
|
} else this.$message.error(res.data.msg); |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
console.log("失败", err); |
|
|
|
file.onError(); //上传失败的文件会从文件列表中删除 |
|
|
|
// this.$message.error('导入失败') |
|
|
|
this.$message({ |
|
|
|
showClose: true, |
|
|
|
dangerouslyUseHTMLString: true, |
|
|
|
message: |
|
|
|
"导入中,请到系统管理-<a id='clickA' style='cursor: pointer;'>导入记录</a>中查看进度", |
|
|
|
duration: 3000, |
|
|
|
}); |
|
|
|
let than = this; |
|
|
|
document.getElementById("clickA").addEventListener("click", function () { |
|
|
|
than.$router.replace("/main/importRecord-index"); |
|
|
|
}); |
|
|
|
const formData = new FormData(); //FormData对象,添加参数只能通过append('key', value)的形式添加 |
|
|
|
formData.append("file", file.file); //添加文件对象 |
|
|
|
formData.append("fileMode",'ENSUREHOUSE'); |
|
|
|
await this.$http |
|
|
|
.post("/actual/base/importExcelData/extractExcelHead", formData) |
|
|
|
.then((res) => { |
|
|
|
const { metaListData, fileCode, msg } = res.data.data; |
|
|
|
this.dataList = {"所属网格":"所属网格","所属小区":"所属小区","所属楼栋":"所属楼栋","所属单元":"所属单元","所属房屋":"所属房屋","本地户籍":"本地户籍","居民姓名":"居民姓名","联系电话":"联系电话","国籍":"国籍","证件类型":"证件类型","证件号":"证件号","民族":"民族","备注":"备注","户籍地址":"户籍所在地","现居地址":"现居住地址","房东姓名":"房东姓名","房东身份证号":"房东身份证号","住房性质":"住房性质","领取通知书日期":"领取通知书日期","保障类型":"保障类型","发证日期":"发证日期","补贴编号":"补贴编号","补贴金额":"补贴金额"}; |
|
|
|
// 相等于在for循环中写filter过滤,这样写能够以 O(1) 的时间复杂度获取 itemGroupId 匹配的元素。 |
|
|
|
this.importCode = fileCode; |
|
|
|
this.handleComfirmUpload() |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
console.log("失败", err); |
|
|
|
file.onError(); //上传失败的文件会从文件列表中删除 |
|
|
|
// this.$message.error('导入失败') |
|
|
|
});// |
|
|
|
}, |
|
|
|
async handleComfirmUpload () { |
|
|
|
this.importLoading = true; |
|
|
|
this.importBtnTitle = "正在上传中..."; |
|
|
|
const { importOption, importCode, dataList } = this; |
|
|
|
const formData = new FormData(); |
|
|
|
formData.append("columnMateJson", JSON.stringify(dataList)); |
|
|
|
formData.append("fileCode", importCode); |
|
|
|
await this.$http |
|
|
|
.post("/actual/base/importExcelData/importResiHouseExcel", formData) |
|
|
|
.then((res) => { |
|
|
|
console.log("res-up", res); |
|
|
|
if (res.data.code == 0 && res.data.msg == "success") { |
|
|
|
this.getTableData(); |
|
|
|
} else this.$message.error(res.data.msg); |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
console.log("失败", err); |
|
|
|
file.onError(); //上传失败的文件会从文件列表中删除 |
|
|
|
}); |
|
|
|
this.importLoading = false; |
|
|
|
this.importBtnTitle = "导入"; |
|
|
|
}, |
|
|
|
// 搜索事件 |
|
|
|
handleSearch(val) { |
|
|
@ -356,6 +378,7 @@ export default { |
|
|
|
this.showAdd = false; |
|
|
|
this.showEdit = false; |
|
|
|
}, |
|
|
|
|
|
|
|
// 新增弹出框组件确定事件 |
|
|
|
handleComfirm(type) { |
|
|
|
this.handleClose(); |
|
|
|