diff --git a/fe/PC/src/api/wms-api.js b/fe/PC/src/api/wms-api.js index 94f1ba8e7..b4cc69710 100644 --- a/fe/PC/src/api/wms-api.js +++ b/fe/PC/src/api/wms-api.js @@ -81,6 +81,7 @@ export function postExport(data, url, special) { url: _url, method: 'post', data, + responseType: 'blob' }) } //导出(详情内)-获取文件 blobName | 盘点计划 diff --git a/fe/PC/src/mixins/TableHeaderMixins.js b/fe/PC/src/mixins/TableHeaderMixins.js index 6a3efd105..f7089270c 100644 --- a/fe/PC/src/mixins/TableHeaderMixins.js +++ b/fe/PC/src/mixins/TableHeaderMixins.js @@ -59,7 +59,7 @@ export const TableHeaderMixins = { // } // 导出 else if (val == 'export') { - const name = this.$route.meta.title + const name = this.$route.meta.title this.$confirm('您将进行导出操作, 是否继续?', '提示', { confirmButtonText: '本页导出', cancelButtonText: '全部导出', @@ -76,14 +76,8 @@ export const TableHeaderMixins = { this.PageListParams.route = item.url ? item.url : this.URL + '/export'; let _exportUrl = item.url ? item.url : this.URL; let _special = (item.url && item.url.length > 0) ? true : false - postExport(this.PageListParams,_exportUrl,_special).then(res => { - fileStorage({blobName: res.blobName}).then( fileStorageRes => { - // this.downloadFile(fileStorageRes.bytes, name)//使用前端导出名称 - this.downloadFile(fileStorageRes.bytes, fileStorageRes.fileName)//使用后端导出名称 - }).catch( err => { - console.log(err) - }) - + postExport(this.PageListParams, _exportUrl, _special).then(res => { + this.blob(res, name)//使用前端导出名称 this.Loading.appMainLoading = false }).catch(err => { this.Loading.appMainLoading = false @@ -99,11 +93,7 @@ export const TableHeaderMixins = { params.route = this.URL + '/export' params.function = name postExport(params, this.URL).then(res => { - fileStorage({blobName: res.blobName}).then( fileStorageRes => { - this.downloadFile(fileStorageRes.bytes, fileStorageRes.fileName) - }).catch( err => { - console.log(err) - }) + this.blob(res, name)//使用前端导出名称 this.Loading.appMainLoading = false }).catch(err => { this.Loading.appMainLoading = false diff --git a/fe/PC/src/mixins/mixins.js b/fe/PC/src/mixins/mixins.js index 3c3a7cd12..6918aeea0 100644 --- a/fe/PC/src/mixins/mixins.js +++ b/fe/PC/src/mixins/mixins.js @@ -227,7 +227,7 @@ export const mixins = { //导出存储-新 blob(res, fileName) { let blob = new Blob([res], { - type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8', }) const href = URL.createObjectURL(blob) //创建新的URL表示指定的blob对象 const a = document.createElement('a') //创建a标签