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(theUid) {
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/customer/findAllContacts",
data: {
uid: theUid || this.state.uid
},
success: function (data) {
let theOption = [];
if (!data.data) {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
return;
};
};
for (let item in data.data) {
let theData = data.data[item];
theOption.push(
{theData.name}
);
};
this.setState({
contactsOption: theOption
});
}.bind(this),
});
},
getInitialState() {
return {
loading: false,
companyOption: [],
accelerated: 0,
acceleratedDate: 0,
visible: "visible"
};
},
handleSubmit(e) {
e.preventDefault();
this.props.form.validateFields((err, values) => {
if (!values.uid || values.uid === "") {
message.warning('请先选择公司!');
return;
};
if (!err) {
this.props.spinState(true);
$.ajax({
method: "POST",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/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, // 加急天数,
"salesman": values.salesman,//营销员
//"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));
}
});
},
render() {
const FormItem = Form.Item;
const { getFieldDecorator } = this.props.form;
const formItemLayout = {
labelCol: { span: 2 },
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) }}
companyOption={this.props.companyOption}
salesmanOption={this.props.salesmanOption}
consultantOption={this.props.consultantOption} />
);
},
});
export default PatentAdd;