king
2022-11-08 d0e8c7cb64d7d219f7cfec8bc87cf699b9cfe7b2
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