| | |
| | | if (res.copyType === 'form') { |
| | | delete res.copyType |
| | | res = {fields: [res]} |
| | | } else if (res.copyType === 'simpleform') { |
| | | res = {fields: res.subcards[0].fields} |
| | | } |
| | | |
| | | res.fields = res.fields || [] |
| | |
| | | let forms = fromJS(config.fields).toJS() |
| | | let fields = fromJS(result.fields).toJS() |
| | | let repeats = [] |
| | | let lastId = '' |
| | | |
| | | forms = forms.map(item => { |
| | | if (!item.field) return item |
| | |
| | | let cell = fields.filter(m => m.field && m.field.toLowerCase() === item.field.toLowerCase())[0] |
| | | if (cell) { |
| | | repeats.push(cell.field) |
| | | lastId = cell.uuid |
| | | return cell |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | if (lastId) { |
| | | window.GLOB.formId = lastId |
| | | } |
| | | |
| | | fields = fields.filter(m => !m.field || !repeats.includes(m.field)) |
| | | |