import React from 'react';
import { Icon, Modal, Button, Form, message, Input, Spin, Select, Row, Col } from 'antd';
import './comprehensive.less';
import { companySearch } from '../../../tools.js';
import ajax from 'jquery/src/ajax/xhr.js'
import $ from 'jquery/src/ajax';
const PatentAddFrom = Form.create()(React.createClass({
getContactsList() {
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/user/cognizance/getContacts",
success: function (data) {
let theOption = [];
if (data.error.length || !data.data) {
return;
};
for (let item in data.data) {
let theData = data.data[item];
theOption.push(
{theData}
);
};
this.setState({
contactsOption: theOption
});
}.bind(this),
});
},
getInitialState() {
return {
loading: false,
companyOption: [],
accelerated: 0,
visible: "visible"
};
},
handleSubmit(e) {
e.preventDefault();
this.props.form.validateFields((err, values) => {
if (!err) {
this.props.spinState(true);
$.ajax({
method: "POST",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/user/copyright/apply",
data: {
//"uid": values.uid, // 公司用户id,size 0-36, required
"contact": values.contact, // 联系人, 1,2,3
"copyrightInfo": values.copyrightInfo, // 软著简介,size 0-255
"copyrightName": values.copyrightName, // 软著名称, size 0-60
//"outsource": values.outsource, // 外包公司, size 0-60
"comment": values.workIssue, // 派单信息, size 0-128
"inUrgent": values.inUrgent, // 加急天数,
//"comment": values.comment, // 备注 size 0-128
//"principal": values.principal // 负责人id
}
}).done(function (data) {
if (!data.error.length) {
message.success('保存成功!');
this.props.okClick();
this.props.closeModal();
this.props.form.resetFields();
} else {
message.warning(data.error[0].message);
}
}.bind(this)).always(function () {
this.props.spinState(false);
}.bind(this));
}
});
},
componentWillMount() {
this.getContactsList();
},
componentWillReceiveProps(nextProps) {
if (!this.props.visible && nextProps.visible) {
this.state.visible = "visible";
this.props.form.resetFields();
};
},
render() {
const FormItem = Form.Item;
const { getFieldDecorator } = this.props.form;
const formItemLayout = {
labelCol: { span: 4 },
wrapperCol: { span: 14 },
};
const _me = this;
return (
);
},
}));
const PatentAdd = React.createClass({
getInitialState() {
return {
visible: false,
loading: false
};
},
showModal() {
this.setState({
visible: true,
});
},
handleCancel(e) {
this.setState({
visible: false,
});
this.props.closeAdd(false);
},
spinChange(e) {
this.setState({
loading: e
});
},
render() {
return (
{ this.props.closeAdd(false, true) }} />
);
},
});
export default PatentAdd;