diff --git a/src/routes/List/TableList.js b/src/routes/List/TableList.js
index 8444af3f6dc037ed951989b9ff880a497d665d61..8ee98e3e73f620c4600eca56f1e949dcaeb2652c 100644
--- a/src/routes/List/TableList.js
+++ b/src/routes/List/TableList.js
@@ -11,11 +11,11 @@ const { Option } = Select;
const getValue = obj => Object.keys(obj).map(key => obj[key]).join(',');
const CreateForm = Form.create()((props) => {
- const { modalVisible, addInputValue, parent, form } = props;
+ const { modalVisible, form, handleAdd, handleModalVisible } = props;
const okHandle = () => {
- form.validateFields((err/* , fieldsValue */) => {
+ form.validateFields((err, fieldsValue) => {
if (err) return;
- parent.handleAdd();
+ handleAdd(fieldsValue);
});
};
return (
@@ -23,8 +23,7 @@ const CreateForm = Form.create()((props) => {
title="新建规则"
visible={modalVisible}
onOk={okHandle}
- destroyOnClose
- onCancel={() => parent.handleModalVisible()}
+ onCancel={() => handleModalVisible()}
>
{
{form.getFieldDecorator('desc', {
rules: [{ required: true, message: 'Please input some description...' }],
})(
-
+
)}
@@ -48,7 +47,6 @@ const CreateForm = Form.create()((props) => {
@Form.create()
export default class TableList extends PureComponent {
state = {
- addInputValue: '',
modalVisible: false,
expandForm: false,
selectedRows: [],
@@ -167,17 +165,11 @@ export default class TableList extends PureComponent {
});
}
- handleAddInput = (e) => {
- this.setState({
- addInputValue: e.target.value,
- });
- }
-
- handleAdd = () => {
+ handleAdd = (fields) => {
this.props.dispatch({
type: 'rule/add',
payload: {
- description: this.state.addInputValue,
+ description: fields.desc,
},
});
@@ -301,7 +293,7 @@ export default class TableList extends PureComponent {
render() {
const { rule: { data }, loading } = this.props;
- const { selectedRows, modalVisible, addInputValue } = this.state;
+ const { selectedRows, modalVisible } = this.state;
const menu = (