|
@@ -27,15 +27,16 @@ class AddLabelForm extends React.Component {
|
|
|
handleSubmit = e => {
|
|
|
e.preventDefault();
|
|
|
const _this = this;
|
|
|
+ let params = { id: _this.state.label.id, pid: _this.state.label.pid };
|
|
|
this.props.form.validateFieldsAndScroll((err, values) => {
|
|
|
if (!err) {
|
|
|
if (_this.state.label.id) {
|
|
|
- _this.props.setAlitaState({ funcName: 'labelEdit', params: values })
|
|
|
- .then((resp)=>{
|
|
|
- console.log(' resp ',resp)
|
|
|
- })
|
|
|
+ _this.props.setAlitaState({ funcName: 'labelEdit', params: { ...values, ...params } })
|
|
|
+ .then((resp) => {
|
|
|
+ console.log(' resp ', resp);
|
|
|
+ });
|
|
|
} else {
|
|
|
- _this.props.setAlitaState({ funcName: 'labelAdd', params: values });
|
|
|
+ _this.props.setAlitaState({ funcName: 'labelAdd', params: { ...values, ...params } });
|
|
|
}
|
|
|
}
|
|
|
});
|
|
@@ -57,13 +58,12 @@ class AddLabelForm extends React.Component {
|
|
|
}
|
|
|
|
|
|
render() {
|
|
|
- console.log('props=>',this.props)
|
|
|
const { getFieldDecorator } = this.props.form;
|
|
|
let { label } = this.props;
|
|
|
if (!label) return null;
|
|
|
const { data: dataSource, isFetching } = this.props.searchLabel || { data: {} };
|
|
|
- const { isFetching: isSubmitLoading } = this.props.labelAdd||{};
|
|
|
- const { isFetching: isEditLoading } = this.props.labelEdit||{};
|
|
|
+ const { isFetching: isSubmitLoading } = this.props.labelAdd || {};
|
|
|
+ const { isFetching: isEditLoading } = this.props.labelEdit || {};
|
|
|
|
|
|
if (!dataSource.records) dataSource.records = [];
|
|
|
return (<Form onSubmit={this.handleSubmit}>
|
|
@@ -74,12 +74,6 @@ class AddLabelForm extends React.Component {
|
|
|
onSelect={this.onSelect.bind(this, dataSource.records)}
|
|
|
placeholder='输入关键词查询上级标签'/>)}
|
|
|
</Form.Item>)}
|
|
|
- <Form.Item style={{ display: 'none' }}>
|
|
|
- {getFieldDecorator('id', { initialValue: label.id })}(<Input/>
|
|
|
- </Form.Item>
|
|
|
- <Form.Item style={{ display: 'none' }}>
|
|
|
- {getFieldDecorator('pid', { initialValue: label.pid })}(<Input/>
|
|
|
- </Form.Item>
|
|
|
<Form.Item>
|
|
|
{getFieldDecorator('label', {
|
|
|
rules: [{ required: true, message: '请输入标签' }],
|
|
@@ -103,4 +97,4 @@ class AddLabelForm extends React.Component {
|
|
|
|
|
|
}
|
|
|
|
|
|
-export default connectAlita(['searchLabel', 'labelAdd','labelEdit'])(Form.create({ name: 'AddLabelForm' })(AddLabelForm));
|
|
|
+export default connectAlita(['searchLabel', 'labelAdd', 'labelEdit'])(Form.create({ name: 'AddLabelForm' })(AddLabelForm));
|