Browse Source

导出功能修改

dev_web_online
陈薪名 2 years ago
parent
commit
c4771f20d2
  1. 1
      fe/PC/src/api/wms-api.js
  2. 16
      fe/PC/src/mixins/TableHeaderMixins.js
  3. 2
      fe/PC/src/mixins/mixins.js

1
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 | 盘点计划

16
fe/PC/src/mixins/TableHeaderMixins.js

@ -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

2
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标签

Loading…
Cancel
Save