From f6626b05f1275cc2f8ca77f773d4f6a6af1b0a89 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 21 十一月 2022 16:11:55 +0800 Subject: [PATCH] 2022-11-21 --- src/menu/replaceField/index.jsx | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 50 insertions(+), 7 deletions(-) diff --git a/src/menu/replaceField/index.jsx b/src/menu/replaceField/index.jsx index 81e4921..64353b0 100644 --- a/src/menu/replaceField/index.jsx +++ b/src/menu/replaceField/index.jsx @@ -154,10 +154,12 @@ }) } + // 渚濇嵁鍘熷瓧娈垫浛鎹负鏂板瓧娈� 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') { @@ -209,6 +211,9 @@ return col }) } + if (m.config && m.config.components) { + m.config.components = _replace(m.config.components) + } }) } @@ -235,6 +240,9 @@ return col }) } + if (m.config && m.config.components) { + m.config.components = _replace(m.config.components) + } return m }) } @@ -259,6 +267,9 @@ } return col }) + } + if (m.config && m.config.components) { + m.config.components = _replace(m.config.components) } return m }) @@ -295,6 +306,9 @@ } return col }) + } + if (m.config && m.config.components) { + m.config.components = _replace(m.config.components) } return m }) @@ -363,6 +377,9 @@ return col }) } + if (m.config && m.config.components) { + m.config.components = _replace(m.config.components) + } return m }) @@ -389,12 +406,21 @@ 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 @@ -423,7 +449,7 @@ } 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 @@ -449,10 +475,12 @@ }, 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') { @@ -500,6 +528,9 @@ return col }) } + if (m.config && m.config.components) { + m.config.components = _replace(m.config.components) + } }) } @@ -524,6 +555,9 @@ return col }) } + if (m.config && m.config.components) { + m.config.components = _replace(m.config.components) + } return m }) @@ -542,12 +576,21 @@ 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 @@ -573,7 +616,7 @@ } 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 -- Gitblit v1.8.0