| | |
| | | }) |
| | | } |
| | | |
| | | // 依据原字段替换为新字段 |
| | | exec = (map) => { |
| | | const { type } = this.props |
| | | let config = fromJS(this.props.config).toJS() |
| | | |
| | | if (this.props.type === 'custom') { |
| | | if (type === 'custom') { |
| | | let _replace = (components) => { |
| | | return components.map(item => { |
| | | if (item.type === 'tabs') { |
| | |
| | | return col |
| | | }) |
| | | } |
| | | if (m.config && m.config.components) { |
| | | m.config.components = _replace(m.config.components) |
| | | } |
| | | }) |
| | | } |
| | | |
| | |
| | | return col |
| | | }) |
| | | } |
| | | if (m.config && m.config.components) { |
| | | m.config.components = _replace(m.config.components) |
| | | } |
| | | return m |
| | | }) |
| | | } |
| | |
| | | } |
| | | return col |
| | | }) |
| | | } |
| | | if (m.config && m.config.components) { |
| | | m.config.components = _replace(m.config.components) |
| | | } |
| | | return m |
| | | }) |
| | |
| | | } |
| | | return col |
| | | }) |
| | | } |
| | | if (m.config && m.config.components) { |
| | | m.config.components = _replace(m.config.components) |
| | | } |
| | | return m |
| | | }) |
| | |
| | | return col |
| | | }) |
| | | } |
| | | if (m.config && m.config.components) { |
| | | m.config.components = _replace(m.config.components) |
| | | } |
| | | |
| | | return m |
| | | }) |
| | |
| | | item.cols = _update(item.cols) |
| | | } |
| | | |
| | | if (item.subtype === 'basetable') { |
| | | item.cols = item.cols.map(col => { |
| | | if (col.field && map[col.field.toLowerCase()]) { |
| | | col.field = map[col.field.toLowerCase()].FieldName |
| | | } |
| | | return col |
| | | }) |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | } |
| | | |
| | | |
| | | config.components = _replace(config.components) |
| | | } else if (this.props.type === 'table') { |
| | | } else if (type === 'table') { |
| | | config.columns = config.columns.map(col => { |
| | | if (col.field && map[col.field.toLowerCase()]) { |
| | | col.field = map[col.field.toLowerCase()].FieldName |
| | |
| | | } |
| | | return m |
| | | }) |
| | | } else if (this.props.type === 'form') { |
| | | } else if (type === 'form') { |
| | | config.fields = config.fields.map(col => { |
| | | if (col.field && map[col.field.toLowerCase()]) { |
| | | col.field = map[col.field.toLowerCase()].FieldName |
| | |
| | | }, 300) |
| | | } |
| | | |
| | | // 依据字段替换名称 |
| | | execLabel = (map) => { |
| | | const { type } = this.props |
| | | let config = fromJS(this.props.config).toJS() |
| | | |
| | | if (this.props.type === 'custom') { |
| | | if (type === 'custom') { |
| | | let _replace = (components) => { |
| | | return components.map(item => { |
| | | if (item.type === 'tabs') { |
| | |
| | | return col |
| | | }) |
| | | } |
| | | if (m.config && m.config.components) { |
| | | m.config.components = _replace(m.config.components) |
| | | } |
| | | }) |
| | | } |
| | | |
| | |
| | | return col |
| | | }) |
| | | } |
| | | if (m.config && m.config.components) { |
| | | m.config.components = _replace(m.config.components) |
| | | } |
| | | |
| | | return m |
| | | }) |
| | |
| | | item.cols = _update(item.cols) |
| | | } |
| | | |
| | | if (item.subtype === 'basetable') { |
| | | item.cols = item.cols.map(col => { |
| | | if (col.field && map[col.field.toLowerCase()]) { |
| | | col.label = map[col.field.toLowerCase()].FieldDec |
| | | } |
| | | return col |
| | | }) |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | } |
| | | |
| | | config.components = _replace(config.components) |
| | | } else if (this.props.type === 'table') { |
| | | } else if (type === 'table') { |
| | | config.columns = config.columns.map(col => { |
| | | if (col.field && map[col.field.toLowerCase()]) { |
| | | col.label = map[col.field.toLowerCase()].FieldDec |
| | |
| | | } |
| | | return m |
| | | }) |
| | | } else if (this.props.type === 'form') { |
| | | } else if (type === 'form') { |
| | | config.fields = config.fields.map(col => { |
| | | if (col.field && map[col.field.toLowerCase()]) { |
| | | col.label = map[col.field.toLowerCase()].FieldDec |