1
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
// 引入 Admin Framework(框架内部已包含所有依赖和样式)
|
// 引入 Admin Framework(框架内部已包含所有依赖和样式)
|
||||||
import AdminFramework from '../../dist/admin-framework.js'
|
import AdminFramework from '../../dist/admin-framework.js'
|
||||||
|
|
||||||
|
|
||||||
// 引入组件映射表
|
// 引入组件映射表
|
||||||
import componentMap from './router/component-map.js'
|
import componentMap from './router/component-map.js'
|
||||||
|
|
||||||
|
|||||||
@@ -349,7 +349,9 @@ export default {
|
|||||||
this.query(1);
|
this.query(1);
|
||||||
},
|
},
|
||||||
async exportCsv(row) {
|
async exportCsv(row) {
|
||||||
await wch_usersServer.exportCsv(row)
|
let res = await wch_usersServer.exportCsv(row)
|
||||||
|
debugger
|
||||||
|
window.framework.tools.downloadFile(res, '用户列表.csv');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -246,9 +246,7 @@ export default {
|
|||||||
this.query(1);
|
this.query(1);
|
||||||
},
|
},
|
||||||
exportCsv() {
|
exportCsv() {
|
||||||
ntr_recordsServer.exportCsv(this.gridOption.param).then(res => {
|
ntr_recordsServer.exportCsv(this.gridOption.param)
|
||||||
window.framework.tools.downloadFile(res, '测试记录.csv');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ class Http {
|
|||||||
return promise
|
return promise
|
||||||
}
|
}
|
||||||
|
|
||||||
async fileExport(url, param) {
|
async fileExport(url, param, filename, is_down = true) {
|
||||||
let formData = this.formatFormDataParam(param)
|
let formData = this.formatFormDataParam(param)
|
||||||
|
|
||||||
let config = {
|
let config = {
|
||||||
@@ -206,14 +206,19 @@ class Http {
|
|||||||
url: url,
|
url: url,
|
||||||
responseType: 'blob'
|
responseType: 'blob'
|
||||||
}
|
}
|
||||||
|
|
||||||
let res = await axios.post(url, formData, config)
|
let res = await axios.post(url, formData, config)
|
||||||
const filename = res.headers.filename
|
filename = filename || res.headers['content-disposition'].split('filename=')[1].split(';')[0]
|
||||||
const a = document.createElement('a')
|
|
||||||
const href = window.URL.createObjectURL(res.data)
|
// 开头和结尾去掉 中间不去掉
|
||||||
a.href = href
|
filename = filename.replace(/^[_-]+|[_-]+$/g, '')
|
||||||
a.download = filename
|
|
||||||
a.click()
|
// 直接下载
|
||||||
window.URL.revokeObjectURL(url)
|
if (is_down) {
|
||||||
|
window.framework.uiTool.downloadFile(res.data, filename)
|
||||||
|
}
|
||||||
|
|
||||||
|
return res
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user