import React from 'react'; import { Button, Input, Select, message, Modal, Checkbox } from 'antd'; import ajax from 'jquery/src/ajax/xhr.js'; import $ from 'jquery/src/ajax'; const ApplyAdd = React.createClass({ getInitialState() { return { visible: false, loading: false }; }, getContactsList() { $.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/user/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), }); $.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/user/getDepartment", success: function (data) { if (data.error.length || !data.data) { message.warning(data.error[0].message); return; }; let theOption = []; for (var item in data.data) { theOption.push( {data.data[item]} ); }; this.setState({ departmentOption: theOption }) }.bind(this), }); }, componentWillReceiveProps(nextProps) { this.state.visible = nextProps.showAdd; this.getContactsList(); }, showModal() { this.setState({ visible: true, }); }, handleOk() { this.setState({ loading: true }); if (!this.state.contacts) { message.warning('请选择一个联系人!'); this.setState({ loading: false }); return; }; $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/user/techproject/applyTechProject", data: { contacts: this.state.contacts, department: this.state.department, dispatchInfo: this.state.dispatchInfo, projectName: this.state.projectName, projectCatagory: this.state.projectCatagory, techField: this.state.techField, projectDes: this.state.projectDes, projectMode: this.state.projectMode, projectApproval: this.state.projectApproval, subsidy: this.state.subsidy, consultant: this.state.consultant, } }).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 }); }, projectEstablishmentCheck(e) { if (e.target.checked == true) { this.state.projectMode = 1; } else if (e.target.checked == false) { this.state.projectMode = 0; }; }, subsidyCheck(e) { if (e.target.checked == true) { this.state.subsidy = 1; } else if (e.target.checked == false) { this.state.subsidy = 0; }; }, render() { return (
确认 , , ]} >
选择联系人:
选择申报科技部门:
派单信息:
{ this.state.dispatchInfo = e.target.value; }} />
项目名称: { this.state.projectName = e.target.value; }} />
项目类型: { this.state.projectCatagory = e.target.value; }} />
技术领域: { this.state.techField = e.target.value; }} />
项目介绍:
{ this.state.projectDes = e.target.value; }} />
是否立项:
立项金额: { this.state.projectApproval = e.target.value; }} /> 万元
是否后补助:
选择咨询师:
); } }); export default ApplyAdd;