|
|
@ -332,7 +332,6 @@ |
|
|
|
> |
|
|
|
<add-form |
|
|
|
ref="ref_add_form" |
|
|
|
:formType="formType" |
|
|
|
@handleComfirm="handleComfirm" |
|
|
|
@handleClose="handleClose" |
|
|
|
></add-form> |
|
|
@ -421,6 +420,8 @@ |
|
|
|
educationList: [], |
|
|
|
nationList: [], |
|
|
|
}, //字典对象 |
|
|
|
importCode:[], |
|
|
|
dataList:[] |
|
|
|
}; |
|
|
|
}, |
|
|
|
computed: { |
|
|
@ -515,15 +516,15 @@ |
|
|
|
}); |
|
|
|
const formData = new FormData(); //FormData对象,添加参数只能通过append('key', value)的形式添加 |
|
|
|
formData.append("file", file.file); //添加文件对象 |
|
|
|
formData.append("fileMode",'SUBSISTENCE_ALLOWANCE'); |
|
|
|
await this.$http |
|
|
|
.post("/actual/base/resiCategorized/disability/import", formData) |
|
|
|
.post("/actual/base/importExcelData/extractExcelHead", 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); |
|
|
|
const { metaListData, fileCode, msg } = res.data.data; |
|
|
|
this.dataList = metaListData; |
|
|
|
// 相等于在for循环中写filter过滤,这样写能够以 O(1) 的时间复杂度获取 itemGroupId 匹配的元素。 |
|
|
|
this.importCode = fileCode; |
|
|
|
this.handleComfirmUpload() |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
console.log("失败", err); |
|
|
@ -531,6 +532,28 @@ |
|
|
|
// 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); |
|
|
@ -597,7 +620,7 @@ |
|
|
|
const url = "/actual/base/resiCategorized/subsistenceAllowance/deleteBatch"; |
|
|
|
const { data, code, msg } = await requestPost(url, id); |
|
|
|
if (code === 0) { |
|
|
|
this.$message.success("取消成功!"); |
|
|
|
this.$message.success("删除成功!"); |
|
|
|
this.getTableData(); |
|
|
|
} else { |
|
|
|
this.$message.error("操作失败!"); |
|
|
@ -622,9 +645,10 @@ |
|
|
|
this.$message.error(msg); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 导出 |
|
|
|
async handleExport() { |
|
|
|
const url = ""; |
|
|
|
const url = "/actual/base/resiCategorized/subsistenceAllowance/export"; |
|
|
|
const { pageSize, pageNo, formData } = this; |
|
|
|
axios({ |
|
|
|
url: window.SITE_CONFIG["apiURL"] + url, |
|
|
|