FormPage.js 1.4 KB
import React,{PropTypes} from 'react';
import ReactDOM from 'react-dom'; 
import FormWrap from './FormRender'; 
import ClosePageBtn from './ClosePageBtn'; 
import cx from 'classnames';
import s from './FormPage.scss';
 

 
class FormPage extends React.Component {
    constructor(props) {
        super(props);    
        this.state={
            customForm:null
        }
    }
    static propTypes = {   
        formName:PropTypes.string,
        baseUrl:PropTypes.string,
        fieldsConfig:PropTypes.object,
        column:PropTypes.number,
        className:PropTypes.string,
        submit:PropTypes.func,
        customSection:PropTypes.func,
        customSectionKeys:PropTypes.array, 
        defaultValues:PropTypes.object,
        type:PropTypes.string,
        needApprover:PropTypes.bool,
        closePage:PropTypes.func  
    }
    static defaultProps = {  
         className:'container-fluid',
         column:1 
    } 
    componentDidMount(){   
        this.setState({
            customForm:<FormWrap {...this.props} /> 
        })
    }
    render(){  
        const {closePage}=this.props; 
        return (
            <div className={cx(s.custom_form_page_wrap)}> 
                <div className={cx(s.custom_page_wrap)}>
                    {this.state.customForm}  
                </div> 
                <ClosePageBtn onClick={closePage} click={true} label='关闭'></ClosePageBtn>
            </div>
        )
    }
}

export default FormPage;