|
|
@ -48,11 +48,16 @@ |
|
|
|
|
|
|
|
<div class="resi-row-btn"> |
|
|
|
<el-button class="diy-button--add" size="small" @click="handleAdd">新增</el-button> |
|
|
|
<el-button |
|
|
|
class="diy-button--export" |
|
|
|
size="small" |
|
|
|
@click="handleExportModule('room')">下载模板</el-button> |
|
|
|
<el-upload |
|
|
|
ref="upload" |
|
|
|
class="upload-demo" |
|
|
|
action="uploadUlr" |
|
|
|
:limit="1" |
|
|
|
:accept="'.xls,.xlsx'" |
|
|
|
:with-credentials="true" |
|
|
|
:show-file-list="false" |
|
|
|
:auto-upload="true" |
|
|
@ -63,10 +68,7 @@ |
|
|
|
<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> |
|
|
|
<!-- <el-button |
|
|
|
class="diy-button--export" |
|
|
|
size="small" |
|
|
|
@click="handleExportModule('room')">下载模板</el-button> --> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<el-table |
|
|
@ -106,7 +108,7 @@ |
|
|
|
type="text" |
|
|
|
size="small" |
|
|
|
class="btn-color-edit" |
|
|
|
>编辑</el-button |
|
|
|
>修改</el-button |
|
|
|
> |
|
|
|
<el-popconfirm |
|
|
|
title="删除之后无法恢复,确认删除?" |
|
|
@ -200,7 +202,7 @@ |
|
|
|
<i class="el-icon-delete" @click="handleDelimg(item, index)"></i> |
|
|
|
</div> |
|
|
|
<el-upload class="avatar-uploader" |
|
|
|
v-if="form.imageList.length < 3" |
|
|
|
v-if="form.imageList.length < 3 && !disabled" |
|
|
|
:action="uploadUlr" |
|
|
|
:data="{customerId:customerId}" |
|
|
|
:show-file-list="false" |
|
|
@ -218,6 +220,7 @@ |
|
|
|
<div class="resi-btns"> |
|
|
|
<el-button size="small" @click="handlerCancle">取消</el-button> |
|
|
|
<el-button |
|
|
|
v-if="!disabled" |
|
|
|
type="primary" |
|
|
|
size="small" |
|
|
|
:loading="btnLoading" |
|
|
@ -236,7 +239,7 @@ export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
uploadUlr: window.SITE_CONFIG['apiURL'] + '/oss/file/uploadqrcodeV2', |
|
|
|
importBtnTitle: '导入数据', |
|
|
|
importBtnTitle: '导入', |
|
|
|
importLoading: false, |
|
|
|
exportBtn: false, |
|
|
|
exportBtnTitle: '导出', |
|
|
@ -380,28 +383,68 @@ export default { |
|
|
|
this.uploading = true |
|
|
|
this.unloadPencent = Number(file.percentage.toFixed(0)) |
|
|
|
}, |
|
|
|
download (data, fileName) { |
|
|
|
console.log('data', data) |
|
|
|
if (!data) { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
var csvData = new Blob([data]) |
|
|
|
|
|
|
|
if (window.navigator && window.navigator.msSaveOrOpenBlob) { |
|
|
|
window.navigator.msSaveOrOpenBlob(csvData, fileName) |
|
|
|
} |
|
|
|
// for Non-IE (chrome, firefox etc.) |
|
|
|
else { |
|
|
|
var a = document.createElement('a') |
|
|
|
document.body.appendChild(a) |
|
|
|
a.style = 'display: none' |
|
|
|
var url = window.URL.createObjectURL(csvData) |
|
|
|
a.href = url |
|
|
|
a.download = fileName |
|
|
|
a.click() |
|
|
|
a.remove() |
|
|
|
window.URL.revokeObjectURL(url) |
|
|
|
} |
|
|
|
}, |
|
|
|
async handleExportModule () { |
|
|
|
let url = "/resi/partymember/import/template-download" |
|
|
|
let url = "/resi/partymember/icpartymemberstyle/import/template-download" |
|
|
|
|
|
|
|
|
|
|
|
let params = {} |
|
|
|
await this.$http |
|
|
|
.post(url, params) |
|
|
|
// app.ajax.exportFilePost( |
|
|
|
// url, |
|
|
|
// params, |
|
|
|
// (data, rspMsg) => { |
|
|
|
|
|
|
|
// this.download(data, 'a.xls') |
|
|
|
// }, |
|
|
|
// (rspMsg, data) => { |
|
|
|
// this.$message.error(rspMsg); |
|
|
|
// } |
|
|
|
// ); |
|
|
|
await this.$http({ |
|
|
|
method: 'POST', |
|
|
|
url, |
|
|
|
responseType: 'blob', |
|
|
|
data: params |
|
|
|
}) |
|
|
|
.then(res => { |
|
|
|
// this.download(res.data, title + '.xls') |
|
|
|
console.log('res-------dd', res) |
|
|
|
if (res.headers["content-disposition"]) { |
|
|
|
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对象 |
|
|
|
this.download(res.data, fileName) |
|
|
|
// 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对象 |
|
|
|
} else this.$message.error('下载失败') |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
@ -477,7 +520,7 @@ export default { |
|
|
|
// this.$message.error('导入失败') |
|
|
|
// }) |
|
|
|
this.importLoading = false |
|
|
|
this.importBtnTitle = '导入数据' |
|
|
|
this.importBtnTitle = '导入' |
|
|
|
this.$refs.upload.clearFiles() |
|
|
|
}, |
|
|
|
async handleExport() { |
|
|
|