comprehensive.jsx 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  1. import React from 'react';
  2. import { Icon, Button, Input, Select, Spin, Table, Switch, DatePicker, message, Upload, Modal } from 'antd';
  3. import { patentTypeList, patentStateList, provinceArr } from '../../../dataDic.js';
  4. import { getTime, getPatentState, beforeUploadFile, companySearch, getSearchUrl, getPatentType } from '../../../tools.js';
  5. import ajax from 'jquery/src/ajax/xhr.js';
  6. import $ from 'jquery/src/ajax';
  7. import moment from 'moment';
  8. import './comprehensive.less';
  9. import PatentAdd from './comPatentAdd.jsx';
  10. import PatentDesc from './comPatentDesc.jsx';
  11. const Patent = React.createClass({
  12. loadData(pageNo) {
  13. this.state.data = [];
  14. this.setState({
  15. loading: true
  16. });
  17. $.ajax({
  18. method: "get",
  19. dataType: "json",
  20. crossDomain: false,
  21. url: globalConfig.context + "/api/admin/patent/patentList",
  22. data: {
  23. page: pageNo || 1,
  24. pageSize: this.state.pagination.pageSize || null,
  25. serialNumber: this.state.number || null,
  26. patentNumber: this.state.patentNumber || null,
  27. patentName: this.state.patentName || null,
  28. locationProvince: this.state.province || null,
  29. uid: this.state.unitId || null,
  30. contractId: this.state.contractId,
  31. patentCatagory: this.state.patentType || null,
  32. patentState: this.state.patentState || null,
  33. createTime: this.state.createTime || null,
  34. patentApplicationDate: this.state.acceptTime || null,
  35. authorizedDate: this.state.authTime || null,
  36. },
  37. success: function (data) {
  38. if (data.error.length || !data.data || !data.data.list) {
  39. message.warning(data.error[0].message);
  40. return;
  41. }
  42. for (let i = 0; i < data.data.list.length; i++) {
  43. let thisdata = data.data.list[i];
  44. this.state.data.push({
  45. key: i,
  46. pid: thisdata.id,
  47. oid: thisdata.oid,
  48. uid: thisdata.uid,
  49. number: thisdata.serialNumber || '',
  50. patentNumber: thisdata.patentNumber || '',
  51. unitName: thisdata.unitName || '',
  52. patentName: thisdata.patentName || '',
  53. patentCatagory: thisdata.patentCatagory ? getPatentType(thisdata.patentCatagory) : '',
  54. patentState: thisdata.patentState || '0',
  55. patentField: thisdata.patentField || '0',
  56. patentDes: thisdata.patentDes || '',
  57. patentProryStatementUrl: thisdata.patentProryStatementUrl, //专利代理委托书
  58. patentWritingUrl: thisdata.patentWritingUrl, //专利稿件
  59. authorizationNoticeUrl: thisdata.authorizationNoticeUrl, //授权通知书
  60. patentCertificateUrl: thisdata.patentCertificateUrl, //专利证书
  61. lastYearTaxReportUrl: thisdata.lastYearTaxReportUrl, //上年度纳税表
  62. patentProryStatementDownloadFileName: thisdata.patentProryStatementDownloadFileName, //专利代理委托书
  63. patentWritingDownloadFileName: thisdata.patentWritingDownloadFileName, //专利稿件
  64. authorizationNoticeDownloadFileName: thisdata.authorizationNoticeDownloadFileName, //授权通知书
  65. patentCertificateDownloadFileName: thisdata.patentCertificateDownloadFileName, //专利证书
  66. lastYearTaxReportDownloadFileName: thisdata.lastYearTaxReportDownloadFileName, //上年度纳税表
  67. startTime: thisdata.patentApplicationDate,
  68. endTime: thisdata.authorizedDate,
  69. orgCode: thisdata.orgCode,
  70. province: thisdata.locationProvince,
  71. companyAddress: thisdata.locationProvince || thisdata.locationCity || thisdata.locationArea ? thisdata.locationProvince + '/' + thisdata.locationCity + '/' + thisdata.locationArea : '',
  72. companyContacts: thisdata.contacts, //联系人
  73. firstInventorName: thisdata.firstInventorName,
  74. firstInventorNationality: thisdata.firstInventorNationality, //国籍
  75. firstInventorIdNumber: thisdata.firstInventorIdNumber, //id
  76. firstInventorIsPublish: thisdata.firstInventorIsPublish, //是否公布
  77. secondInventorName: thisdata.secondInventorName,
  78. secondInventorNationality: thisdata.secondInventorNationality,
  79. secondInventorIsPublish: thisdata.secondInventorIsPublish,
  80. thirdInventorName: thisdata.thirdInventorName,
  81. thirdInventorNationality: thisdata.thirdInventorNationality,
  82. thirdInventorIsPublish: thisdata.thirdInventorIsPublish,
  83. createTime: thisdata.createTime, //派单日
  84. author: thisdata.author, //撰写人
  85. office: thisdata.office, //事务所
  86. principal: thisdata.principal, //负责人
  87. founder: thisdata.founder, //创建人
  88. techPrincipal: thisdata.techPrincipal //技术员
  89. });
  90. };
  91. this.state.pagination.current = data.data.pageNo;
  92. this.state.pagination.total = data.data.totalCount;
  93. this.setState({
  94. dataSource: this.state.data,
  95. pagination: this.state.pagination
  96. });
  97. }.bind(this),
  98. }).always(function () {
  99. this.setState({
  100. loading: false
  101. });
  102. }.bind(this));
  103. },
  104. getOptionList() {
  105. this.setState({
  106. loading: true
  107. });
  108. $.when($.ajax({
  109. method: "get",
  110. dataType: "json",
  111. crossDomain: false,
  112. url: globalConfig.context + "/api/admin/getUnitNames",
  113. data: { "pid": this.state.xid },
  114. }), $.ajax({
  115. method: "get",
  116. dataType: "json",
  117. crossDomain: false,
  118. url: globalConfig.context + "/api/admin/patent/getPrincipal"
  119. }), $.ajax({
  120. method: "get",
  121. dataType: "json",
  122. crossDomain: false,
  123. url: globalConfig.context + "/api/admin/patent/patentStatus"
  124. })).done((data1, data2, data3) => {
  125. let _me = this;
  126. if (!data1[0].data) {
  127. if (data1[0].error.length) {
  128. message.warning(data1[0].error[0].message);
  129. };
  130. } else {
  131. for (var item in data1[0].data) {
  132. _me.state.companyOption.push(
  133. <Select.Option value={item} key={item}>{data1[0].data[item]}</Select.Option>
  134. )
  135. };
  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.adminOption = [];
  143. for (var item in data2[0].data) {
  144. _me.state.adminOption.push(
  145. <Select.Option value={item} key={item}>{data2[0].data[item]}</Select.Option>
  146. )
  147. };
  148. };
  149. if (!data3[0].data) {
  150. if (data3[0].error && data3[0].error.length) {
  151. message.warning(data3[0].error[0].message);
  152. };
  153. } else {
  154. _me.state.patentStateOption = [];
  155. for (var item in data3[0].data) {
  156. _me.state.patentStateOption.push(
  157. <Select.Option value={item} key={item}>{data3[0].data[item]}</Select.Option>
  158. )
  159. };
  160. };
  161. }).always(function () {
  162. this.setState({
  163. loading: false
  164. });
  165. }.bind(this));
  166. },
  167. getInitialState() {
  168. return {
  169. createTime: [],
  170. acceptTime: [],
  171. authTime: [],
  172. patentTypeOption: [],
  173. patentStateOption: [],
  174. companyOption: [],
  175. provinceOption: [],
  176. searchMore: true,
  177. data: [],
  178. loading: false,
  179. visible: false,
  180. selectedRowKeys: [],
  181. selectedRows: [],
  182. pagination: {
  183. defaultCurrent: 1,
  184. defaultPageSize: 10,
  185. showQuickJumper: true,
  186. pageSize: 10,
  187. onChange: function (page) {
  188. this.loadData(page);
  189. }.bind(this),
  190. showTotal: function (total) {
  191. return '共' + total + '条数据';
  192. }
  193. },
  194. columns: [
  195. {
  196. title: '编号',
  197. dataIndex: 'number',
  198. key: 'number',
  199. }, {
  200. title: '申请号/专利号',
  201. dataIndex: 'patentNumber',
  202. key: 'patentNumber',
  203. }, {
  204. title: '事务所',
  205. dataIndex: 'office',
  206. key: 'office',
  207. }, {
  208. title: '省份',
  209. dataIndex: 'province',
  210. key: 'province',
  211. }, {
  212. title: '公司名称',
  213. dataIndex: 'unitName',
  214. key: 'unitName',
  215. }, {
  216. title: '专利名称',
  217. dataIndex: 'patentName',
  218. key: 'patentName',
  219. }, {
  220. title: '专利类型',
  221. dataIndex: 'patentCatagory',
  222. key: 'patentCatagory'
  223. }, {
  224. title: '专利状态',
  225. dataIndex: 'patentState',
  226. key: 'patentState',
  227. render: text => { return getPatentState(text) },
  228. }, {
  229. title: '派单日',
  230. dataIndex: 'createTime',
  231. key: 'createTime',
  232. render: text => { return getTime(text) },
  233. }, {
  234. title: '申请日',
  235. dataIndex: 'startTime',
  236. key: 'startTime',
  237. render: text => { return getTime(text) },
  238. }, {
  239. title: '授权日',
  240. dataIndex: 'endTime',
  241. key: 'endTime',
  242. render: text => { return getTime(text) },
  243. }, {
  244. title: '创建人',
  245. dataIndex: 'founder',
  246. key: 'founder'
  247. }, {
  248. title: '技术员',
  249. dataIndex: 'techPrincipal',
  250. key: 'techPrincipal',
  251. }
  252. ],
  253. dataSource: []
  254. };
  255. },
  256. componentWillMount() {
  257. let _me = this;
  258. patentTypeList.map(function (item) {
  259. _me.state.patentTypeOption.push(
  260. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  261. )
  262. });
  263. patentStateList.map(function (item) {
  264. _me.state.patentStateOption.push(
  265. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  266. )
  267. });
  268. provinceArr.map(function (item) {
  269. _me.state.provinceOption.push(
  270. <Select.Option value={item} key={item}>{item}</Select.Option>
  271. )
  272. });
  273. if (window.location.search) {
  274. let theArr = getSearchUrl(window.location.search);
  275. if (theArr.length > 1) {
  276. let theObj = {};
  277. theObj.pid = theArr[0].value;
  278. theObj.uid = theArr[1].value;
  279. if (theObj.pid != 'null' && theObj.uid != 'null') {
  280. this.tableRowClick(theObj);
  281. };
  282. } else if (theArr.length == 1) {
  283. if (theArr[0].key == 'uid') {
  284. this.state.unitId = theArr[0].value;
  285. } else if (theArr[0].key == 'contractId ') {
  286. this.state.contractId = theArr[0].value;
  287. };
  288. };
  289. };
  290. this.loadData();
  291. this.getOptionList();
  292. },
  293. tableRowClick(record, index) {
  294. this.state.RowData = record;
  295. this.setState({
  296. showDesc: true
  297. });
  298. },
  299. closeDesc(e, s) {
  300. this.state.showDesc = e;
  301. if (s) {
  302. this.loadData();
  303. };
  304. },
  305. search() {
  306. this.loadData();
  307. },
  308. reset() {
  309. this.state.number = undefined;
  310. this.state.patentNumber = undefined;
  311. this.state.province = undefined;
  312. this.state.unitId = undefined;
  313. this.state.contractId = undefined;
  314. this.state.patentType = undefined;
  315. this.state.patentName = undefined;
  316. this.state.patentState = undefined;
  317. this.state.createTime = [];
  318. this.state.acceptTime = [];
  319. this.state.authTime = [];
  320. this.state.searchKey = undefined;
  321. this.state.searchValue = undefined;
  322. this.loadData();
  323. },
  324. exportComposite() {
  325. window.open(globalConfig.context + "/api/admin/patent/exportComposite" +
  326. "?" + "serialNumber" + "=" + this.state.number +
  327. "&" + "patentNumber" + "=" + this.state.patentNumber +
  328. "&" + "patentName" + "=" + this.state.patentName +
  329. "&" + "locationProvince" + "=" + this.state.locationProvince +
  330. "&" + "uid" + "=" + this.state.unitId +
  331. "&" + "uid" + "=" + this.state.contractId +
  332. "&" + "patentCatagory" + "=" + this.state.patentCatagory +
  333. "&" + "patentState" + "=" + this.state.patentState +
  334. "&" + "createTime" + "=" + this.state.createTime +
  335. "&" + "patentApplicationDate" + "=" + this.state.acceptTime +
  336. "&" + "author" + "=" + this.state.author);
  337. },
  338. searchSwitch() {
  339. this.setState({
  340. searchMore: !this.state.searchMore
  341. });
  342. },
  343. searchSelect(e) {
  344. let _me = this;
  345. this.setState({
  346. searchValue: e.target.value
  347. });
  348. switch (_me.state.searchKey) {
  349. case "patentNumber":
  350. _me.state.patentNumber = e.target.value;
  351. _me.state.number = '';
  352. _me.state.patentName = '';
  353. break;
  354. case "serialNumber":
  355. _me.state.number = e.target.value;
  356. _me.state.patentNumber = '';
  357. _me.state.patentName = '';
  358. break;
  359. case "patentName":
  360. _me.state.patentNumber = '';
  361. _me.state.number = '';
  362. _me.state.patentName = e.target.value;
  363. break;
  364. }
  365. },
  366. delectRow() {
  367. let deletedIds = [];
  368. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  369. let rowItem = this.state.selectedRows[idx];
  370. if (rowItem.pid) {
  371. deletedIds.push(rowItem.pid)
  372. }
  373. }
  374. this.setState({
  375. selectedRowKeys: [],
  376. loading: deletedIds.length > 0
  377. });
  378. $.ajax({
  379. method: "POST",
  380. dataType: "json",
  381. crossDomain: false,
  382. url: globalConfig.context + "/api/admin/patent/delete",
  383. data: {
  384. ids: deletedIds
  385. }
  386. }).done(function (data) {
  387. if (!data.error.length) {
  388. message.success('保存成功!');
  389. this.setState({
  390. loading: false,
  391. });
  392. } else {
  393. message.warning(data.error[0].message);
  394. };
  395. this.loadData();
  396. }.bind(this));
  397. },
  398. circulation() {
  399. let deletedIds = [];
  400. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  401. let rowItem = this.state.selectedRows[idx];
  402. if (rowItem.pid) {
  403. deletedIds.push(rowItem.pid)
  404. }
  405. }
  406. this.setState({
  407. selectedRowKeys: [],
  408. loading: deletedIds.length > 0
  409. });
  410. $.ajax({
  411. method: "POST",
  412. dataType: "json",
  413. crossDomain: false,
  414. url: globalConfig.context + "/api/admin/patent/circulation",
  415. data: {
  416. ids: deletedIds,
  417. principal: this.state.principal,
  418. state: this.state.status,
  419. comment: this.state.comment,
  420. recordTimeFormattedDate: this.state.recordTime
  421. }
  422. }).done(function (data) {
  423. if (!data.error.length) {
  424. message.success('保存成功!');
  425. this.setState({
  426. loading: false,
  427. visible: false
  428. });
  429. } else {
  430. message.warning(data.error[0].message);
  431. };
  432. this.loadData();
  433. }.bind(this));
  434. },
  435. showModal() {
  436. this.setState({
  437. visible: true,
  438. principal: undefined,
  439. status: undefined,
  440. comment: undefined,
  441. recordTime: undefined
  442. });
  443. },
  444. handleCancel() {
  445. this.setState({ visible: false });
  446. },
  447. render() {
  448. const rowSelection = {
  449. selectedRowKeys: this.state.selectedRowKeys,
  450. onChange: (selectedRowKeys, selectedRows) => {
  451. this.setState({
  452. selectedRows: selectedRows,
  453. selectedRowKeys: selectedRowKeys
  454. });
  455. }
  456. };
  457. const hasSelected = this.state.selectedRowKeys.length > 0;
  458. const { MonthPicker, RangePicker } = DatePicker;
  459. return (
  460. <div className="patent-content" >
  461. <div className="content-title">
  462. <span>专利综合管理</span>
  463. <div className="patent-addNew">
  464. <Upload style={{ float: 'right' }}
  465. name="ratepay"
  466. fileList={this.state.fileList}
  467. action={globalConfig.context + "/api/admin/patent/uploadTemplate"}
  468. data={{ 'sign': 'patent_prory_statement' }}
  469. beforeUpload={beforeUploadFile}
  470. onChange={(info) => {
  471. if (info.file.status === 'done') {
  472. if (!info.file.response.error.length) {
  473. if (!info.file.response.error.length) {
  474. message.success(`${info.file.name} 文件上传成功!`);
  475. } else {
  476. message.warning(info.file.response.error[0].message);
  477. return;
  478. };
  479. } else {
  480. message.warning(info.file.response.error[0].message);
  481. };
  482. } else if (info.file.status === 'error') {
  483. message.error(`${info.file.name} 文件上传失败。`);
  484. };
  485. this.setState({ fileList: info.fileList.slice(-1) });
  486. }}
  487. >
  488. <Button>上传专利代理委托书模板 <Icon type="upload" /></Button>
  489. </Upload>
  490. </div>
  491. </div>
  492. <div className="patent-query">
  493. <Select placeholder="请选择" value={this.state.searchKey} style={{ width: 160 }} onChange={(e) => { this.setState({ searchKey: e, searchValue: '' }); }}>
  494. <Select.Option value="patentNumber">专利号</Select.Option>
  495. <Select.Option value="serialNumber">编号</Select.Option>
  496. <Select.Option value="patentName">专利名称</Select.Option>
  497. </Select>
  498. <Input value={this.state.searchValue} style={{ width: 160 }} onChange={this.searchSelect} />
  499. <Input style={{ width: 160 }}
  500. placeholder="请输入合同编号"
  501. value={this.state.contractId}
  502. onChange={(e) => { this.setState({ contractId: e.target.value }); }} />
  503. <Select placeholder="专利状态" value={this.state.patentState} style={{ width: 160 }} onChange={(e) => { this.setState({ patentState: e }); }}>{this.state.patentStateOption}</Select>
  504. <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  505. <Button style={{ marginLeft: '20px' }}
  506. type="primary"
  507. onClick={this.search}>搜索</Button>
  508. <Button onClick={this.reset}>重置</Button>
  509. <Button type="ghost" onClick={this.exportComposite}>导出</Button>
  510. <Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
  511. disabled={!hasSelected}
  512. onClick={this.delectRow}>删除<Icon type="minus" /></Button>
  513. <Button disabled={!hasSelected} style={{ marginTop: '10px' }}
  514. type="ghost" onClick={this.showModal}>专利批量流转<Icon type="retweet" /></Button>
  515. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  516. <div>
  517. <span>派单日:</span>
  518. <RangePicker style={{ width: '240px' }}
  519. allowClear={false}
  520. value={[this.state.createTime[0] ? moment(this.state.createTime[0]) : null,
  521. this.state.createTime[1] ? moment(this.state.createTime[1]) : null]}
  522. onChange={(date, dateString) => { this.setState({ createTime: dateString }) }} />
  523. <span>申请日:</span>
  524. <RangePicker style={{ width: '240px' }}
  525. allowClear={false}
  526. value={[this.state.acceptTime[0] ? moment(this.state.acceptTime[0]) : null,
  527. this.state.acceptTime[1] ? moment(this.state.acceptTime[1]) : null]}
  528. onChange={(date, dateString) => { this.setState({ acceptTime: dateString }) }} />
  529. <Select placeholder="选择省份"
  530. showSearch
  531. filterOption={companySearch}
  532. style={{ width: 100 }}
  533. value={this.state.province}
  534. onChange={(e) => { this.setState({ province: e }); }}>
  535. {this.state.provinceOption}
  536. </Select>
  537. <Select placeholder="选择公司"
  538. style={{ width: 200 }}
  539. showSearch
  540. filterOption={companySearch}
  541. value={this.state.unitId}
  542. onChange={(e) => { this.setState({ unitId: e }); }}>
  543. {this.state.companyOption}
  544. </Select>
  545. </div>
  546. </div>
  547. </div>
  548. <div className="patent-table">
  549. <Spin spinning={this.state.loading}>
  550. <Table columns={this.state.columns}
  551. rowSelection={rowSelection}
  552. dataSource={this.state.dataSource}
  553. pagination={this.state.pagination}
  554. onRowClick={this.tableRowClick} />
  555. </Spin>
  556. </div>
  557. <PatentDesc
  558. data={this.state.RowData}
  559. adminOption={this.state.adminOption}
  560. patentStateOption={this.state.patentStateOption}
  561. showDesc={this.state.showDesc}
  562. closeDesc={this.closeDesc} />
  563. <Modal title="专利批量流转" visible={this.state.visible}
  564. onCancel={this.handleCancel}
  565. width='800px'
  566. footer={[
  567. <Button key="submit" type="primary" size="large" onClick={this.circulation}>保存</Button>,
  568. <Button key="back" type="ghost" size="large" onClick={this.handleCancel}>取消</Button>,
  569. ]} className="patent-desc-content">
  570. <div className="clearfix">
  571. <div className="widthThird">
  572. <span>状态流转:</span>
  573. <Select placeholder='请选择状态'
  574. value={this.state.status}
  575. style={{ width: 150 }}
  576. onChange={(e) => { this.setState({ status: e }); }}>
  577. {this.state.patentStateOption}
  578. </Select>
  579. </div>
  580. <p className="widthThird">
  581. <span>处理时间:</span>
  582. <DatePicker
  583. value={this.state.recordTime ? moment(this.state.recordTime) : undefined}
  584. format="YYYY-MM-DD HH:mm:ss"
  585. onChange={(data, dataString) => { this.setState({ recordTime: dataString }); }} />
  586. </p>
  587. <div className="widthThird">
  588. <span>负责人:</span>
  589. <Select placeholder='请填写负责人'
  590. value={this.state.principal}
  591. style={{ width: 150 }}
  592. onChange={(e) => { this.setState({ principal: e }); }}>
  593. {this.state.adminOption}
  594. </Select>
  595. </div>
  596. </div>
  597. <div>
  598. <span>备注:</span>
  599. <Input value={this.state.comment} placeholder='请填写备注' style={{ width: 400 }} onChange={(e) => { this.setState({ comment: e.target.value }); }} />
  600. </div>
  601. </Modal>
  602. </div >
  603. );
  604. }
  605. });
  606. export default Patent;
  607. //<PatentAdd closeDesc={this.closeDesc} />