Commit 92dd9f82 by rxqiang

fix:udpate cell

parent 7f5e7e64
......@@ -44,7 +44,11 @@ class TalltyImportExport::ExportPayload::Cell
def divise
if @header.children.present? && @value.value
new_cells = @header.children.map do |child_header|
val = @value_handler.call(@value.value, child_header.as_json.symbolize_keys, keep_array: true)
# 分离 header 属性,保留 proc
header_attrs = child_header.as_json.symbolize_keys
header_attrs[:proc] = child_header.proc if child_header.proc.present?
val = @value_handler.call(@value.value, header_attrs, keep_array: true)
if (child_header.children.present? && val.is_a?(Array))
val.map do |val|
cell = TalltyImportExport::ExportPayload::Cell.new(
......@@ -57,7 +61,11 @@ class TalltyImportExport::ExportPayload::Cell
cell
end
else
val = @value_handler.call(@value.value, child_header.as_json.symbolize_keys)
# 这里也需要保留 proc
header_attrs = child_header.as_json.symbolize_keys
header_attrs[:proc] = child_header.proc if child_header.proc.present?
val = @value_handler.call(@value.value, header_attrs)
TalltyImportExport::ExportPayload::Cell.new(
child_header,
TalltyImportExport::ExportPayload::Value.new(val, @value.chain),
......
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