|
@@ -14,7 +14,7 @@
|
|
|
icon="el-icon-download"
|
|
|
size="mini"
|
|
|
@click="handleExport"
|
|
|
- v-hasPermi="['system:role:export']"s
|
|
|
+ v-hasPermi="['business:customerInformation:list']"
|
|
|
:loading="exportLoading"
|
|
|
>导出</el-button>
|
|
|
</div>
|
|
@@ -225,60 +225,19 @@
|
|
|
/** 导出按钮操作 */
|
|
|
handleExport() {
|
|
|
var that = this;
|
|
|
- var url=process.env.VUE_APP_BASE_API+'data/customer/export';
|
|
|
- // Axios.get(url).then((data) => {
|
|
|
- // console.log(data)
|
|
|
- // }).catch((r) => {
|
|
|
- // console.error(r)
|
|
|
- // })
|
|
|
that.exportLoading = true;
|
|
|
- var elemIF = document.createElement('iframe')
|
|
|
- elemIF.src = url;
|
|
|
- elemIF.style.display = 'none'
|
|
|
- document.body.appendChild(elemIF);
|
|
|
- that.exportLoading = false;
|
|
|
-
|
|
|
- // listExport(that.queryParams).then(response => {
|
|
|
- // console.log(response);
|
|
|
- //
|
|
|
- // }
|
|
|
- // );
|
|
|
- // this.download('data/customer/export', {
|
|
|
- // ...this.queryParams
|
|
|
- // }, `customer_${c}.xlsx`)
|
|
|
- // var filename = `customer_${new Date().getTime()}.xlsx`;
|
|
|
- // var url=process.env.VUE_APP_BASE_API+'data/customer/export';
|
|
|
- // var params = {
|
|
|
- // ...this.queryParams
|
|
|
- // };
|
|
|
- // Axios.defaults.timeout = 70000;
|
|
|
- // Axios.get(url, params, {
|
|
|
- // transformRequest: [(params) => {
|
|
|
- // return tansParams(params)
|
|
|
- // }],
|
|
|
- // headers: {
|
|
|
- // 'Content-Type': 'application/x-www-form-urlencoded'
|
|
|
- // },
|
|
|
- // responseType: 'blob'
|
|
|
- // }).then((data) => {
|
|
|
- // console.log(data);
|
|
|
- // const content = data
|
|
|
- // const blob = new Blob([content])
|
|
|
- // if ('download' in document.createElement('a')) {
|
|
|
- // const elink = document.createElement('a')
|
|
|
- // elink.download = filename
|
|
|
- // elink.style.display = 'none'
|
|
|
- // elink.href = URL.createObjectURL(blob)
|
|
|
- // document.body.appendChild(elink)
|
|
|
- // elink.click()
|
|
|
- // URL.revokeObjectURL(elink.href)
|
|
|
- // document.body.removeChild(elink)
|
|
|
- // } else {
|
|
|
- // navigator.msSaveBlob(blob, filename)
|
|
|
- // }
|
|
|
- // }).catch((r) => {
|
|
|
- // console.error(r)
|
|
|
- // })
|
|
|
+ this.downloadNew('data/customer/export', {
|
|
|
+ ...this.queryParams
|
|
|
+ }, `customer_${new Date().getTime()}.csv`).then(response => {
|
|
|
+ console.log(response);
|
|
|
+ if(response){
|
|
|
+ that.exportLoading = false;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ genUrl(encoded, options) {
|
|
|
+ const dataBlob = new Blob([`\ufeff${encoded}`], { type: 'text/plain;charset=utf-8' });//返回的格式
|
|
|
+ return window.URL.createObjectURL(dataBlob);
|
|
|
},
|
|
|
toOverview(row){
|
|
|
this.$router.push({ path:'/userInfoOverview', query: {id: row.id} })
|