Commit b068fd27 by liyijie

feat: 修改import_header_hash

parent 86d7c2da
...@@ -110,8 +110,16 @@ module TalltyImportExport ...@@ -110,8 +110,16 @@ module TalltyImportExport
true true
end end
# 需要合并proc,前端没有办法把proc传过来
def import_headers_result def import_headers_result
@headers ||= import_headers&.with_indifferent_access import_header_hash = import_headers.to_h { |header| [header.with_indifferent_access[:key], header] }.with_indifferent_access
@headers.map do |header|
key = header[:key]
if import_header_hash.fetch(key)&.fetch(:proc).present?
header[:proc] = import_header_hash.fetch(key)&.fetch(:proc)
end
header
end
end end
def import_options def import_options
...@@ -156,7 +164,7 @@ module TalltyImportExport ...@@ -156,7 +164,7 @@ module TalltyImportExport
_record = associations.find_or_initialize_by(line_info.clone.extract!(*primary_keys)) _record = associations.find_or_initialize_by(line_info.clone.extract!(*primary_keys))
_record.update!(line_info.clone.except!(*primary_keys, *@skip_keys)) _record.update!(line_info.clone.except!(*primary_keys, *@skip_keys))
else else
associations.create!(line_info) associations.create!(line_info.clone.except!(*@skip_keys))
end end
end end
end end
......
module TalltyImportExport module TalltyImportExport
VERSION = "1.0.30" VERSION = "1.0.31"
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