import React from 'react'; import { Icon, Modal, Button, Form, Upload, message, Input, Spin, Select } from 'antd'; import { beforeUploadFile, downloadFile, setUserContactsList } from '../../tools.js'; import './patent.less'; import ajax from 'jquery/src/ajax/xhr.js' import $ from 'jquery/src/ajax'; const PatentAddFrom = Form.create()(React.createClass({ getInitialState() { return { loading: false }; }, componentWillMount() { let theOption = []; $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/user/getContacts', success: function (data) { if (!data.data) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; } else { for (let item in data.data) { let theData = data.data[item]; theOption.push( {theData} ); }; }; } }); this.setState({ contactsOption: theOption }); }, handleSubmit(e) { e.preventDefault(); if (!this.state.patentProryStatementUrl) { 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 + "/api/user/patent/clientApplyPatent", data: { 'firstInventorIdNumber': values.firstInventorID, 'firstInventorName': values.firstInventorName, 'patentDes': values.intro, 'patentName': values.patentName, 'contacts': values.contacts, 'secondInventorName': values.secondInventorName, 'thirdInventorName': values.thirdInventorName, 'patentProryStatementUrl': this.state.patentProryStatementUrl } }).done(function (data) { if (!data.error.length) { message.success('保存成功!'); } else { message.warning(data.error[0].message); } }.bind(this)).always(function () { this.props.spinState(false); this.props.clickOk(); this.props.form.resetFields(); }.bind(this)); } }); }, avatarUrl(e) { this.state.avatarUrl = e; }, checkIdcardnum(rule, value, callback) { if (!/(^\d{15}$)|(^\d{17}(\d|X)$)/.test(value)) { callback('请输入正确的身份证号!'); } else { callback(); } }, render() { const FormItem = Form.Item; const { getFieldDecorator } = this.props.form; const formItemLayout = { labelCol: { span: 3 }, wrapperCol: { span: 16 }, }; const _me = this; return (
{getFieldDecorator('patentName', { rules: [{ required: true, message: '请输入姓名!' }] })( )} {getFieldDecorator('contacts', { rules: [{ required: true, message: '请选择一个联系人!' }] })( )} {getFieldDecorator('intro', { initialValue: this.state.intro || null })( )}

第一发明人

{getFieldDecorator('firstInventorName', { rules: [{ required: true, message: '请输入姓名!' }] })( )} {getFieldDecorator('firstInventorID', { rules: [{ required: true, validator: this.checkIdcardnum, message: '请输入正确的身份证号!' }] })( )}

第二发明人

{getFieldDecorator('secondInventorName')( )}

第三发明人

{getFieldDecorator('thirdInventorName')( )}
{ if (info.file.status !== 'uploading') { // console.log(info.file, info.fileList); } if (info.file.status === 'done') { if (!info.file.response.error.length) { message.success(`${info.file.name} 文件上传成功!`); } else { message.warning(info.file.response.error[0].message); return; }; this.state.patentProryStatementUrl = info.file.response.data; } else if (info.file.status === 'error') { message.error(`${info.file.name} 文件上传失败。`); }; this.setState({ fileList: info.fileList.slice(-1) }); }} >

{ window.open(globalConfig.context + "/api/user/patent/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, }); this.props.closeDesc(false, true); }, handleCancel(e) { this.setState({ visible: false, }); this.props.closeDesc(false); }, spinChange(e) { this.setState({ loading: e }); }, render() { return (
); }, }); export default PatentAdd;