Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tallty_import_export
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
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
open-source
tallty_import_export
Commits
1b5b2aac
Commit
1b5b2aac
authored
Dec 25, 2020
by
liyijie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add with_scope for records
parent
e9126beb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
export.rb
lib/tallty_import_export/export.rb
+6
-1
No files found.
lib/tallty_import_export/export.rb
View file @
1b5b2aac
...
...
@@ -27,6 +27,7 @@ module TalltyImportExport
# index: 数组方式,需要嵌套拿到里面的
def
export_xlsx
records
,
**
options
records
=
with_scope
records
exportable_defaults
(
options
)
options
=
options
.
with_indifferent_access
...
...
@@ -77,7 +78,7 @@ module TalltyImportExport
sheet
.
add_row
headers
.
map
{
|
header
|
header
[
:name
]},
style:
title2
,
height:
39
each_method
=
records
.
is_a?
(
Array
)
?
:
each
:
:
find_
each
each_method
=
records
.
is_a?
(
Array
)
?
:
each
:
:each
records
.
send
(
each_method
)
do
|
record
|
row
=
[]
headers
.
each
{
|
header
|
row
.
push
(
handle_data
(
record
,
header
))
}
...
...
@@ -96,6 +97,10 @@ module TalltyImportExport
@group_by
||=
options
.
delete
(
:group_by
)
end
def
with_scope
records
records
end
def
headers
=
val
@headers
=
val
.
map
{
|
header
|
header
.
with_indifferent_access
}
end
...
...
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