king
2020-04-03 4c6bdfe1f3557e49a315c1564bcb6164c0bc7faa
src/tabviews/zshare/mutilform/index.jsx
@@ -270,17 +270,17 @@
    callback()
  }
  getFields() {
  getFields(formlist) {
    const { getFieldDecorator } = this.props.form
    const { cols } = this.state
    const fields = []
    this.state.formlist.forEach((item, index) => {
      if ((!item.field && item.type !== 'title') || item.hidden === 'true') return
    formlist.forEach((item, index) => {
      // if ((!item.field && item.type !== 'title') || item.hidden === 'true') return
      if (item.supField && !item.supvalue.includes(this.props.form.getFieldValue(item.supField))) return
      // if (item.supField && !item.supvalue.includes(this.props.form.getFieldValue(item.supField))) return
      if (item.type === 'title') {
        fields.push(
          <Col span={24} key={index}>
@@ -519,7 +519,7 @@
                  }
                ]
              })(
                <FileUpload />
                <FileUpload maxFile={item.maxfile} fileType={item.fileType || 'text'} />
              )}
            </Form.Item>
          </Col>
@@ -685,6 +685,7 @@
  }
  render() {
    const { formlist, cols } = this.state
    const formItemLayout = {
      labelCol: {
        xs: { span: 24 },
@@ -695,9 +696,40 @@
        sm: { span: 16 }
      }
    }
    let _formlist = []
    let rowIndex = 0
    let colIndex = 0
    formlist.forEach(item => {
      if ((!item.field && item.type !== 'title') || item.hidden === 'true' || item.type === 'funcvar') return
      if (item.supField && !item.supvalue.includes(this.props.form.getFieldValue(item.supField))) return
      _formlist[rowIndex] = _formlist[rowIndex] || []
      if (item.type === 'textarea' || item.type === 'title') {
        if (colIndex === 0) {
          _formlist[rowIndex].push(item)
        } else {
          rowIndex++
          _formlist[rowIndex] = [item]
        }
        rowIndex++
        colIndex = 0
      } else {
        _formlist[rowIndex].push(item)
        colIndex++
      }
      if (colIndex >= cols) {
        rowIndex++
        colIndex = 0
      }
    })
    return (
      <Form {...formItemLayout} className="ant-advanced-search-form main-form-field" id="main-form-box">
        <Row gutter={24}>{this.getFields()}</Row>
        {/* <Row gutter={24}>{this.getFields(formlist)}</Row> */}
        {_formlist.map((formrow, index) => <Row key={index} gutter={24}>{this.getFields(formrow)}</Row>)}
      </Form>
    )
  }