import React from 'react';
import { Icon, Modal, message, Spin, Steps, Input, Select, Upload, DatePicker, Button } from 'antd';
import './comprehensive.less';
import ajax from 'jquery/src/ajax/xhr.js';
import $ from 'jquery/src/ajax';
import { patentTypeList, patentFieldList, patentStateList } from '../../../dataDic.js';
import { getBase64, beforeUpload, getPatentState, getTime } from '../../../tools.js';
class Avatar extends React.Component {
constructor(props) {
super(props);
this.state = {
imageUrl: ''
}
}
handleChange(info) {
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() {
const imageUrl = this.state.imageUrl;
return (
{
imageUrl ?
:
}
);
}
};
const PatentDesc = React.createClass({
getInitialState() {
return {
visible: false,
loading: false,
patentTypeOption: [],
patentFieldOption: [],
patentStateOption: [],
adminOption: [],
patentProcessList: []
};
},
loadData() {
this.setState({
loading: true
});
$.when($.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/techservice/patent/patentProcess",
data: {
pid: this.state.xid
}
}), $.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/techservice/patent/getAdmin"
})).done((data1, data2) => {
if (data1[0].error.length) {
message.warning(data1[0].error[0].message);
return;
};
let _me = this;
data1[0].data.map(function (item) {
_me.state.patentProcessList.push(
专利状态: {getPatentState(item.state)}
处理时间: {getTime(item.recordTime)}
负责人:{item.principal}
操作人:{item.operator}
)
});
if (data2[0].error.length) {
message.warning(data2[0].error[0].message);
return;
};
for (var item in data2[0].data) {
_me.state.adminOption.push(
{data2[0].data[item]}
)
};
}).always(function () {
this.setState({
loading: false
});
}.bind(this));
},
getOption() {
let _me = this;
_me.state.patentTypeOption = [];
_me.state.patentFieldOption = [];
_me.state.patentStateOption = [];
patentTypeList.map(function (item) {
_me.state.patentTypeOption.push(
{item.key}
)
});
patentFieldList.map(function (item) {
_me.state.patentFieldOption.push(
{item.key}
)
});
patentStateList.map(function (item) {
_me.state.patentStateOption.push(
{item.key}
)
});
},
downloadPic(type) {
window.open(globalConfig.context + "/open/downLoadPicture?path=" + type)
},
showModal() {
this.setState({
visible: true,
});
},
handleOk() {
this.setState({
visible: true,
});
$.ajax({
method: "POST",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/techservice/patent/managePatentInfo",
data: {
"xid": this.state.xid,
"patentNumber": this.state.patentNumber,
"patentName": this.state.patentName,
"patentCatagory": this.state.patentType,
"patentField": this.state.patentField,
"patentDes": this.state.patentDes,
"patentWritingUrl": this.state.patentWritingUrl,
"authorizationNoticeUrl": this.state.authorizationNoticeUrl,
"patentCertificateUrl": this.state.patentCertificateUrl,
"state": this.state.patentStateAdd,
"recordTimeFormattedDate": this.state.recordTime,
"principal": this.state.adminName
}
}).done(function (data) {
if (!data.error.length) {
message.success('保存成功!');
} else {
message.warning(data.error[0].message);
}
}.bind(this)).always(function () {
this.setState({
visible: false,
});
this.props.closeDesc(false);
}.bind(this));
},
checkPatentProcess() {
if (this.state.patentStateAdd || this.state.adminName || this.state.recordTime) {
if (this.state.patentStateAdd && this.state.adminName && this.state.recordTime)
{ this.handleOk() } else {
message.warning("请填写完整的状态流转信息!");
return;
}
} else {
this.handleOk()
};
},
componentWillReceiveProps(nextProps) {
let _me = this;
this.state.patentStateAdd ='';
this.state.adminName ='';
this.state.recordTime = '';
this.state.adminOption = [];
this.state.patentProcessList = [];
this.state.visible = nextProps.showDesc;
if (nextProps.data) {
this.state.xid = nextProps.data.pid;
this.state.patentDes = nextProps.data.patentDes;
this.state.patentName = nextProps.data.patentName;
this.state.patentNumber = nextProps.data.patentNumber;
this.state.patentType = String(nextProps.data.patentType);
this.state.patentState = String(nextProps.data.patentState);
this.state.patentField = String(nextProps.data.patentField);
this.loadData();
this.getOption();
}
},
handleCancel(e) {
this.setState({
visible: false,
});
this.props.closeDesc(false);
},
getPatentWritingUrl(e) {
this.state.patentWritingUrl = e;
},
getAuthorizationNoticeUrl(e) {
this.state.authorizationNoticeUrl = e;
},
getPatentCertificateUrl(e) {
this.state.patentCertificateUrl = e;
},
render() {
const Step = Steps.Step;
const theData = this.props.data;
if (this.props.data) {
return (
保存,
,
]}
className="patent-desc-content">
公司名称:{theData.companyName}
公司组织机构代码:{theData.companyNum}
公司地址:{theData.companyAddress}
联系人:{theData.companyContacts}
专利状态:{getPatentState(theData.patentState)}
专利领域:
专利简介:
{ this.setState({ patentDes: e.target.value }); } }
rows={6} />
第一发明人:
姓名:{theData.firstInventorName}
身份证:{theData.firstInventorIdNumber}
国籍:中国
第二发明人:
姓名:{theData.secondInventorName}
国籍:中国
第三发明人:
姓名:{theData.thirdInventorName}
国籍:中国
材料管理:
{theData.patentProryStatementUrl !== null ? 专利代理委托书 : ""}
{theData.lastYearTaxReportUrl !== null ? 上年度纳税表 : ""}
专利稿件上传授权通知书上传专利证书上传
专利状态流转记录:
{this.state.patentProcessList}
状态流转:
处理时间:
{this.state.recordTime = dataString}}/>
负责人:
);
} else {
return
}
},
});
export default PatentDesc;