fix selectExcel bug
This commit is contained in:
parent
77ff823037
commit
83e8dfc494
|
@ -66,15 +66,22 @@
|
||||||
this.multipleSelection = val;
|
this.multipleSelection = val;
|
||||||
},
|
},
|
||||||
handleDownload() {
|
handleDownload() {
|
||||||
require.ensure([], () => {
|
if (this.multipleSelection.length) {
|
||||||
const { export_json_to_excel } = require('vendor/Export2Excel');
|
require.ensure([], () => {
|
||||||
const tHeader = ['序号', '文章标题', '作者', '阅读数', '发布时间'];
|
const { export_json_to_excel } = require('vendor/Export2Excel');
|
||||||
const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time'];
|
const tHeader = ['序号', '文章标题', '作者', '阅读数', '发布时间'];
|
||||||
const list = this.multipleSelection;
|
const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time'];
|
||||||
const data = this.formatJson(filterVal, list);
|
const list = this.multipleSelection;
|
||||||
export_json_to_excel(tHeader, data, '列表excel');
|
const data = this.formatJson(filterVal, list);
|
||||||
this.$refs.multipleTable.clearSelection();
|
export_json_to_excel(tHeader, data, '列表excel');
|
||||||
})
|
this.$refs.multipleTable.clearSelection();
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$message({
|
||||||
|
message: '请选择一条或多条记录导出',
|
||||||
|
type: 'warning'
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
formatJson(filterVal, jsonData) {
|
formatJson(filterVal, jsonData) {
|
||||||
return jsonData.map(v => filterVal.map(j => v[j]))
|
return jsonData.map(v => filterVal.map(j => v[j]))
|
||||||
|
|
Loading…
Reference in New Issue