Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
VueElementTemplate
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄瑜
VueElementTemplate
Commits
7fef8568
Commit
7fef8568
authored
Dec 21, 2017
by
Pan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: use import replace require.ensure
parent
0dfa56c7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
21 deletions
+20
-21
complexTable.vue
src/views/example/table/complexTable.vue
+7
-5
exportExcel.vue
src/views/excel/exportExcel.vue
+2
-3
selectExcel.vue
src/views/excel/selectExcel.vue
+9
-10
index.vue
src/views/zip/index.vue
+2
-3
No files found.
src/views/example/table/complexTable.vue
View file @
7fef8568
...
...
@@ -17,7 +17,7 @@
</el-select>
<el-button
class=
"filter-item"
type=
"primary"
v-waves
icon=
"el-icon-search"
@
click=
"handleFilter"
>
搜索
</el-button>
<el-button
class=
"filter-item"
style=
"margin-left: 10px;"
@
click=
"handleCreate"
type=
"primary"
icon=
"el-icon-edit"
>
添加
</el-button>
<el-button
class=
"filter-item"
type=
"primary"
v-waves
icon=
"el-icon-download"
@
click=
"handleDownload"
>
导出
</el-button>
<el-button
class=
"filter-item"
type=
"primary"
:loading=
"downloadLoading"
v-waves
icon=
"el-icon-download"
@
click=
"handleDownload"
>
导出
</el-button>
<el-checkbox
class=
"filter-item"
style=
'margin-left:15px;'
@
change=
'tableKey=tableKey+1'
v-model=
"showAuditor"
>
显示审核人
</el-checkbox>
</div>
...
...
@@ -196,7 +196,8 @@ export default {
type
:
[{
required
:
true
,
message
:
'type is required'
,
trigger
:
'change'
}
],
timestamp
:
[{
type
:
'date'
,
required
:
true
,
message
:
'timestamp is required'
,
trigger
:
'change'
}
],
title
:
[{
required
:
true
,
message
:
'title is required'
,
trigger
:
'blur'
}
]
}
}
,
downloadLoading
:
false
}
}
,
filters
:
{
...
...
@@ -330,12 +331,13 @@ export default {
}
)
}
,
handleDownload
()
{
require
.
ensure
([],
()
=>
{
const
{
export_json_to_excel
}
=
require
(
'@/vendor/Export2Excel'
)
this
.
downloadLoading
=
true
import
(
'@/vendor/Export2Excel'
).
then
(
excel
=>
{
const
tHeader
=
[
'时间'
,
'地区'
,
'类型'
,
'标题'
,
'重要性'
]
const
filterVal
=
[
'timestamp'
,
'province'
,
'type'
,
'title'
,
'importance'
]
const
data
=
this
.
formatJson
(
filterVal
,
this
.
list
)
export_json_to_excel
(
tHeader
,
data
,
'table数据'
)
excel
.
export_json_to_excel
(
tHeader
,
data
,
'table数据'
)
this
.
downloadLoading
=
false
}
)
}
,
formatJson
(
filterVal
,
jsonData
)
{
...
...
src/views/excel/exportExcel.vue
View file @
7fef8568
...
...
@@ -60,13 +60,12 @@ export default {
}
,
handleDownload
()
{
this
.
downloadLoading
=
true
require
.
ensure
([],
()
=>
{
const
{
export_json_to_excel
}
=
require
(
'@/vendor/Export2Excel'
)
import
(
'@/vendor/Export2Excel'
).
then
(
excel
=>
{
const
tHeader
=
[
'序号'
,
'文章标题'
,
'作者'
,
'阅读数'
,
'发布时间'
]
const
filterVal
=
[
'id'
,
'title'
,
'author'
,
'pageviews'
,
'display_time'
]
const
list
=
this
.
list
const
data
=
this
.
formatJson
(
filterVal
,
list
)
export_json_to_excel
(
tHeader
,
data
,
this
.
filename
)
ex
cel
.
ex
port_json_to_excel
(
tHeader
,
data
,
this
.
filename
)
this
.
downloadLoading
=
false
}
)
}
,
...
...
src/views/excel/selectExcel.vue
View file @
7fef8568
...
...
@@ -66,16 +66,15 @@ export default {
handleDownload
()
{
if
(
this
.
multipleSelection
.
length
)
{
this
.
downloadLoading
=
true
require
.
ensure
([],
()
=>
{
const
{
export_json_to_excel
}
=
require
(
'@/vendor/Export2Excel'
)
const
tHeader
=
[
'序号'
,
'文章标题'
,
'作者'
,
'阅读数'
,
'发布时间'
]
const
filterVal
=
[
'id'
,
'title'
,
'author'
,
'pageviews'
,
'display_time'
]
const
list
=
this
.
multipleSelection
const
data
=
this
.
formatJson
(
filterVal
,
list
)
export_json_to_excel
(
tHeader
,
data
,
this
.
filename
)
this
.
$refs
.
multipleTable
.
clearSelection
()
this
.
downloadLoading
=
false
})
import
(
'@/vendor/Export2Excel'
).
then
(
excel
=>
{
const
tHeader
=
[
'序号'
,
'文章标题'
,
'作者'
,
'阅读数'
,
'发布时间'
]
const
filterVal
=
[
'id'
,
'title'
,
'author'
,
'pageviews'
,
'display_time'
]
const
list
=
this
.
multipleSelection
const
data
=
this
.
formatJson
(
filterVal
,
list
)
excel
.
export_json_to_excel
(
tHeader
,
data
,
this
.
filename
)
this
.
$refs
.
multipleTable
.
clearSelection
()
this
.
downloadLoading
=
false
})
}
else
{
this
.
$message
({
message
:
'请至少选择一条记录'
,
...
...
src/views/zip/index.vue
View file @
7fef8568
...
...
@@ -59,13 +59,12 @@ export default {
},
handleDownload
()
{
this
.
downloadLoading
=
true
require
.
ensure
([],
()
=>
{
const
{
export_txt_to_zip
}
=
require
(
'@/vendor/Export2Zip'
)
import
(
'@/vendor/Export2Zip'
).
then
(
zip
=>
{
const
tHeader
=
[
'序号'
,
'文章标题'
,
'作者'
,
'阅读数'
,
'发布时间'
]
const
filterVal
=
[
'id'
,
'title'
,
'author'
,
'pageviews'
,
'display_time'
]
const
list
=
this
.
list
const
data
=
this
.
formatJson
(
filterVal
,
list
)
export_txt_to_zip
(
tHeader
,
data
,
this
.
filename
,
this
.
filename
)
zip
.
export_txt_to_zip
(
tHeader
,
data
,
this
.
filename
,
this
.
filename
)
this
.
downloadLoading
=
false
})
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment