king
2019-11-12 b68697ccdce3f7de67c3a918701c814497b6b41a
src/components/sidemenu/comtableconfig/searchform/index.jsx
File was renamed from src/components/sidemenu/comtableconfig/menuform/index.jsx
@@ -1,5 +1,6 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
// import { is, fromJS } from 'immutable'
import { Form, Row, Col, Input, Select, Icon, Radio } from 'antd'
import moment from 'moment'
import EditTable from '../editable'
@@ -10,14 +11,15 @@
class MainSearch extends Component {
  static propTpyes = {
    dict: PropTypes.object, // 字典项
    formlist: PropTypes.array
    formlist: PropTypes.any
  }
  state = {
    card: null,
    inputType: 'text',
    selectType: 0,
    options: null
    options: null,
    formlist: null
  }
  openTypeChange = (key, value) => {
@@ -78,7 +80,7 @@
                  showSearch
                  filterOption={(input, option) => option.props.children[2].toLowerCase().indexOf(input.toLowerCase()) >= 0}
                  onChange={(value) => {this.openTypeChange(item.key, value)}}
                  getPopupContainer={() => document.getElementById('form-box')}
                  getPopupContainer={() => document.getElementById('commontable-search-form-box')}
                >
                  {item.options.map(option =>
                    <Select.Option id={option.MenuID} title={option.text} key={option.MenuID} value={option.MenuID}>
@@ -112,13 +114,7 @@
              <Col span={18} offset={6} key={'table' + index}>
                <Form.Item className="text-area">
                  {getFieldDecorator('datasource', {
                    initialValue: '',
                    rules: [
                      {
                        required: true,
                        message: this.props.dict['form.required.input'] + 'datasource !'
                      }
                    ]
                    initialValue: ''
                  })(<TextArea rows={4} />)}
                </Form.Item>
              </Col>
@@ -145,7 +141,10 @@
          }
          values.id = this.state.card.id
          values.uuid = this.state.card.uuid
          resolve(values)
          resolve({
            type: 'search',
            values
          })
        } else {
          reject(err)
        }
@@ -153,8 +152,9 @@
    })
  }
  UNSAFE_componentWillMount () {
    let _item = this.props.formlist.filter(cell => cell.key === 'type')[0]
  resetForm = (formlist) => {
    if (!formlist) return
    let _item = formlist.filter(cell => cell.key === 'type')[0]
    if (_item.initVal === 'select') {
      this.setState({
        inputType: 'select',
@@ -169,6 +169,10 @@
    }
  }
  UNSAFE_componentWillMount () {
    this.resetForm(this.props.formlist)
  }
  render() {
    const formItemLayout = {
      labelCol: {
@@ -181,7 +185,7 @@
      }
    }
    return (
      <Form {...formItemLayout} className="ant-advanced-search-form commontable-form" id="form-box">
      <Form {...formItemLayout} className="ant-advanced-search-form commontable-search-form" id="commontable-search-form-box">
        <Row gutter={24}>{this.getFields()}</Row>
      </Form>
    )