import React, { PureComponent } from 'react';
import { Form, Input, Card, Row, Col, Button, InputNumber, TreeSelect } from 'antd';
import { connect } from 'dva';
import Panel from '../../../components/Panel';
import styles from '../../../layouts/Sword.less';
import func from '../../../utils/Func';
import { DEPT_INIT, DEPT_SUBMIT, DEPT_DETAIL, DEPT_CLEAR_DETAIL } from '../../../actions/dept';
const FormItem = Form.Item;
const { TextArea } = Input;
@connect(({ dept, loading }) => ({
dept,
submitting: loading.effects['dept/submit'],
}))
@Form.create()
class DeptAdd extends PureComponent {
componentWillMount() {
const {
dispatch,
match: {
params: { id },
},
} = this.props;
if (func.notEmpty(id)) {
dispatch(DEPT_DETAIL(id));
} else {
dispatch(DEPT_CLEAR_DETAIL());
}
dispatch(DEPT_INIT());
}
handleSubmit = e => {
e.preventDefault();
const { dispatch, form } = this.props;
form.validateFieldsAndScroll((err, values) => {
if (!err) {
dispatch(DEPT_SUBMIT(values));
}
});
};
render() {
const {
form: { getFieldDecorator },
dept: {
detail,
init: { tree },
},
submitting,
} = this.props;
const formItemLayout = {
labelCol: {
span: 8,
},
wrapperCol: {
span: 16,
},
};
const formAllItemLayout = {
labelCol: {
span: 4,
},
wrapperCol: {
span: 20,
},
};
const action = (
);
return (
);
}
}
export default DeptAdd;