Browse Source

保障房走智能导入

V1.0
mk 2 years ago
parent
commit
851c73b0ea
  1. 79
      src/views/modules/base/residentManagement/housingNature/housingNature.vue

79
src/views/modules/base/residentManagement/housingNature/housingNature.vue

@ -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(); //FormDataappend('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(); //FormDataappend('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 = {"所属网格":"所属网格","所属小区":"所属小区","所属楼栋":"所属楼栋","所属单元":"所属单元","所属房屋":"所属房屋","本地户籍":"本地户籍","居民姓名":"居民姓名","联系电话":"联系电话","国籍":"国籍","证件类型":"证件类型","证件号":"证件号","民族":"民族","备注":"备注","户籍地址":"户籍所在地","现居地址":"现居住地址","房东姓名":"房东姓名","房东身份证号":"房东身份证号","住房性质":"住房性质","领取通知书日期":"领取通知书日期","保障类型":"保障类型","发证日期":"发证日期","补贴编号":"补贴编号","补贴金额":"补贴金额"};
// forfilter, 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();

Loading…
Cancel
Save