king
2021-09-27 54d01e6ef9ac31f10de4a0e92824eba50b77eda6
src/menu/components/search/main-search/index.jsx
@@ -76,6 +76,7 @@
  componentDidMount () {
    MKEmitter.addListener('submitStyle', this.getStyle)
    MKEmitter.addListener('plusSearch', this.plusSearch)
  }
  /**
@@ -86,6 +87,7 @@
      return
    }
    MKEmitter.removeListener('submitStyle', this.getStyle)
    MKEmitter.removeListener('plusSearch', this.plusSearch)
  }
  shouldComponentUpdate (nextProps, nextState) {
@@ -365,10 +367,28 @@
    })
  }
  updatefields = (config) => {
    this.setState({card: config}, ()=> {
      this.props.updateConfig(config)
    })
  plusSearch = (MenuId, item, type) => {
    const { card } = this.state
    if (MenuId !== card.uuid) return
    let _card = fromJS(card).toJS()
    if (type === 'simple') {
      _card.search.push(item)
      this.setState({
        card: _card,
      }, () => {
        this.props.updateConfig(_card)
      })
    } else if (type === 'multil') {
      _card.search.push(...item)
      this.setState({
        card: _card,
      }, () => {
        this.props.updateConfig(_card)
      })
    }
  }
  getWrapForms = () => {
@@ -394,7 +414,7 @@
    return (
      <div className={`main-search-edit-list ${card.wrap.float} ${card.wrap.show || ''}`} onClick={this.clickComponent} id={card.uuid} style={_style}>
        <FieldsComponent config={card} type="search" updatefield={this.updatefields} />
        <FieldsComponent config={card} type="search" />
        <Switch checkedChildren={dict['model.switch.open']} size="small" unCheckedChildren={dict['model.switch.close']} defaultChecked={showField} onChange={this.onFieldChange} />
        <DragElement
          list={card.search}