import React from 'react';
import { Button, Input, Select, message, Modal, Checkbox } from 'antd';
import { companySearch } from '../../../tools.js';
import ajax from 'jquery/src/ajax/xhr.js';
import $ from 'jquery/src/ajax';
const ApplyAdd = React.createClass({
getInitialState() {
return {
visible: false,
loading: false,
yearOption: []
};
},
getContactsList(theUid) {
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/getContacts",
data: {
uid: theUid
},
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),
});
},
componentWillReceiveProps(nextProps) {
this.state.visible = nextProps.showAdd
},
componentWillMount() {
let d = new Date();
let _me = this;
d = d.getFullYear() - 1;
this.state.thisYear = d;
for (let i = d; i < d + 20; i++) {
_me.state.yearOption.push(
{i}
)
};
},
showModal() {
this.setState({
visible: true,
});
},
handleOk() {
this.setState({
loading: true
});
if (!this.state.year) {
message.warning('请选择年份!');
this.setState({
loading: false
});
return;
};
if (!this.state.contacts) {
message.warning('请选择一个联系人!');
this.setState({
loading: false
});
return;
};
$.ajax({
method: "POST",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/applyCognizance",
data: {
year: this.state.year,
contacts: this.state.contacts,
comment: this.state.comment,
consultant: this.state.consultant,
uid: this.state.uid,
state: this.state.year == this.state.thisYear ? 0 : 7
}
}).done(function (data) {
if (!data.error.length) {
message.success('保存成功!');
this.setState({
visible: false
});
this.props.closeAdd(false);
} else {
message.warning(data.error[0].message);
this.setState({
loading: false
});
}
}.bind(this));
},
handleCancel(e) {
this.setState({
visible: false,
});
this.props.closeAdd(false);
},
spinChange(e) {
this.setState({
loading: e
});
},
render() {
return (
确认
,
,
]}
>
选择公司:
选择联系人:
选择申报科技部门:
选择咨询师:
);
}
});
export default ApplyAdd;