diff --git a/src/views/modules/base/residentManagement/veteran/veteran.vue b/src/views/modules/base/residentManagement/veteran/veteran.vue index ecbfb1431..a8f33c877 100644 --- a/src/views/modules/base/residentManagement/veteran/veteran.vue +++ b/src/views/modules/base/residentManagement/veteran/veteran.vue @@ -650,6 +650,9 @@ export default { nationList: [], educationList: [], }, //字典对象 + + importCode:'', + dataList :[] }; }, computed: { @@ -841,7 +844,7 @@ export default { const { metaListData, fileCode, msg } = res.data.data; this.dataList = metaListData; // 相等于在for循环中写filter过滤,这样写能够以 O(1) 的时间复杂度获取 itemGroupId 匹配的元素。 - this.importCode = fileCode; + this.importCode = fileCode; this.handleComfirmUpload() }) .catch((err) => { @@ -850,6 +853,28 @@ export default { // 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 = "导入"; + }, // 导出 async handleExport() { const url = "/actual/base/resiCategorized/veteran/export"; diff --git a/src/views/modules/base/residentManagement/volunteer/volunteer.vue b/src/views/modules/base/residentManagement/volunteer/volunteer.vue index 1a6a9a542..c370bba08 100644 --- a/src/views/modules/base/residentManagement/volunteer/volunteer.vue +++ b/src/views/modules/base/residentManagement/volunteer/volunteer.vue @@ -524,6 +524,9 @@ export default { volunteerList:[], hobbyList:[] }, //字典对象 + + importCode:'', + dataList :[] }; }, computed: { @@ -640,6 +643,28 @@ export default { // 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) { console.log(this.formData);