|
@ -16,23 +16,9 @@ |
|
|
uploadFile('community'); |
|
|
uploadFile('community'); |
|
|
} |
|
|
} |
|
|
"> |
|
|
"> |
|
|
<el-button size="small" type="text" class="diy-button--other">导入小区数据</el-button> |
|
|
<el-button size="small" type="text" class="diy-button--other">导入小区楼栋数据</el-button> |
|
|
</el-upload> |
|
|
</el-upload> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div class="table-more-btn"> |
|
|
|
|
|
<el-upload :headers="$getElUploadHeaders()" style="text-align: center" ref="upload_building" |
|
|
|
|
|
:multiple="false" :show-file-list="false" :before-upload="(file) => { |
|
|
|
|
|
beforeUpload(file, 'building'); |
|
|
|
|
|
} |
|
|
|
|
|
" action="" accept=".xls,.xlsx" :http-request="() => { |
|
|
|
|
|
uploadFile('building'); |
|
|
|
|
|
} |
|
|
|
|
|
"> |
|
|
|
|
|
<el-button size="small" type="text" class="diy-button--other">导入楼栋数据</el-button> |
|
|
|
|
|
</el-upload> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="table-more-btn"> |
|
|
<div class="table-more-btn"> |
|
|
<el-upload :headers="$getElUploadHeaders()" style="text-align: center" ref="upload_room" |
|
|
<el-upload :headers="$getElUploadHeaders()" style="text-align: center" ref="upload_room" |
|
|
:multiple="false" :show-file-list="false" :before-upload="(file) => { |
|
|
:multiple="false" :show-file-list="false" :before-upload="(file) => { |
|
@ -64,14 +50,14 @@ |
|
|
<div> |
|
|
<div> |
|
|
<el-popover popper-class="btn-popper" placement="bottom" style="margin-left: 10px" width="20" |
|
|
<el-popover popper-class="btn-popper" placement="bottom" style="margin-left: 10px" width="20" |
|
|
trigger="click"> |
|
|
trigger="click"> |
|
|
<div v-if="showImportBtn" class="table-more-btn"> |
|
|
<!-- <div v-if="showImportBtn" class="table-more-btn"> |
|
|
<el-button class="diy-button--other" size="small" type="text" |
|
|
<el-button class="diy-button--other" size="small" type="text" |
|
|
@click="handleExportModule('community')">下载小区模板</el-button> |
|
|
@click="handleExportModule('community')">下载小区模板</el-button> |
|
|
</div> |
|
|
</div> --> |
|
|
|
|
|
|
|
|
<div v-if="showImportBtn" class="table-more-btn"> |
|
|
<div v-if="showImportBtn" class="table-more-btn"> |
|
|
<el-button :headers="$getElUploadHeaders()" class="diy-button--other" size="small" type="text" |
|
|
<el-button :headers="$getElUploadHeaders()" class="diy-button--other" size="small" type="text" |
|
|
@click="handleExportModule('building')">下载楼栋模板</el-button> |
|
|
@click="handleExportModule('building')">下载小区楼栋模板</el-button> |
|
|
</div> |
|
|
</div> |
|
|
<div v-if="showImportBtn" class="table-more-btn"> |
|
|
<div v-if="showImportBtn" class="table-more-btn"> |
|
|
<el-button :headers="$getElUploadHeaders()" class="diy-button--other" size="small" type="text" |
|
|
<el-button :headers="$getElUploadHeaders()" class="diy-button--other" size="small" type="text" |
|
@ -336,6 +322,8 @@ export default { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
queryConditions: [], |
|
|
queryConditions: [], |
|
|
|
|
|
|
|
|
|
|
|
uploadType:null |
|
|
}; |
|
|
}; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
@ -845,20 +833,17 @@ export default { |
|
|
|
|
|
|
|
|
handleExportModule(type) { |
|
|
handleExportModule(type) { |
|
|
let title = ""; |
|
|
let title = ""; |
|
|
let url = ""; |
|
|
let url = "/actual/base/intelligentImportData/autoGenerateExcelModule"; |
|
|
if (type === "community") { |
|
|
let params = { |
|
|
title = "小区导入模板"; |
|
|
importCategory:'' |
|
|
url = "/gov/org/neighborhood/exporttemplate"; |
|
|
}; |
|
|
} else if (type === "building") { |
|
|
if (type === "building") { |
|
|
title = "楼栋导入模板"; |
|
|
title = "楼栋导入模板"; |
|
|
url = "/gov/org/building/exporttemplate"; |
|
|
params.importCategory = 'BUILDING_INFO' |
|
|
} else if (type === "room") { |
|
|
} else if (type === "room") { |
|
|
title = "房屋导入模板"; |
|
|
title = "房屋导入模板"; |
|
|
url = "/gov/org/house/exporttemplate"; |
|
|
params.importCategory = 'HOUSE_INFO' |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
let params = {}; |
|
|
|
|
|
|
|
|
|
|
|
app.ajax.exportFilePost( |
|
|
app.ajax.exportFilePost( |
|
|
url, |
|
|
url, |
|
|
params, |
|
|
params, |
|
@ -1013,6 +998,7 @@ export default { |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
async uploadFile(type) { |
|
|
async uploadFile(type) { |
|
|
|
|
|
this.uploadType = type; |
|
|
if (this.fileName == "") { |
|
|
if (this.fileName == "") { |
|
|
this.$message.warning("请选择要上传的文件!"); |
|
|
this.$message.warning("请选择要上传的文件!"); |
|
|
return false; |
|
|
return false; |
|
@ -1029,7 +1015,7 @@ export default { |
|
|
than.$router.replace('/main/importRecord-index'); |
|
|
than.$router.replace('/main/importRecord-index'); |
|
|
}) |
|
|
}) |
|
|
//清空上传列表 |
|
|
//清空上传列表 |
|
|
let url = ""; |
|
|
let url = "/actual/base/intelligentImportData/uploadFile"; |
|
|
|
|
|
|
|
|
let fileFormData = new FormData(); |
|
|
let fileFormData = new FormData(); |
|
|
fileFormData.append("file", this.files); //filename是键,file是值,就是要传的文件,test.zip是要传的文件名 |
|
|
fileFormData.append("file", this.files); //filename是键,file是值,就是要传的文件,test.zip是要传的文件名 |
|
@ -1042,14 +1028,8 @@ export default { |
|
|
if (type === "community") { |
|
|
if (type === "community") { |
|
|
this.importCommunityLoading = true; |
|
|
this.importCommunityLoading = true; |
|
|
this.$refs["upload_community"].clearFiles(); |
|
|
this.$refs["upload_community"].clearFiles(); |
|
|
url = "/actual/base/communityQuarters/neighborhoodimport"; |
|
|
|
|
|
} else if (type === "building") { |
|
|
|
|
|
this.$refs["upload_building"].clearFiles(); |
|
|
|
|
|
url = "/actual/base/communityBuilding/buildingimport"; |
|
|
|
|
|
this.importBuildingLoading = true; |
|
|
|
|
|
} else if (type === "room") { |
|
|
} else if (type === "room") { |
|
|
this.$refs["upload_room"].clearFiles(); |
|
|
this.$refs["upload_room"].clearFiles(); |
|
|
url = "/actual/base/communityHouse/houseimport"; |
|
|
|
|
|
this.importRoomLoading = true; |
|
|
this.importRoomLoading = true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -1059,6 +1039,7 @@ export default { |
|
|
(data, rspMsg) => { |
|
|
(data, rspMsg) => { |
|
|
if (data.code === 0 && data.msg == "success") { |
|
|
if (data.code === 0 && data.msg == "success") { |
|
|
// this.$message.success('导入成功') |
|
|
// this.$message.success('导入成功') |
|
|
|
|
|
this.checkExtractExcelHead(data.data.fileName,data.data.url,type === 'community'?'BUILDING_INFO':'HOUSE_INFO') |
|
|
} else { |
|
|
} else { |
|
|
// this.$message({ |
|
|
// this.$message({ |
|
|
// showClose: true, |
|
|
// showClose: true, |
|
@ -1073,8 +1054,6 @@ export default { |
|
|
// this.showMessage(rspMsg) |
|
|
// this.showMessage(rspMsg) |
|
|
if (type === "community") { |
|
|
if (type === "community") { |
|
|
this.importCommunityLoading = false; |
|
|
this.importCommunityLoading = false; |
|
|
} else if (type === "building") { |
|
|
|
|
|
this.importBuildingLoading = false; |
|
|
|
|
|
} else if (type === "room") { |
|
|
} else if (type === "room") { |
|
|
this.importRoomLoading = false; |
|
|
this.importRoomLoading = false; |
|
|
} |
|
|
} |
|
@ -1082,8 +1061,6 @@ export default { |
|
|
(rspMsg, data) => { |
|
|
(rspMsg, data) => { |
|
|
if (type === "community") { |
|
|
if (type === "community") { |
|
|
this.importCommunityLoading = false; |
|
|
this.importCommunityLoading = false; |
|
|
} else if (type === "building") { |
|
|
|
|
|
this.importBuildingLoading = false; |
|
|
|
|
|
} else if (type === "room") { |
|
|
} else if (type === "room") { |
|
|
this.importRoomLoading = false; |
|
|
this.importRoomLoading = false; |
|
|
} |
|
|
} |
|
@ -1092,7 +1069,41 @@ export default { |
|
|
{ headers: { "Content-Type": "multipart/form-data" } } |
|
|
{ headers: { "Content-Type": "multipart/form-data" } } |
|
|
); |
|
|
); |
|
|
}, |
|
|
}, |
|
|
|
|
|
async checkExtractExcelHead(originFileName,originalFilePath,importCategory) { |
|
|
|
|
|
const url = "/actual/base/intelligentImportData/extractExcelHead"; |
|
|
|
|
|
let params = { |
|
|
|
|
|
originFileName, |
|
|
|
|
|
originalFilePath, |
|
|
|
|
|
importCategory, |
|
|
|
|
|
}; |
|
|
|
|
|
const { data, code, msg } = await requestPost(url, params); |
|
|
|
|
|
if (code === 0) { |
|
|
|
|
|
this.fileCode = data.fileCode; |
|
|
|
|
|
this.saveImportResiHouseExcel(originFileName) |
|
|
|
|
|
} else if (code >= 8000) { |
|
|
|
|
|
this.$message.err(msg); |
|
|
|
|
|
this.dataListLoading = false; |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
async saveImportResiHouseExcel(originFileName) { |
|
|
|
|
|
const { fileCode ,uploadType} = this; |
|
|
|
|
|
const formData = new FormData(); |
|
|
|
|
|
let json = uploadType === 'community'?'{"所属社区":"所属社区","所属网格":"所属网格","所属小区":"所属小区","所属楼栋":"所属楼栋","所属单元":"所属单元","门牌号":"门牌号","姓名":"居民姓名","联系电话":"联系电话","证件号":"证件号","低保类别":"低保类型","因病":"因病","因残":"因残","低收入":"低收入"}':'{"所属网格":"所属网格","所属小区":"所属小区","所属楼栋":"所属楼栋","所属单元":"所属单元","门牌号":"门牌号","房屋类型":"房屋类型","居住用途":"居住用途","房屋状态":"房屋状态","房主姓名":"房主姓名","房主电话":"房主电话","房主身份证":"房主身份证","党员中心户":"党员中心户","五好家庭":"五好家庭","模范之家":"模范之家","功臣之家":"功臣之家","光荣之家":"光荣之家"}' |
|
|
|
|
|
formData.append("columnMateJson", json); |
|
|
|
|
|
formData.append("fileCode", fileCode); |
|
|
|
|
|
formData.append("taskName", originFileName); |
|
|
|
|
|
await this.$http |
|
|
|
|
|
.post( |
|
|
|
|
|
"/actual/base/intelligentImportData/importResiHouseExcel", |
|
|
|
|
|
formData |
|
|
|
|
|
) |
|
|
|
|
|
.then((res) => { |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
.catch((err) => { |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
showMessage(msg) { |
|
|
showMessage(msg) { |
|
|
this.$alert(msg, "操作结果", { |
|
|
this.$alert(msg, "操作结果", { |
|
|
confirmButtonText: "关闭", |
|
|
confirmButtonText: "关闭", |
|
|