king
2019-12-21 75347779d54c3c8a0893166dbb9c03bc06ea1eee
src/tabviews/commontable/mainSearch/index.jsx
@@ -14,26 +14,39 @@
  state = {
    match: null, // 搜索条件匹配规则
    style: null
    style: null,
    searchlist: null
  }
  UNSAFE_componentWillMount () {
    let match = {}
    let style = {}
    let _list = []
    let fieldMap = new Map()
    this.props.searchlist.forEach(item => {
      if (fieldMap.has(item.field)) {
        item.field = item.field + '@tail@'
      }
      fieldMap.set(item.field, true)
      match[item.field] = item.match
      style[item.field] = item.type
      _list.push(item)
    })
    this.setState({
      match: match,
      style: style
      style: style,
      searchlist: _list
    })
  }
  getFields() {
    const { getFieldDecorator } = this.props.form
    const fields = []
    this.props.searchlist.forEach((item, index) => {
    this.state.searchlist.forEach((item, index) => {
      if (item.type === 'text') { // 文本搜索
        fields.push(
          <Col span={6} key={index}>
@@ -186,7 +199,7 @@
        }
        search.push({
          type: this.state.style[key],
          key: key,
          key: key.replace(/@tail@$/, ''),
          value: _value,
          match: this.state.match[key]
        })
@@ -197,7 +210,7 @@
        }
        search.push({
          type: this.state.style[key],
          key: key,
          key: key.replace(/@tail@$/, ''),
          value: _value,
          match: this.state.match[key]
        })
@@ -208,7 +221,7 @@
        }
        search.push({
          type: this.state.style[key],
          key: key,
          key: key.replace(/@tail@$/, ''),
          value: _value,
          match: this.state.match[key]
        })
@@ -219,14 +232,14 @@
        }
        search.push({
          type: this.state.style[key],
          key: key,
          key: key.replace(/@tail@$/, ''),
          value: _value,
          match: this.state.match[key]
        })
      } else {
        search.push({
          type: this.state.style[key],
          key: key,
          key: key.replace(/@tail@$/, ''),
          value: values[key].replace(/(^\s*|\s*$)/ig, ''),
          match: this.state.match[key]
        })