|
|
@ -9,7 +9,7 @@ |
|
|
|
<el-card class="resi-card-table"> |
|
|
|
<div class="resi-row-btn"> |
|
|
|
<el-button type="success" size="small" @click="handleAdd">新增</el-button> |
|
|
|
<el-button type="warning" size="small" @click="handleExport">导出</el-button> |
|
|
|
<el-button type="warning" size="small" :loading="exportBtn" @click="handleExport">{{exportBtnTitle}}</el-button> |
|
|
|
<!-- <el-button type="primary" size="small">下载人口模板</el-button> --> |
|
|
|
<el-upload |
|
|
|
ref="upload" |
|
|
@ -216,6 +216,8 @@ export default { |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
exportBtn: false, |
|
|
|
exportBtnTitle: '导出', |
|
|
|
importBtnTitle: '导入人员数据', |
|
|
|
importLoading: false, |
|
|
|
rowVisible: false, |
|
|
@ -314,14 +316,16 @@ export default { |
|
|
|
window.URL.revokeObjectURL(url) |
|
|
|
} |
|
|
|
}, |
|
|
|
handleExport() { |
|
|
|
async handleExport() { |
|
|
|
this.exportBtn = true |
|
|
|
this.exportBtnTitle = '正在导出...' |
|
|
|
let params = { |
|
|
|
formCode: 'resi_base_info', |
|
|
|
conditions: this.conditions |
|
|
|
} |
|
|
|
|
|
|
|
// .post('epmetuser/icresiuser/exportExcel', params) |
|
|
|
axios({ |
|
|
|
await axios({ |
|
|
|
url: window.SITE_CONFIG['apiURL'] + '/epmetuser/icresiuser/exportExcel', |
|
|
|
// url: 'epmetuser/icresiuser/exportExcel', |
|
|
|
method: 'post', |
|
|
@ -329,6 +333,7 @@ export default { |
|
|
|
responseType: 'blob' |
|
|
|
}) |
|
|
|
.then(res => { |
|
|
|
|
|
|
|
console.log('resllll', res) |
|
|
|
let fileName = window.decodeURI(res.headers["content-disposition"].split(";")[1].split("=")[1]) |
|
|
|
console.log('filename', fileName) |
|
|
@ -345,8 +350,10 @@ export default { |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
console.log('获取导出情失败', err) |
|
|
|
return this.$message.error('网络错误') |
|
|
|
this.$message.error('网络错误') |
|
|
|
}) |
|
|
|
this.exportBtnTitle = '导出' |
|
|
|
this.exportBtn = false |
|
|
|
}, |
|
|
|
// 上传大图标成功 |
|
|
|
handleExcelSuccess (res, file) { |
|
|
@ -377,20 +384,19 @@ export default { |
|
|
|
} |
|
|
|
return fileType && isLt1M |
|
|
|
}, |
|
|
|
uploadHttpRequest(file) { |
|
|
|
async uploadHttpRequest(file) { |
|
|
|
this.importLoading = true |
|
|
|
this.importBtnTitle = '正在上传中...' |
|
|
|
const formData = new FormData() //FormData对象,添加参数只能通过append('key', value)的形式添加 |
|
|
|
formData.append('file', file.file) //添加文件对象 |
|
|
|
axios({ |
|
|
|
await axios({ |
|
|
|
url: window.SITE_CONFIG['apiURL'] + '/epmetuser/icresiuser/importExcel', |
|
|
|
method: 'post', |
|
|
|
data: formData, |
|
|
|
responseType: 'blob' |
|
|
|
}) |
|
|
|
.then((res) => { |
|
|
|
this.importLoading = false |
|
|
|
this.importBtnTitle = '导入人员数据' |
|
|
|
|
|
|
|
let fileName = window.decodeURI(res.headers["content-disposition"].split(";")[1].split("=")[1]) |
|
|
|
console.log('filename', fileName) |
|
|
|
let blob = new Blob([res.data], { type: 'application/vnd.ms-excel' }) |
|
|
@ -407,8 +413,11 @@ export default { |
|
|
|
}) |
|
|
|
.catch( err => { |
|
|
|
console.log('失败', err) |
|
|
|
param.onError() //上传失败的文件会从文件列表中删除 |
|
|
|
err.onError() //上传失败的文件会从文件列表中删除 |
|
|
|
}) |
|
|
|
this.importLoading = false |
|
|
|
this.importBtnTitle = '导入人员数据' |
|
|
|
this.$refs.upload.clearFiles() |
|
|
|
}, |
|
|
|
handleClick(tab, event) { |
|
|
|
console.log(tab, event) |
|
|
|