import React from 'react'; import { Icon, Modal, Button, Form, Upload, message, Input, Spin, Checkbox, Select } from 'antd'; import './comprehensive.less'; import ajax from 'jquery/src/ajax/xhr.js' import $ from 'jquery/src/ajax'; import { getBase64, beforeUpload, companySearch } from '../../../tools.js'; class Avatar extends React.Component { constructor(props) { super(props); this.state = { imageUrl: '' } } handleChange(info) { if (!this.props.oid || this.props.oid === "") { message.warning('请先选择公司!'); return; }; if (info.file.status === 'done') { // Get this url from response in real world. getBase64(info.file.originFileObj, imageUrl => this.setState({ imageUrl })); this.props.urlData(info.file.response.data); } } render() { return ( ); } }; const PatentAddFrom = Form.create()(React.createClass({ getCompanyList() { this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/techservice/patent/getUnitNames", success: function (data) { if (data.error.length || !data.data) { return; }; let _me = this; for (var item in data.data) { _me.state.companyOption.push( {data.data[item]} ) }; }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); }, getInitialState() { return { loading: false, companyOption: [], firstCheck: 0, secondCheck: 0, thirdCheck: 0 }; }, componentWillMount() { this.getCompanyList(); }, handleSubmit(e) { e.preventDefault(); if (!this.state.companyName || this.state.companyName === "") { message.warning('请先选择公司!'); return; }; this.props.form.validateFields((err, values) => { if (!err) { this.props.spinState(true); $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context + "/techservice/patent/manageApplyPatent", data: { 'uid': this.state.companyName, 'firstInventorIdNumber': values.firstInventorID, 'firstInventorName': values.firstInventorName, 'patentDes': values.intro, 'secondInventorName': values.secondInventorName, 'thirdInventorName': values.thirdInventorName, 'firstInventorIsPublish': this.state.firstCheck, 'secondInventorIsPublish': this.state.secondCheck, 'thirdInventorIsPublish': this.state.thirdCheck, 'patentProryStatementUrl': this.state.avatarUrl } }).done(function (data) { if (!data.error.length) { message.success('保存成功!'); this.props.okClick(); this.props.closeModal(); } else { message.warning(data.error[0].message); } }.bind(this)).always(function () { this.props.spinState(false); this.props.form.resetFields(); }.bind(this)); } }); }, firstInventorCheck(e) { if (e.target.checked == true) { this.state.firstCheck = 1; } else if (e.target.checked == false) { this.state.firstCheck = 0; } }, secondInventorCheck(e) { if (e.target.checked == true) { this.state.secondCheck = 1; } else if (e.target.checked == false) { this.state.secondCheck = 0; }; }, thirdInventorCheck(e) { if (e.target.checked == true) { this.state.thirdCheck = 1; } else if (e.target.checked == false) { this.state.thirdCheck = 0; }; }, avatarUrl(e) { this.state.avatarUrl = e; }, render() { const FormItem = Form.Item; const { getFieldDecorator } = this.props.form; const formItemLayout = { labelCol: { span: 3 }, wrapperCol: { span: 14 }, }; const _me = this; return (
{getFieldDecorator('intro', { initialValue: this.state.intro || null })( )}

第一发明人

{getFieldDecorator('firstInventorName', { rules: [{ required: true, message: 'Please input name!' }] })( )} 告知专利局是否公布 {getFieldDecorator('firstInventorID', { rules: [{ required: true, message: 'Please input ID!' }] })( )}

第二发明人

{getFieldDecorator('secondInventorName')( )} 告知专利局是否公布

第三发明人

{getFieldDecorator('thirdInventorName')( )} 告知专利局是否公布 {getFieldDecorator('avatar')( )}

{ window.open(globalConfig.context + "/open/downloadTemplateFile?sign=patent_prory_statement") }}>模板下载

); }, })); const PatentAdd = React.createClass({ getInitialState() { return { visible: false, loading: false }; }, showModal() { this.setState({ visible: true, }); }, handleOk() { this.setState({ visible: false, }); }, handleCancel(e) { this.setState({ visible: false, }); this.props.closeDesc(false); }, spinChange(e) { this.setState({ loading: e }); }, render() { return (
{ this.props.closeDesc(false, true) }} />
); }, }); export default PatentAdd;