reactor:refine code&&demo

This commit is contained in:
Pan
2017-11-02 17:58:35 +08:00
parent ac5d087ea4
commit bb1d939a94
18 changed files with 138 additions and 139 deletions

View File

@@ -1,5 +1,6 @@
<template>
<div class="app-container">
<el-input style='width:240px;' placeholder="请输入文件名(默认excel-list)" prefix-icon="el-icon-document" v-model="filename"></el-input>
<el-button style='margin-bottom:20px;' type="primary" icon="document" @click="handleDownload" :loading="downloadLoading">导出excel</el-button>
<el-table :data="list" v-loading.body="listLoading" element-loading-text="拼命加载中" border fit highlight-current-row>
<el-table-column align="center" label='ID' width="95">
@@ -42,7 +43,8 @@ export default {
return {
list: null,
listLoading: true,
downloadLoading: false
downloadLoading: false,
filename: ''
}
},
created() {
@@ -64,7 +66,7 @@ export default {
const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time']
const list = this.list
const data = this.formatJson(filterVal, list)
export_json_to_excel(tHeader, data, '列表excel')
export_json_to_excel(tHeader, data, this.filename)
this.downloadLoading = false
})
},

View File

@@ -1,5 +1,6 @@
<template>
<div class="app-container">
<el-input style='width:240px;' placeholder="请输入文件名(默认excel-list)" prefix-icon="el-icon-document" v-model="filename"></el-input>
<el-button style='margin-bottom:20px' type="primary" icon="document" @click="handleDownload" :loading="downloadLoading">导出已选择项</el-button>
<el-table :data="list" v-loading.body="listLoading" element-loading-text="拼命加载中" border fit highlight-current-row @selection-change="handleSelectionChange"
ref="multipleTable">
@@ -44,7 +45,8 @@ export default {
list: null,
listLoading: true,
multipleSelection: [],
downloadLoading: false
downloadLoading: false,
filename: ''
}
},
created() {
@@ -70,7 +72,7 @@ export default {
const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time']
const list = this.multipleSelection
const data = this.formatJson(filterVal, list)
export_json_to_excel(tHeader, data, '列表excel')
export_json_to_excel(tHeader, data, this.filename)
this.$refs.multipleTable.clearSelection()
this.downloadLoading = false
})