|
|
|
@ -146,6 +146,35 @@ |
|
|
|
</div> |
|
|
|
</el-card> |
|
|
|
<el-card class="resi-card-table"> |
|
|
|
|
|
|
|
<div class="resi-row-btn"> |
|
|
|
|
|
|
|
<el-button class="diy-button--export" |
|
|
|
size="small" |
|
|
|
@click="handleExportModule()">下载模板</el-button> |
|
|
|
<el-upload :headers="$getElUploadHeaders()" |
|
|
|
ref="upload" |
|
|
|
class="upload-demo" |
|
|
|
action="uploadUlr" |
|
|
|
:limit="1" |
|
|
|
:accept="'.xls,.xlsx'" |
|
|
|
:with-credentials="true" |
|
|
|
:show-file-list="false" |
|
|
|
:auto-upload="true" |
|
|
|
:on-success="handleExcelSuccess" |
|
|
|
:before-upload="beforeExcelUpload" |
|
|
|
:http-request="uploadHttpRequest"> |
|
|
|
<el-button size="small" |
|
|
|
class="diy-button--delete" |
|
|
|
:loading="importLoading">{{importBtnTitle}}</el-button> |
|
|
|
</el-upload> |
|
|
|
<el-button class="diy-button--reset" |
|
|
|
size="small" |
|
|
|
:loading="exportBtn" |
|
|
|
@click="handleExport">{{ exportBtnTitle }}</el-button> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<el-table :data="tableData" |
|
|
|
row-key="id" |
|
|
|
v-loading="tableLoading" |
|
|
|
@ -495,6 +524,126 @@ export default { |
|
|
|
window.URL.revokeObjectURL(url) |
|
|
|
} |
|
|
|
}, |
|
|
|
async handleExportModule () { |
|
|
|
let url = "/resi/partymember/icPartyMember/downloadTemplate" |
|
|
|
|
|
|
|
|
|
|
|
let params = { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
await this.$http({ |
|
|
|
method: 'POST', |
|
|
|
url, |
|
|
|
responseType: 'blob', |
|
|
|
data: params |
|
|
|
}) |
|
|
|
.then(res => { |
|
|
|
console.log('res-------dd', res) |
|
|
|
if (res.headers["content-disposition"]) { |
|
|
|
let fileName = window.decodeURI(res.headers["content-disposition"].split(";")[1].split("=")[1]) |
|
|
|
this.download(res.data, fileName) |
|
|
|
|
|
|
|
} else this.$message.error('下载失败') |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
console.log('err', err) |
|
|
|
return this.$message.error('网络错误') |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 上传大图标成功 |
|
|
|
handleExcelSuccess (res, file) { |
|
|
|
if (res.code === 0 && res.msg === 'success') { |
|
|
|
|
|
|
|
console.log('resss---ppp', res) |
|
|
|
|
|
|
|
} else { |
|
|
|
this.$message.error(res.msg) |
|
|
|
} |
|
|
|
}, |
|
|
|
beforeExcelUpload (file) { |
|
|
|
console.log('file', file) |
|
|
|
const isType = file.type === 'application/vnd.ms-excel' |
|
|
|
const isTypeComputer = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' |
|
|
|
const fileType = isType || isTypeComputer |
|
|
|
const isLt1M = (file.size / 1024 / 1024) < 10 |
|
|
|
if (!fileType) { |
|
|
|
this.$message.error('上传文件只能是xls/xlsx格式!') |
|
|
|
} |
|
|
|
|
|
|
|
if (!isLt1M) { |
|
|
|
this.$message.error('上传文件大小不能超过 10MB!') |
|
|
|
} |
|
|
|
return fileType && isLt1M |
|
|
|
}, |
|
|
|
async uploadHttpRequest (file) { |
|
|
|
this.importLoading = true |
|
|
|
this.importBtnTitle = '正在上传中...' |
|
|
|
this.$message({ |
|
|
|
showClose: true, |
|
|
|
message: '导入中,请到系统管理-导入记录中查看进度', |
|
|
|
duration: 0 |
|
|
|
}) |
|
|
|
const formData = new FormData() //FormData对象,添加参数只能通过append('key', value)的形式添加 |
|
|
|
formData.append('file', file.file) //添加文件对象 |
|
|
|
this.$http |
|
|
|
.post('/resi/partymember/icPartyMember/import', formData).then(res => { |
|
|
|
console.log('res-up', res) |
|
|
|
if (res.data.code == 0 && res.data.msg == 'success') { |
|
|
|
// this.$message.success('导入成功') |
|
|
|
this.getTableData() |
|
|
|
} else { |
|
|
|
this.$message.error(res.data.msg) |
|
|
|
} |
|
|
|
}).catch(err => { |
|
|
|
console.log('失败', err) |
|
|
|
file.onError() //上传失败的文件会从文件列表中删除 |
|
|
|
// this.$message.error('导入失败') |
|
|
|
}) |
|
|
|
|
|
|
|
this.importLoading = false |
|
|
|
this.importBtnTitle = '导入' |
|
|
|
this.$refs.upload.clearFiles() |
|
|
|
}, |
|
|
|
async handleExport () { |
|
|
|
this.exportBtn = true |
|
|
|
this.exportBtnTitle = '正在导出...' |
|
|
|
let params = { |
|
|
|
...this.searchForm, |
|
|
|
agencyId: this.agencyId, |
|
|
|
pageSize: 9999, |
|
|
|
pageNo: this.currentPage |
|
|
|
} |
|
|
|
// .post('epmetuser/icresiuser/exportExcel', params) |
|
|
|
await axios({ |
|
|
|
url: window.SITE_CONFIG['apiURL'] + '/resi/partymember/icPartyMember/export', |
|
|
|
// url: 'epmetuser/icresiuser/exportExcel', |
|
|
|
method: 'post', |
|
|
|
data: params, |
|
|
|
responseType: 'blob' |
|
|
|
}) |
|
|
|
.then(res => { |
|
|
|
console.log('resllll', res) |
|
|
|
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' }) |
|
|
|
var url = window.URL.createObjectURL(blob) |
|
|
|
var aLink = document.createElement('a') |
|
|
|
aLink.style.display = 'none' |
|
|
|
aLink.href = url |
|
|
|
aLink.setAttribute('download', fileName) |
|
|
|
document.body.appendChild(aLink) |
|
|
|
aLink.click() |
|
|
|
document.body.removeChild(aLink) //下载完成移除元素 |
|
|
|
window.URL.revokeObjectURL(url) //释放掉blob对象 |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
console.log('获取导出情失败', err) |
|
|
|
this.$message.error('获取导出失败') |
|
|
|
}) |
|
|
|
this.exportBtn = false |
|
|
|
this.exportBtnTitle = '导出' |
|
|
|
}, |
|
|
|
|
|
|
|
handleSearch (val) { |
|
|
|
console.log('searchhh--', val) |
|
|
|
@ -623,6 +772,33 @@ export default { |
|
|
|
@import "@/assets/scss/modules/visual/communityManage.scss"; |
|
|
|
</style> |
|
|
|
<style lang="scss" scoped> |
|
|
|
.resi-row-btn { |
|
|
|
display: flex; |
|
|
|
margin-bottom: 13px; |
|
|
|
::v-deep .el-button { |
|
|
|
// margin-left: 10px; |
|
|
|
border: 0; |
|
|
|
} |
|
|
|
::v-deep .el-select { |
|
|
|
margin-right: 10px; |
|
|
|
} |
|
|
|
.el-button--success { |
|
|
|
background: rgba(34, 193, 195, 1); |
|
|
|
} |
|
|
|
.el-button { |
|
|
|
margin-left: 10px; |
|
|
|
border: 0; |
|
|
|
} |
|
|
|
.el-button--success { |
|
|
|
background: rgba(34, 193, 195, 1); |
|
|
|
} |
|
|
|
.el-button--warning { |
|
|
|
background: rgba(254, 179, 73, 1); |
|
|
|
} |
|
|
|
.el-button--danger { |
|
|
|
background: rgba(254, 98, 82, 1); |
|
|
|
} |
|
|
|
} |
|
|
|
.div_btn { |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
|