From fbfd18d0c0dad0895a9508c57bd32b6cd705cc28 Mon Sep 17 00:00:00 2001 From: mk <2403457699@qq.com> Date: Tue, 2 Jul 2024 14:10:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=BF=E5=B1=8B=E4=BD=BF=E7=94=A8=E6=99=BA?= =?UTF-8?q?=E8=83=BD=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/base/community/communityTable.vue | 95 +++++++++++-------- .../base/smartImport/cpts/executeTask.vue | 2 +- 2 files changed, 54 insertions(+), 43 deletions(-) diff --git a/src/views/modules/base/community/communityTable.vue b/src/views/modules/base/community/communityTable.vue index e0d3427c8..6f0c06ab6 100644 --- a/src/views/modules/base/community/communityTable.vue +++ b/src/views/modules/base/community/communityTable.vue @@ -16,23 +16,9 @@ uploadFile('community'); } "> - 导入小区数据 + 导入小区楼栋数据 - -
- - 导入楼栋数据 - -
-
-
+
下载楼栋模板 + @click="handleExportModule('building')">下载小区楼栋模板
{ if (data.code === 0 && data.msg == "success") { // this.$message.success('导入成功') + this.checkExtractExcelHead(data.data.fileName,data.data.url,type === 'community'?'BUILDING_INFO':'HOUSE_INFO') } else { // this.$message({ // showClose: true, @@ -1073,8 +1054,6 @@ export default { // this.showMessage(rspMsg) if (type === "community") { this.importCommunityLoading = false; - } else if (type === "building") { - this.importBuildingLoading = false; } else if (type === "room") { this.importRoomLoading = false; } @@ -1082,9 +1061,7 @@ export default { (rspMsg, data) => { if (type === "community") { this.importCommunityLoading = false; - } else if (type === "building") { - this.importBuildingLoading = false; - } else if (type === "room") { + } else if (type === "room") { this.importRoomLoading = false; } // this.$message.error(rspMsg) @@ -1092,7 +1069,41 @@ export default { { 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) { this.$alert(msg, "操作结果", { confirmButtonText: "关闭", diff --git a/src/views/modules/base/smartImport/cpts/executeTask.vue b/src/views/modules/base/smartImport/cpts/executeTask.vue index 52551d636..fb8629611 100644 --- a/src/views/modules/base/smartImport/cpts/executeTask.vue +++ b/src/views/modules/base/smartImport/cpts/executeTask.vue @@ -230,7 +230,7 @@ export default { async cancelTask() { let url = "/actual/base/intelligentImportData/cancelTask"; let parm = { - fileCode: this.fileCode, + fileCode: this.fileCode||this.fileCodeRow , taskId: this.taskId, }; let { data, code, msg } = await requestPost(url, parm);