comPatentDesc.jsx 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. import React from 'react';
  2. import { Icon, Modal, message, Spin, Steps, Input, Select, Upload, DatePicker, Button, Table } from 'antd';
  3. import './comprehensive.less';
  4. import ajax from 'jquery/src/ajax/xhr.js';
  5. import moment from 'moment';
  6. import $ from 'jquery/src/ajax';
  7. import { patentTypeList, patentStateList, industryList } from '../../../dataDic.js';
  8. import { getBase64, beforeUpload, getPatentState, getTime, newDownloadFile, getPreview, companySearch } from '../../../tools.js';
  9. class Avatar extends React.Component {
  10. constructor(props) {
  11. super(props);
  12. this.state = {
  13. imageUrl: ''
  14. }
  15. }
  16. handleChange(info) {
  17. if (info.file.status !== 'uploading') {
  18. // console.log(info.file, info.fileList);
  19. }
  20. if (info.file.status === 'done') {
  21. if (!info.file.response.error.length) {
  22. message.success(`${info.file.name} 文件上传成功!`);
  23. } else {
  24. message.warning(info.file.response.error[0].message);
  25. return;
  26. };
  27. this.props.urlData(info.file.response.data);
  28. } else if (info.file.status === 'error') {
  29. message.error(`${info.file.name} 文件上传失败。`);
  30. };
  31. this.setState({ fileList: info.fileList.slice(-1) });
  32. }
  33. componentWillReceiveProps(nextProps) {
  34. if (!this.props.visible && nextProps.visible) {
  35. this.state.fileList = [];
  36. };
  37. }
  38. render() {
  39. return (
  40. <Upload className="upload-file"
  41. name="avatar"
  42. fileList={this.state.fileList}
  43. action={this.props.name == "patent_prory_statement" ? globalConfig.context + "/api/admin/patent/uploadProry" : globalConfig.context + "/api/admin/patent/upload"}
  44. data={{ 'sign': this.props.name, 'uid': this.props.uid, 'id': this.props.id }}
  45. beforeUpload={beforeUpload}
  46. onChange={this.handleChange.bind(this)}
  47. >
  48. <Button><Icon type="upload" /> 点击上传 </Button>
  49. </Upload>
  50. );
  51. }
  52. };
  53. const PatentDesc = React.createClass({
  54. getInitialState() {
  55. return {
  56. visible: false,
  57. loading: false,
  58. patentTypeOption: [],
  59. patentFieldOption: [],
  60. industryOption: [],
  61. stateTable: [],
  62. stateColumns: [{
  63. title: '申请状态',
  64. dataIndex: 'state',
  65. key: 'state',
  66. render: (text) => { return getPatentState(text) }
  67. }, {
  68. title: '处理时间',
  69. dataIndex: 'recordTimeFormattedDate',
  70. key: 'recordTimeFormattedDate',
  71. }, {
  72. title: '负责人',
  73. dataIndex: 'principal',
  74. key: 'principal',
  75. }, {
  76. title: '操作人',
  77. dataIndex: 'operator',
  78. key: 'operator',
  79. }, {
  80. title: '备注',
  81. dataIndex: 'comment',
  82. key: 'comment',
  83. }]
  84. };
  85. },
  86. loadData(uid) {
  87. this.setState({
  88. loading: true
  89. });
  90. $.when($.ajax({
  91. method: "get",
  92. dataType: "json",
  93. crossDomain: false,
  94. url: globalConfig.context + "/api/admin/patent/detail",
  95. data: { "pid": this.state.xid },
  96. }), $.ajax({
  97. method: "get",
  98. dataType: "json",
  99. crossDomain: false,
  100. url: globalConfig.context + "/api/admin/patent/logs",
  101. data: { "pid": this.state.xid }
  102. }), $.ajax({
  103. method: "get",
  104. dataType: "json",
  105. crossDomain: false,
  106. url: globalConfig.context + "/api/admin/patent/lastYearTax",
  107. data: { "uid": uid || this.props.data.uid, "sign": "last_year_ratepay" }
  108. }), $.ajax({
  109. method: "get",
  110. dataType: "json",
  111. crossDomain: false,
  112. url: globalConfig.context + "/api/admin/patent/getAuthor"
  113. })).done((data1, data2, data3, data4) => {
  114. let _me = this;
  115. if (!data1[0].data) {
  116. if (data1[0].error.length) {
  117. message.warning(data1[0].error[0].message);
  118. };
  119. } else {
  120. this.state.data = data1[0].data;
  121. this.state.firstInventorName = data1[0].data.firstInventorName;
  122. this.state.firstInventorIdNumber = data1[0].data.firstInventorIdNumber;
  123. this.state.secondInventorName = data1[0].data.secondInventorName;
  124. this.state.thirdInventorName = data1[0].data.thirdInventorName;
  125. this.state.patentDes = data1[0].data.patentDes;
  126. this.state.patentName = data1[0].data.patentName;
  127. this.state.patentNumber = data1[0].data.patentNumber;
  128. this.state.office = data1[0].data.office;
  129. this.state.patentCatagory = data1[0].data.patentCatagory;
  130. this.state.patentState = data1[0].data.patentState;
  131. this.state.patentField = data1[0].data.patentField;
  132. this.state.contacts = data1[0].data.contacts;
  133. this.state.author = data1[0].data.author;
  134. this.state.uid = data1[0].data.uid;
  135. this.state.id = data1[0].data.id;
  136. };
  137. if (!data2[0].data) {
  138. if (data2[0].error.length) {
  139. message.warning(data2[0].error[0].message);
  140. };
  141. } else {
  142. _me.state.stateTable = [];
  143. data2[0].data.map(function (item) {
  144. _me.state.stateTable.push({
  145. comment: item.comment,
  146. id: item.id,
  147. operator: item.operator,
  148. pid: item.pid,
  149. principal: item.principal,
  150. recordTime: item.recordTime,
  151. recordTimeFormattedDate: item.recordTimeFormattedDate,
  152. state: item.state,
  153. });
  154. });
  155. };
  156. if (!data3[0].data) {
  157. if (data3[0].error.length) {
  158. message.warning(data3[0].error[0].message);
  159. };
  160. } else {
  161. this.state.lastYearTaxReportId = data3[0].data.id
  162. };
  163. let theArr = [];
  164. if (!data4[0].data) {
  165. if (data4[0].error.length) {
  166. message.warning(data4[0].error[0].message);
  167. };
  168. } else {
  169. for (var item in data4[0].data) {
  170. theArr.push(
  171. <Select.Option value={item} key={item}>{data4[0].data[item]}</Select.Option>
  172. )
  173. };
  174. this.setState({
  175. authorOption: theArr
  176. });
  177. };
  178. }).always(function () {
  179. this.setState({
  180. loading: false
  181. });
  182. }.bind(this));
  183. },
  184. getContactsList(theUid) {
  185. $.ajax({
  186. method: "get",
  187. dataType: "json",
  188. crossDomain: false,
  189. url: globalConfig.context + "/api/admin/customer/findAllContacts",
  190. data: {
  191. uid: theUid || this.state.uid
  192. },
  193. success: function (data) {
  194. let theOption = [];
  195. if (data.error.length || !data.data) {
  196. return;
  197. };
  198. for (let item in data.data) {
  199. let theData = data.data[item];
  200. theOption.push(
  201. <Select.Option value={item} key={theData.name}>{theData.name}</Select.Option>
  202. );
  203. };
  204. this.setState({
  205. contactsOption: theOption
  206. });
  207. }.bind(this),
  208. });
  209. },
  210. getOption() {
  211. let _me = this;
  212. _me.state.patentTypeOption = [];
  213. _me.state.industryOption = [];
  214. patentTypeList.map(function (item) {
  215. _me.state.patentTypeOption.push(
  216. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  217. )
  218. });
  219. industryList.map(function (item) {
  220. _me.state.industryOption.push(
  221. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  222. )
  223. });
  224. },
  225. showModal() {
  226. this.setState({
  227. visible: true,
  228. });
  229. },
  230. handleOk() {
  231. this.setState({
  232. visible: true,
  233. loading: true
  234. });
  235. $.ajax({
  236. method: "POST",
  237. dataType: "json",
  238. crossDomain: false,
  239. url: globalConfig.context + "/api/admin/patent/update",
  240. data: {
  241. "id": this.state.xid,
  242. "uid": this.state.uid,
  243. "patentNumber": this.state.patentNumber,
  244. "patentName": this.state.patentName,
  245. "patentCatagory": this.state.patentCatagory,
  246. "patentField": this.state.patentField,
  247. "patentDes": this.state.patentDes,
  248. "contacts": this.state.contacts,
  249. "office": this.state.office,
  250. "patentWritingUrl": this.state.patentWritingUrl,
  251. "authorizationNoticeUrl": this.state.authorizationNoticeUrl,
  252. "patentCertificateUrl": this.state.patentCertificateUrl,
  253. "patentProryStatementUrl": this.state.patentProryStatementUrl,
  254. "pState": this.props.data.patentState,
  255. "firstInventorName": this.state.firstInventorName,
  256. "firstInventorIdNumber": this.state.firstInventorIdNumber,
  257. "secondInventorName": this.state.secondInventorName,
  258. "thirdInventorName": this.state.thirdInventorName,
  259. "state": this.state.patentStateAdd,
  260. "recordTimeFormattedDate": this.state.recordTime,
  261. "principal": this.state.adminName,
  262. "comment": this.state.comment,
  263. "author": this.state.author
  264. }
  265. }).done(function (data) {
  266. if (data.error && !data.error.length) {
  267. message.success('保存成功!');
  268. this.props.closeDesc(false, true);
  269. } else {
  270. message.warning(data.error[0].message);
  271. }
  272. }.bind(this)).always(function () {
  273. this.setState({
  274. loading: false,
  275. });
  276. }.bind(this));
  277. },
  278. checkPatentProcess() {
  279. if (this.state.patentStateAdd || this.state.adminName || this.state.recordTime) {
  280. if (this.state.patentStateAdd && this.state.adminName && this.state.recordTime)
  281. { this.handleOk() } else {
  282. message.warning("请填写完整的状态流转信息!");
  283. return;
  284. }
  285. } else {
  286. this.handleOk()
  287. };
  288. },
  289. componentWillMount() {
  290. this.getOption();
  291. },
  292. componentWillReceiveProps(nextProps) {
  293. this.state.patentStateAdd = undefined;
  294. this.state.adminName = undefined;
  295. this.state.recordTime = undefined;
  296. this.state.comment = undefined;
  297. if (nextProps.data && !this.state.visible && nextProps.showDesc) {
  298. this.state.xid = nextProps.data.id;
  299. this.loadData(nextProps.data.uid);
  300. this.getContactsList(nextProps.data.uid);
  301. };
  302. this.state.visible = nextProps.showDesc;
  303. },
  304. handleCancel(e) {
  305. this.setState({
  306. visible: false,
  307. });
  308. this.props.closeDesc(false);
  309. },
  310. getPatentWritingUrl(e) {
  311. this.state.patentWritingUrl = e;
  312. },
  313. getAuthorizationNoticeUrl(e) {
  314. this.state.authorizationNoticeUrl = e;
  315. },
  316. getPatentCertificateUrl(e) {
  317. this.state.patentCertificateUrl = e;
  318. },
  319. getPatentProryStatementUrl(e) {
  320. this.state.patentProryStatementUrl = e;
  321. },
  322. render() {
  323. const Step = Steps.Step;
  324. const theData = this.state.data;
  325. if (this.state.data) {
  326. return (
  327. <div className="patent-desc">
  328. <Spin spinning={this.state.loading} className='spin-box'>
  329. <Modal maskClosable={false} title="专利详情" visible={this.state.visible}
  330. onOk={this.checkPatentProcess} onCancel={this.handleCancel}
  331. width='1200px'
  332. footer={[
  333. <Button key="submit" type="primary" size="large" onClick={this.checkPatentProcess}>保存</Button>,
  334. <Button key="back" type="ghost" size="large" onClick={this.handleCancel}>取消</Button>,
  335. ]}
  336. className="patent-desc-content">
  337. <div>
  338. <p className="widthHalf"><span>公司名称:</span>{theData.unitName}</p>
  339. <div className="widthHalf">
  340. <span>联系人:</span>
  341. <Select placeholder="选择联系人"
  342. style={{ width: 200 }}
  343. value={this.state.contacts}
  344. onChange={(e) => { this.setState({ contacts: e }); }} >
  345. {this.state.contactsOption}
  346. </Select>
  347. </div>
  348. </div>
  349. <p>专利状态流转记录:</p>
  350. <Table
  351. style={{ margin: '10px 0', background: "#eee" }}
  352. pagination={false}
  353. dataSource={this.state.stateTable}
  354. columns={this.state.stateColumns} />
  355. <div className="clearfix" style={{ paddingLeft: '4px', paddingTop: '20px', background: "#eee" }}>
  356. <div className="widthHalf">
  357. <span>状态流转:</span>
  358. <Select placeholder='请选择状态'
  359. value={this.state.patentStateAdd}
  360. style={{ width: 150 }}
  361. onChange={(e) => { this.setState({ patentStateAdd: e }); }}>
  362. {this.props.patentStateOption}
  363. </Select>
  364. </div>
  365. <div className="widthHalf">
  366. <span>处理时间:</span>
  367. <i>
  368. <DatePicker
  369. value={this.state.recordTime ? moment(this.state.recordTime) : undefined}
  370. format="YYYY-MM-DD HH:mm:ss"
  371. onChange={(data, dataString) => { this.setState({ recordTime: dataString }); }} />
  372. </i>
  373. </div>
  374. <div className="widthHalf">
  375. <span>负责人:</span>
  376. <Select placeholder='请填写负责人'
  377. value={this.state.adminName}
  378. showSearch
  379. filterOption={companySearch}
  380. style={{ width: 200 }}
  381. onChange={(e) => { this.setState({ adminName: e }); }}>
  382. {this.props.adminOption}
  383. </Select>
  384. </div>
  385. <div className="widthHalf">
  386. <span>备注:</span>
  387. <Input value={this.state.comment} placeholder='请填写备注' onChange={(e) => { this.setState({ comment: e.target.value }); }} />
  388. </div>
  389. </div>
  390. <div>
  391. <p className="widthHalf"><span>事务所:</span><Input value={this.state.office} onChange={(e) => { this.setState({ office: e.target.value }); }} /></p>
  392. </div>
  393. <div>
  394. <p className="widthHalf"><span>编号:</span>{theData.serialNumber}</p>
  395. <p className="widthHalf"><span>申请号/专利号:</span><Input value={this.state.patentNumber} onChange={(e) => { this.setState({ patentNumber: e.target.value }); }} /></p>
  396. </div>
  397. <div>
  398. <p className="widthHalf"><span>专利名称:</span><Input value={this.state.patentName} onChange={(e) => { this.setState({ patentName: e.target.value }); }} /></p>
  399. <div className="widthHalf"><span>专利类型:</span>
  400. <Select value={this.state.patentCatagory}
  401. style={{ width: 260 }}
  402. onChange={(e) => { this.setState({ patentCatagory: e }); }}>
  403. {this.state.patentTypeOption}
  404. </Select>
  405. </div>
  406. </div>
  407. <div>
  408. <p className="widthHalf"><span>专利状态:</span>{getPatentState(theData.patentState)}</p>
  409. <div className="widthHalf"><span>所属行业:</span>
  410. <Select
  411. value={this.state.patentField}
  412. style={{ width: 260 }}
  413. onChange={(e) => { this.setState({ patentField: e }); }}>
  414. {this.state.industryOption}
  415. </Select>
  416. </div>
  417. </div>
  418. <div>
  419. <span>专利简介:</span>
  420. <Input type="textarea"
  421. placeholder="多行输入"
  422. value={this.state.patentDes}
  423. onChange={(e) => { this.setState({ patentDes: e.target.value }); }}
  424. rows={6} />
  425. </div>
  426. <div>
  427. <p>第一发明人:</p>
  428. <p className="widthThird">
  429. <span>姓名:</span>
  430. <Input
  431. style={{ width: 150 }}
  432. value={this.state.firstInventorName}
  433. onChange={(e) => { this.setState({ firstInventorName: e.target.value }); }} />
  434. </p>
  435. <p className="widthThird">
  436. <span>身份证:</span>
  437. <Input
  438. style={{ width: 150 }}
  439. value={this.state.firstInventorIdNumber}
  440. onChange={(e) => { this.setState({ firstInventorIdNumber: e.target.value }); }} />
  441. </p>
  442. <p className="widthThird"><span>国籍:</span>中国</p>
  443. </div>
  444. <div style={theData.secondInventorName === '' ? { display: 'none' } : {}}>
  445. <p>第二发明人:</p>
  446. <p className="widthThird">
  447. <span>姓名:</span>
  448. <Input
  449. style={{ width: 150 }}
  450. value={this.state.secondInventorName}
  451. onChange={(e) => { this.setState({ secondInventorName: e.target.value }); }} />
  452. </p>
  453. <p className="widthThird"><span>国籍:</span>中国</p>
  454. </div>
  455. <div style={theData.thirdInventorName === '' ? { display: 'none' } : {}}>
  456. <p>第三发明人:</p>
  457. <p className="widthThird">
  458. <span>姓名:</span>
  459. <Input
  460. style={{ width: 150 }}
  461. value={this.state.thirdInventorName}
  462. onChange={(e) => { this.setState({ thirdInventorName: e.target.value }); }} />
  463. </p>
  464. <p className="widthThird"><span>国籍:</span>中国</p>
  465. </div>
  466. <div className="clearfix">
  467. <div>材料管理:
  468. {theData.patentWritingUrl ?
  469. <p className="download-file">
  470. <a onClick={newDownloadFile.bind(null, this.state.xid, "patent_writing", "/api/admin/patent/download")}>专利稿件</a>
  471. {theData.confirmState == '0' ?
  472. <Button onClick={this.confirmButton}>确认稿件</Button> : <span></span>
  473. }
  474. <a onClick={() => {
  475. var newTab = window.open('about:blank'); getPreview(this.state.data.id, 'patent', 'patent_writing', function (data) { newTab.location.href = data; });
  476. }}><Icon style={{ fontSize: '16px' }} type="eye-o" /> </a>
  477. </p> :
  478. <p><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />专利稿件未上传</p>
  479. }
  480. {theData.authorizationNoticeUrl ?
  481. <p className="download-file">
  482. <a onClick={newDownloadFile.bind(null, this.state.xid, "authorization_notice", "/api/admin/patent/download")}>授权通知书</a>
  483. <a onClick={() => {
  484. var newTab = window.open('about:blank'); getPreview(this.state.data.id, 'patent', 'authorization_notice', function (data) { newTab.location.href = data; });
  485. }}><Icon style={{ fontSize: '16px' }} type="eye-o" /> </a>
  486. </p> :
  487. <p><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />授权通知书未上传</p>
  488. }
  489. {theData.patentCertificateUrl ?
  490. <p className="download-file">
  491. <a onClick={newDownloadFile.bind(null, this.state.xid, "patent_certificate", "/api/admin/patent/download")}>专利证书</a>
  492. <a onClick={() => {
  493. var newTab = window.open('about:blank'); getPreview(this.state.data.id, 'patent', 'patent_certificate', function (data) { newTab.location.href = data; });
  494. }}><Icon style={{ fontSize: '16px' }} type="eye-o" /> </a>
  495. </p> :
  496. <p><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />专利证书未上传</p>
  497. }
  498. {theData.patentProryStatementUrl ?
  499. <p className="download-file">
  500. <a onClick={newDownloadFile.bind(null, this.state.xid, "patent_prory_statement", "/api/admin/patent/download")}>专利代理委托书</a>
  501. <a onClick={() => {
  502. var newTab = window.open('about:blank'); getPreview(this.state.data.id, 'patent', 'patent_prory_statement', function (data) { newTab.location.href = data; });
  503. }}><Icon style={{ fontSize: '16px' }} type="eye-o" /> </a>
  504. </p> :
  505. <p><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />专利代理委托书未上传</p>
  506. }
  507. {this.state.lastYearTaxReportId ?
  508. <p className="download-file">
  509. <a onClick={newDownloadFile.bind(null, this.state.lastYearTaxReportId, "last_year_ratepay", "/api/admin/patent/downloadRatepay")}>上年度纳税报表</a>
  510. <a onClick={() => {
  511. var newTab = window.open('about:blank'); getPreview(this.state.lastYearTaxReportId, 'patent', 'last_year_ratepay', function (data) { newTab.location.href = data; });
  512. }}><Icon style={{ fontSize: '16px' }} type="eye-o" /> </a>
  513. </p> :
  514. <p><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />上年度纳税报表未上传</p>
  515. }
  516. </div>
  517. <Avatar visible={this.state.visible} urlData={this.getPatentWritingUrl} name='patent_writing' uid={theData.uid} id={theData.id} />
  518. <Avatar visible={this.state.visible} urlData={this.getAuthorizationNoticeUrl} name='authorization_notice' uid={theData.uid} id={theData.id} />
  519. <Avatar visible={this.state.visible} urlData={this.getPatentCertificateUrl} name='patent_certificate' uid={theData.uid} id={theData.id} />
  520. <Avatar visible={this.state.visible} urlData={this.getPatentProryStatementUrl} name='patent_prory_statement' uid={theData.uid} id={theData.id} />
  521. </div>
  522. <div className="avatar-text"><span>专利稿件上传</span><span>授权通知书上传</span><span>专利证书上传</span><span>专利代理委托书上传</span></div>
  523. <div className="widthHalf">
  524. <span>撰写人:</span>
  525. <Select
  526. style={{ width: 150 }}
  527. value={this.state.author}
  528. onChange={(e) => { this.setState({ author: e }); }} >
  529. {this.state.authorOption}
  530. </Select>
  531. </div>
  532. </Modal>
  533. </Spin>
  534. </div>
  535. );
  536. } else {
  537. return <div></div>
  538. }
  539. },
  540. });
  541. export default PatentDesc;