perf[i18n]:excel && zip
This commit is contained in:
parent
67bb2d980a
commit
f003493660
|
@ -68,5 +68,14 @@ export default {
|
||||||
permission: {
|
permission: {
|
||||||
permissions: 'Your permissions',
|
permissions: 'Your permissions',
|
||||||
switchPermissions: 'Switch permissions'
|
switchPermissions: 'Switch permissions'
|
||||||
|
},
|
||||||
|
excel: {
|
||||||
|
export: 'Export',
|
||||||
|
selectedExport: 'Export selected items',
|
||||||
|
placeholder: 'Please enter the file name(default excel-list)'
|
||||||
|
},
|
||||||
|
zip: {
|
||||||
|
export: 'Export',
|
||||||
|
placeholder: 'Please enter the file name(default file)'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,5 +68,14 @@ export default {
|
||||||
permission: {
|
permission: {
|
||||||
permissions: '你的权限',
|
permissions: '你的权限',
|
||||||
switchPermissions: '切换权限'
|
switchPermissions: '切换权限'
|
||||||
|
},
|
||||||
|
excel: {
|
||||||
|
export: '导出',
|
||||||
|
selectedExport: '导出已选择项',
|
||||||
|
placeholder: '请输入文件名(默认excel-list)'
|
||||||
|
},
|
||||||
|
zip: {
|
||||||
|
export: '导出',
|
||||||
|
placeholder: '请输入文件名(默认file)'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,9 @@ for (let i = 0; i < count; i++) {
|
||||||
List.push(Mock.mock({
|
List.push(Mock.mock({
|
||||||
id: '@increment',
|
id: '@increment',
|
||||||
timestamp: +Mock.Random.date('T'),
|
timestamp: +Mock.Random.date('T'),
|
||||||
author: '@cname',
|
author: '@first',
|
||||||
auditor: '@cname',
|
auditor: '@name',
|
||||||
title: '@ctitle(10, 20)',
|
title: '@title(10, 20)',
|
||||||
forecast: '@float(0, 100, 2, 2)',
|
forecast: '@float(0, 100, 2, 2)',
|
||||||
importance: '@integer(1, 3)',
|
importance: '@integer(1, 3)',
|
||||||
'type|1': ['CN', 'US', 'JP', 'EU'],
|
'type|1': ['CN', 'US', 'JP', 'EU'],
|
||||||
|
|
|
@ -1,29 +1,30 @@
|
||||||
<template>
|
<template>
|
||||||
|
<!-- $t is vue-i18n global function to translate lang (lang in @/lang) -->
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-input style='width:240px;' placeholder="请输入文件名(默认excel-list)" prefix-icon="el-icon-document" v-model="filename"></el-input>
|
<el-input style='width:340px;' :placeholder="$t('excel.placeholder')" 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-button style='margin-bottom:20px;' type="primary" icon="document" @click="handleDownload" :loading="downloadLoading">{{$t('excel.export')}} excel</el-button>
|
||||||
<el-table :data="list" v-loading.body="listLoading" element-loading-text="拼命加载中" border fit highlight-current-row>
|
<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">
|
<el-table-column align="center" label='Id' width="95">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{scope.$index}}
|
{{scope.$index}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="文章标题">
|
<el-table-column label="Title">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{scope.row.title}}
|
{{scope.row.title}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="作者" width="95" align="center">
|
<el-table-column label="Author" width="110" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tag>{{scope.row.author}}</el-tag>
|
<el-tag>{{scope.row.author}}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="阅读数" width="115" align="center">
|
<el-table-column label="Readings" width="115" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{scope.row.pageviews}}
|
{{scope.row.pageviews}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" prop="created_at" label="发布时间" width="220">
|
<el-table-column align="center" label="Date" width="220">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<i class="el-icon-time"></i>
|
<i class="el-icon-time"></i>
|
||||||
<span>{{scope.row.timestamp | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
|
<span>{{scope.row.timestamp | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
|
||||||
|
@ -61,7 +62,7 @@ export default {
|
||||||
handleDownload() {
|
handleDownload() {
|
||||||
this.downloadLoading = true
|
this.downloadLoading = true
|
||||||
import('@/vendor/Export2Excel').then(excel => {
|
import('@/vendor/Export2Excel').then(excel => {
|
||||||
const tHeader = ['序号', '文章标题', '作者', '阅读数', '发布时间']
|
const tHeader = ['Id', 'Title', 'Author', 'Readings', 'Date']
|
||||||
const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time']
|
const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time']
|
||||||
const list = this.list
|
const list = this.list
|
||||||
const data = this.formatJson(filterVal, list)
|
const data = this.formatJson(filterVal, list)
|
||||||
|
|
|
@ -1,31 +1,32 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-input style='width:240px;' placeholder="请输入文件名(默认excel-list)" prefix-icon="el-icon-document" v-model="filename"></el-input>
|
<!-- $t is vue-i18n global function to translate lang (lang in @/lang) -->
|
||||||
<el-button style='margin-bottom:20px' type="primary" icon="document" @click="handleDownload" :loading="downloadLoading">导出已选择项</el-button>
|
<el-input style='width:340px;' :placeholder="$t('excel.placeholder')" prefix-icon="el-icon-document" v-model="filename"></el-input>
|
||||||
|
<el-button style='margin-bottom:20px' type="primary" icon="document" @click="handleDownload" :loading="downloadLoading">{{$t('excel.selectedExport')}}</el-button>
|
||||||
<el-table :data="list" v-loading.body="listLoading" element-loading-text="拼命加载中" border fit highlight-current-row @selection-change="handleSelectionChange"
|
<el-table :data="list" v-loading.body="listLoading" element-loading-text="拼命加载中" border fit highlight-current-row @selection-change="handleSelectionChange"
|
||||||
ref="multipleTable">
|
ref="multipleTable">
|
||||||
<el-table-column type="selection" align="center"></el-table-column>
|
<el-table-column type="selection" align="center"></el-table-column>
|
||||||
<el-table-column align="center" label='ID' width="95">
|
<el-table-column align="center" label='Id' width="95">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{scope.$index}}
|
{{scope.$index}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="文章标题">
|
<el-table-column label="Title">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{scope.row.title}}
|
{{scope.row.title}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="作者" width="95" align="center">
|
<el-table-column label="Author" width="110" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tag>{{scope.row.author}}</el-tag>
|
<el-tag>{{scope.row.author}}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="阅读数" width="115" align="center">
|
<el-table-column label="Readings" width="115" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{scope.row.pageviews}}
|
{{scope.row.pageviews}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" prop="created_at" label="发布时间" width="220">
|
<el-table-column align="center" label="PDate" width="220">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<i class="el-icon-time"></i>
|
<i class="el-icon-time"></i>
|
||||||
<span>{{scope.row.display_time}}</span>
|
<span>{{scope.row.display_time}}</span>
|
||||||
|
@ -67,7 +68,7 @@ export default {
|
||||||
if (this.multipleSelection.length) {
|
if (this.multipleSelection.length) {
|
||||||
this.downloadLoading = true
|
this.downloadLoading = true
|
||||||
import('@/vendor/Export2Excel').then(excel => {
|
import('@/vendor/Export2Excel').then(excel => {
|
||||||
const tHeader = ['序号', '文章标题', '作者', '阅读数', '发布时间']
|
const tHeader = ['Id', 'Title', 'Author', 'Readings', 'Date']
|
||||||
const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time']
|
const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time']
|
||||||
const list = this.multipleSelection
|
const list = this.multipleSelection
|
||||||
const data = this.formatJson(filterVal, list)
|
const data = this.formatJson(filterVal, list)
|
||||||
|
@ -77,7 +78,7 @@ export default {
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '请至少选择一条记录',
|
message: 'Please select at least one item',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,29 +1,30 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-input style='width:240px;' placeholder="请输入文件名(默认file)" prefix-icon="el-icon-document" v-model="filename"></el-input>
|
<!-- $t is vue-i18n global function to translate lang (lang in @/lang) -->
|
||||||
<el-button style='margin-bottom:20px;' type="primary" icon="document" @click="handleDownload" :loading="downloadLoading">导出zip</el-button>
|
<el-input style='width:300px;' :placeholder="$t('zip.placeholder')" prefix-icon="el-icon-document" v-model="filename"></el-input>
|
||||||
|
<el-button style='margin-bottom:20px;' type="primary" icon="document" @click="handleDownload" :loading="downloadLoading">{{$t('zip.export')}} zip</el-button>
|
||||||
<el-table :data="list" v-loading.body="listLoading" element-loading-text="拼命加载中" border fit highlight-current-row>
|
<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">
|
<el-table-column align="center" label='ID' width="95">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{scope.$index}}
|
{{scope.$index}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="文章标题">
|
<el-table-column label="Title">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{scope.row.title}}
|
{{scope.row.title}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="作者" width="95" align="center">
|
<el-table-column label="Author" width="95" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tag>{{scope.row.author}}</el-tag>
|
<el-tag>{{scope.row.author}}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="阅读数" width="115" align="center">
|
<el-table-column label="Readings" width="115" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{scope.row.pageviews}}
|
{{scope.row.pageviews}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" prop="created_at" label="发布时间" width="220">
|
<el-table-column align="center" label="Date" width="220">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<i class="el-icon-time"></i>
|
<i class="el-icon-time"></i>
|
||||||
<span>{{scope.row.display_time}}</span>
|
<span>{{scope.row.display_time}}</span>
|
||||||
|
@ -60,7 +61,7 @@ export default {
|
||||||
handleDownload() {
|
handleDownload() {
|
||||||
this.downloadLoading = true
|
this.downloadLoading = true
|
||||||
import('@/vendor/Export2Zip').then(zip => {
|
import('@/vendor/Export2Zip').then(zip => {
|
||||||
const tHeader = ['序号', '文章标题', '作者', '阅读数', '发布时间']
|
const tHeader = ['Id', 'Title', 'Author', 'Readings', 'Date']
|
||||||
const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time']
|
const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time']
|
||||||
const list = this.list
|
const list = this.list
|
||||||
const data = this.formatJson(filterVal, list)
|
const data = this.formatJson(filterVal, list)
|
||||||
|
|
Loading…
Reference in New Issue