Commit 8e02e560 by liyijie

feat: 增加attr_json gem

parent 8c4adeec
PATH PATH
remote: . remote: .
specs: specs:
tallty_import_export (1.0.24) tallty_import_export (1.0.35)
activesupport activesupport
attr_json
caxlsx caxlsx
redis redis
redis-objects redis-objects
...@@ -14,36 +15,40 @@ PATH ...@@ -14,36 +15,40 @@ PATH
GEM GEM
remote: https://gems.ruby-china.com/ remote: https://gems.ruby-china.com/
specs: specs:
activemodel (6.1.4.1) activemodel (7.0.2.4)
activesupport (= 6.1.4.1) activesupport (= 7.0.2.4)
activesupport (6.1.4.1) activerecord (7.0.2.4)
activemodel (= 7.0.2.4)
activesupport (= 7.0.2.4)
activesupport (7.0.2.4)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2) i18n (>= 1.6, < 2)
minitest (>= 5.1) minitest (>= 5.1)
tzinfo (~> 2.0) tzinfo (~> 2.0)
zeitwerk (~> 2.3) attr_json (1.4.0)
caxlsx (3.1.1) activerecord (>= 5.0.0, < 7.1)
caxlsx (3.2.0)
htmlentities (~> 4.3, >= 4.3.4) htmlentities (~> 4.3, >= 4.3.4)
marcel (~> 1.0) marcel (~> 1.0)
nokogiri (~> 1.10, >= 1.10.4) nokogiri (~> 1.10, >= 1.10.4)
rubyzip (>= 1.3.0, < 3) rubyzip (>= 1.3.0, < 3)
concurrent-ruby (1.1.9) concurrent-ruby (1.1.10)
diff-lcs (1.4.4) diff-lcs (1.4.4)
htmlentities (4.3.4) htmlentities (4.3.4)
i18n (1.8.10) i18n (1.10.0)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
marcel (1.0.2) marcel (1.0.2)
mini_portile2 (2.6.1) mini_portile2 (2.8.0)
minitest (5.14.4) minitest (5.15.0)
nokogiri (1.12.4) nokogiri (1.13.4)
mini_portile2 (~> 2.6.1) mini_portile2 (~> 2.8.0)
racc (~> 1.4) racc (~> 1.4)
racc (1.5.2) racc (1.6.0)
rake (12.3.3) rake (12.3.3)
redis (4.4.0) redis (4.6.0)
redis-objects (1.5.1) redis-objects (1.5.1)
redis (~> 4.2) redis (~> 4.2)
roo (2.8.3) roo (2.9.0)
nokogiri (~> 1) nokogiri (~> 1)
rubyzip (>= 1.3.0, < 3.0.0) rubyzip (>= 1.3.0, < 3.0.0)
roo-xls (1.2.0) roo-xls (1.2.0)
...@@ -74,7 +79,6 @@ GEM ...@@ -74,7 +79,6 @@ GEM
tallty_duck_record tallty_duck_record
tzinfo (2.0.4) tzinfo (2.0.4)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
zeitwerk (2.4.2)
zip-zip (0.3) zip-zip (0.3)
rubyzip (>= 1.0.0) rubyzip (>= 1.0.0)
......
...@@ -3,6 +3,7 @@ require "tallty_import_export/version" ...@@ -3,6 +3,7 @@ require "tallty_import_export/version"
require 'axlsx' require 'axlsx'
require 'redis' require 'redis'
require 'tallty_form' require 'tallty_form'
require 'attr_json'
module TalltyImportExport module TalltyImportExport
extend ActiveSupport::Autoload extend ActiveSupport::Autoload
......
...@@ -17,6 +17,7 @@ module TalltyImportExport ...@@ -17,6 +17,7 @@ module TalltyImportExport
# { key: 'user_department_name', name: '考核人部门' }, # { key: 'user_department_name', name: '考核人部门' },
# { key: 'state', name: '考核状态', method: :state_zh }, # { key: 'state', name: '考核状态', method: :state_zh },
# { key: 'score', name: '考核分', source: true }, # { key: 'score', name: '考核分', source: true },
# { key: 'model_key', name: '关键字', list: [ { key: 'model_key', name: '新属性' } ]},
# ] # ]
# export_headers_result / headers # export_headers_result / headers
# key: 属性的英文名,可以支持user.name这样的方式 # key: 属性的英文名,可以支持user.name这样的方式
...@@ -31,6 +32,7 @@ module TalltyImportExport ...@@ -31,6 +32,7 @@ module TalltyImportExport
# select: [{ label: '已报备', value: 'submitted'}, ...],需要转换的枚举类型 # select: [{ label: '已报备', value: 'submitted'}, ...],需要转换的枚举类型
# source: true,如果source为true,代表从association_record 进行属性查询 # source: true,如果source为true,代表从association_record 进行属性查询
# proc: proc或者lamda,支持call,传入 record 和 context # proc: proc或者lamda,支持call,传入 record 和 context
# list: 对于list布局的,进行嵌套,生成子表格
def export_xlsx records, **options def export_xlsx records, **options
records = with_scope records records = with_scope records
......
...@@ -14,8 +14,7 @@ Gem::Specification.new do |spec| ...@@ -14,8 +14,7 @@ Gem::Specification.new do |spec|
spec.platform = Gem::Platform::RUBY spec.platform = Gem::Platform::RUBY
# Specify which files should be added to the gem when it is released. # Specify which files should be added to the gem when it is released. The `git ls-files -z` loads the files in the RubyGem that have been added into git.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
end end
...@@ -31,4 +30,5 @@ Gem::Specification.new do |spec| ...@@ -31,4 +30,5 @@ Gem::Specification.new do |spec|
spec.add_dependency('activesupport') spec.add_dependency('activesupport')
spec.add_dependency('redis') spec.add_dependency('redis')
spec.add_dependency('redis-objects') spec.add_dependency('redis-objects')
spec.add_dependency 'attr_json'
end end
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