Commit 83e8dfc4 authored by spiritree's avatar spiritree Committed by 花裤衩

fix selectExcel bug

parent 77ff8230
...@@ -66,15 +66,22 @@ ...@@ -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]))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment