|
@@ -14,23 +14,19 @@ const AchievementDetailForm = Form.create()(React.createClass({
|
|
|
|
|
|
handleSubmit(e) {
|
|
|
e.preventDefault();
|
|
|
- if(this.state.companyNamet.length>64){
|
|
|
+ this.props.form.validateFields((err, values) => {
|
|
|
+ if(values.name.length>64){
|
|
|
message.warning('客户名称字数不超过64个')
|
|
|
return false;
|
|
|
- };
|
|
|
- if(this.state.content.length>32){
|
|
|
- message.warning('联系人字数不超过32个')
|
|
|
- return false;
|
|
|
- };
|
|
|
- if(this.state.telnum.length>13){
|
|
|
- message.warning('电话号码字数不超过13个')
|
|
|
- return false;
|
|
|
- };
|
|
|
- if(this.state.societyTagt==undefined){
|
|
|
- message.warning('请填写社会属性!')
|
|
|
- return false;
|
|
|
- };
|
|
|
- this.props.form.validateFields((err, values) => {
|
|
|
+ };
|
|
|
+ if(values.content.length>32){
|
|
|
+ message.warning('联系人字数不超过32个')
|
|
|
+ return false;
|
|
|
+ };
|
|
|
+ if(values.length>13){
|
|
|
+ message.warning('电话号码字数不超过13个')
|
|
|
+ return false;
|
|
|
+ };
|
|
|
if (!err) {
|
|
|
this.setState({
|
|
|
loading: true
|
|
@@ -41,10 +37,10 @@ const AchievementDetailForm = Form.create()(React.createClass({
|
|
|
crossDomain: false,
|
|
|
url: globalConfig.context + '/api/admin/customer/addCustomer',
|
|
|
data: {
|
|
|
- name: values.companyNamet,
|
|
|
+ name: values.name,
|
|
|
contacts:values.content,
|
|
|
contactMobile: values.telnum,
|
|
|
- societyTag:this.state.societyTagt,
|
|
|
+ societyTag:values.societyTagt,
|
|
|
type:'1'
|
|
|
}
|
|
|
}).done(function (data) {
|
|
@@ -75,14 +71,14 @@ const AchievementDetailForm = Form.create()(React.createClass({
|
|
|
}
|
|
|
},
|
|
|
componentWillMount() {
|
|
|
- this.state.companyNamet='';
|
|
|
+ this.state.name='';
|
|
|
this.state.content='';
|
|
|
this.state.telnum='';
|
|
|
this.state.societyTagt=undefined;
|
|
|
},
|
|
|
componentWillReceiveProps(nextProps) {
|
|
|
if (!this.props.visible && nextProps.visible) {
|
|
|
- this.state.companyNamet='';
|
|
|
+ this.state.name='';
|
|
|
this.state.content='';
|
|
|
this.state.telnum='';
|
|
|
this.state.societyTagt=undefined;
|
|
@@ -144,14 +140,18 @@ const AchievementDetailForm = Form.create()(React.createClass({
|
|
|
{...formItemLayout}
|
|
|
label="社会属性"
|
|
|
>
|
|
|
- <Select placeholder="客户社会属性" value={this.state.societyTagt} onChange={(e) => { this.setState({ societyTagt: e}); }}>
|
|
|
+ {getFieldDecorator('societyTagt', {
|
|
|
+ rules: [{ required: true, message: '此项为必填项!' }],
|
|
|
+ initialValue: this.state.societyTagt
|
|
|
+ })(
|
|
|
+ <Select placeholder="客户社会属性">
|
|
|
{
|
|
|
socialAttribute.map(function (item) {
|
|
|
return <Select.Option key={item.value} >{item.key}</Select.Option>
|
|
|
})
|
|
|
}
|
|
|
</Select>
|
|
|
-
|
|
|
+ )}
|
|
|
</FormItem>
|
|
|
</div>
|
|
|
<FormItem wrapperCol={{ span: 12, offset: 4 }}>
|