| | |
| | | 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}> |
| | |
| | | } |
| | | ] |
| | | })( |
| | | <FileUpload /> |
| | | <FileUpload maxFile={item.maxfile} fileType={item.fileType || 'text'} /> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { formlist, cols } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | |
| | | 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> |
| | | ) |
| | | } |