FormPage.js
1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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;