king
2022-04-29 eec619b6e3339e9999a7a1c2c5454cef5d763b24
src/mob/modalconfig/index.jsx
@@ -65,6 +65,7 @@
  }
  componentDidMount () {
    MKEmitter.addListener('submitStyle', this.getStyle)
    MKEmitter.addListener('completeSave', this.completeSave)
  }
@@ -75,11 +76,30 @@
    this.setState = () => {
      return
    }
    MKEmitter.removeListener('submitStyle', this.getStyle)
    MKEmitter.removeListener('completeSave', this.completeSave)
  }
  completeSave = () => {
    this.setState({saving: false})
  }
  getStyle = (comIds, style) => {
    const { config } = this.state
    if (comIds[0] !== 'form') return
    let Index = config.fields.findIndex(n => n.uuid === comIds[1])
    if (Index === -1) return
    let _config = fromJS(config).toJS()
    _config.fields[Index].style = style
    this.setState({
      config: _config
    })
  }
  /**
@@ -132,17 +152,22 @@
        index = i
      }
      let label = item.label || ''
      if (item.field && item.field.toLowerCase() !== label.toLowerCase()) {
        label = label + ' (' + item.field + ')'
      }
      if (['text', 'number', 'textarea', 'color'].includes(item.type) && card.field !== item.field) {
        _inputfields.push({
          field: item.field,
          label: _inputIndex + '、' + item.label
          label: _inputIndex + '、' + label
        })
        _inputIndex++
      }
      if (card.field !== item.field && item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type)) {
        _tabfields.push({
          field: item.field,
          label: _tabIndex + '、' + item.label
          label: _tabIndex + '、' + label
        })
        _tabIndex++
      }
@@ -150,7 +175,7 @@
      if (item.type === 'switch') {
        _linksupFields.push({
          field: item.field,
          label: _linkIndex + '、' + item.label
          label: _linkIndex + '、' + label
        })
      }
@@ -165,7 +190,7 @@
        })
        _linksupFields.push({
          field: item.field,
          label: _linkIndex + '、' + item.label
          label: _linkIndex + '、' + label
        })
        _linkIndex++
      }
@@ -223,6 +248,9 @@
        }
        if (item.uuid === res.uuid) {
          if (item.style) {
            res.style = item.style
          }
          return res
        } else {
          return item