comprehensive.jsx 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
  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. id: 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.data.id },
  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 theObj = getSearchUrl(window.location.search);
  275. if (theObj.rid) {
  276. theObj.id = theObj.rid;
  277. if (theObj.rid != 'null' && theObj.uid != 'null') {
  278. this.tableRowClick(theObj);
  279. };
  280. } else {
  281. if (theObj.uid) {
  282. this.state.unitName = theObj.uid;
  283. } else if (theObj.contractId) {
  284. this.state.contractId = theObj.contractId;
  285. };
  286. };
  287. };
  288. this.loadData();
  289. this.getOptionList();
  290. },
  291. tableRowClick(record, index) {
  292. this.state.RowData = record;
  293. this.setState({
  294. showDesc: true
  295. });
  296. },
  297. closeDesc(e, s) {
  298. this.state.showDesc = e;
  299. if (s) {
  300. this.loadData();
  301. };
  302. },
  303. search() {
  304. this.loadData();
  305. },
  306. reset() {
  307. this.state.number = undefined;
  308. this.state.patentNumber = undefined;
  309. this.state.province = undefined;
  310. this.state.unitId = undefined;
  311. this.state.contractId = undefined;
  312. this.state.patentType = undefined;
  313. this.state.patentName = undefined;
  314. this.state.patentState = undefined;
  315. this.state.createTime = [];
  316. this.state.acceptTime = [];
  317. this.state.authTime = [];
  318. this.state.searchKey = undefined;
  319. this.state.searchValue = undefined;
  320. this.loadData();
  321. },
  322. exportComposite() {
  323. window.open(globalConfig.context + "/api/admin/patent/exportComposite" +
  324. "?" + "serialNumber" + "=" + this.state.number +
  325. "&" + "patentNumber" + "=" + this.state.patentNumber +
  326. "&" + "patentName" + "=" + this.state.patentName +
  327. "&" + "locationProvince" + "=" + this.state.locationProvince +
  328. "&" + "uid" + "=" + this.state.unitId +
  329. "&" + "uid" + "=" + this.state.contractId +
  330. "&" + "patentCatagory" + "=" + this.state.patentCatagory +
  331. "&" + "patentState" + "=" + this.state.patentState +
  332. "&" + "createTime" + "=" + this.state.createTime +
  333. "&" + "patentApplicationDate" + "=" + this.state.acceptTime +
  334. "&" + "author" + "=" + this.state.author);
  335. },
  336. searchSwitch() {
  337. this.setState({
  338. searchMore: !this.state.searchMore
  339. });
  340. },
  341. searchSelect(e) {
  342. let _me = this;
  343. this.setState({
  344. searchValue: e.target.value
  345. });
  346. switch (_me.state.searchKey) {
  347. case "patentNumber":
  348. _me.state.patentNumber = e.target.value;
  349. _me.state.number = '';
  350. _me.state.patentName = '';
  351. break;
  352. case "serialNumber":
  353. _me.state.number = e.target.value;
  354. _me.state.patentNumber = '';
  355. _me.state.patentName = '';
  356. break;
  357. case "patentName":
  358. _me.state.patentNumber = '';
  359. _me.state.number = '';
  360. _me.state.patentName = e.target.value;
  361. break;
  362. }
  363. },
  364. delectRow() {
  365. let deletedIds = [];
  366. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  367. let rowItem = this.state.selectedRows[idx];
  368. if (rowItem.id) {
  369. deletedIds.push(rowItem.id)
  370. }
  371. }
  372. this.setState({
  373. selectedRowKeys: [],
  374. loading: deletedIds.length > 0
  375. });
  376. $.ajax({
  377. method: "POST",
  378. dataType: "json",
  379. crossDomain: false,
  380. url: globalConfig.context + "/api/admin/patent/delete",
  381. data: {
  382. ids: deletedIds
  383. }
  384. }).done(function (data) {
  385. if (!data.error.length) {
  386. message.success('保存成功!');
  387. this.setState({
  388. loading: false,
  389. });
  390. } else {
  391. message.warning(data.error[0].message);
  392. };
  393. this.loadData();
  394. }.bind(this));
  395. },
  396. circulation() {
  397. let deletedIds = [];
  398. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  399. let rowItem = this.state.selectedRows[idx];
  400. if (rowItem.id) {
  401. deletedIds.push(rowItem.id)
  402. }
  403. }
  404. this.setState({
  405. selectedRowKeys: [],
  406. loading: deletedIds.length > 0
  407. });
  408. $.ajax({
  409. method: "POST",
  410. dataType: "json",
  411. crossDomain: false,
  412. url: globalConfig.context + "/api/admin/patent/circulation",
  413. data: {
  414. ids: deletedIds,
  415. principal: this.state.principal,
  416. state: this.state.status,
  417. comment: this.state.comment,
  418. recordTimeFormattedDate: this.state.recordTime
  419. }
  420. }).done(function (data) {
  421. if (!data.error.length) {
  422. message.success('保存成功!');
  423. this.setState({
  424. loading: false,
  425. visible: false
  426. });
  427. } else {
  428. message.warning(data.error[0].message);
  429. };
  430. this.loadData();
  431. }.bind(this));
  432. },
  433. showModal() {
  434. this.setState({
  435. visible: true,
  436. principal: undefined,
  437. status: undefined,
  438. comment: undefined,
  439. recordTime: undefined
  440. });
  441. },
  442. handleCancel() {
  443. this.setState({ visible: false });
  444. },
  445. render() {
  446. const rowSelection = {
  447. selectedRowKeys: this.state.selectedRowKeys,
  448. onChange: (selectedRowKeys, selectedRows) => {
  449. this.setState({
  450. selectedRows: selectedRows,
  451. selectedRowKeys: selectedRowKeys
  452. });
  453. }
  454. };
  455. const hasSelected = this.state.selectedRowKeys.length > 0;
  456. const { MonthPicker, RangePicker } = DatePicker;
  457. return (
  458. <div className="patent-content" >
  459. <div className="content-title">
  460. <span>专利综合管理</span>
  461. <div className="patent-addNew">
  462. <Upload style={{ float: 'right' }}
  463. name="ratepay"
  464. fileList={this.state.fileList}
  465. action={globalConfig.context + "/api/admin/patent/uploadTemplate"}
  466. data={{ 'sign': 'patent_prory_statement' }}
  467. beforeUpload={beforeUploadFile}
  468. onChange={(info) => {
  469. if (info.file.status === 'done') {
  470. if (!info.file.response.error.length) {
  471. if (!info.file.response.error.length) {
  472. message.success(`${info.file.name} 文件上传成功!`);
  473. } else {
  474. message.warning(info.file.response.error[0].message);
  475. return;
  476. };
  477. } else {
  478. message.warning(info.file.response.error[0].message);
  479. };
  480. } else if (info.file.status === 'error') {
  481. message.error(`${info.file.name} 文件上传失败。`);
  482. };
  483. this.setState({ fileList: info.fileList.slice(-1) });
  484. }}
  485. >
  486. <Button>上传专利代理委托书模板 <Icon type="upload" /></Button>
  487. </Upload>
  488. </div>
  489. </div>
  490. <div className="patent-query">
  491. <Select placeholder="请选择" value={this.state.searchKey} style={{ width: 160 }} onChange={(e) => { this.setState({ searchKey: e, searchValue: '' }); }}>
  492. <Select.Option value="patentNumber">专利号</Select.Option>
  493. <Select.Option value="serialNumber">编号</Select.Option>
  494. <Select.Option value="patentName">专利名称</Select.Option>
  495. </Select>
  496. <Input value={this.state.searchValue} style={{ width: 160 }} onChange={this.searchSelect} />
  497. <Input style={{ width: 160 }}
  498. placeholder="请输入合同编号"
  499. value={this.state.contractId}
  500. onChange={(e) => { this.setState({ contractId: e.target.value }); }} />
  501. <Select placeholder="专利状态" value={this.state.patentState} style={{ width: 160 }} onChange={(e) => { this.setState({ patentState: e }); }}>{this.state.patentStateOption}</Select>
  502. <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  503. <Button style={{ marginLeft: '20px' }}
  504. type="primary"
  505. onClick={this.search}>搜索</Button>
  506. <Button onClick={this.reset}>重置</Button>
  507. <Button type="ghost" onClick={this.exportComposite}>导出</Button>
  508. <Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
  509. disabled={!hasSelected}
  510. onClick={this.delectRow}>删除<Icon type="minus" /></Button>
  511. <Button disabled={!hasSelected} style={{ marginTop: '10px' }}
  512. type="ghost" onClick={this.showModal}>专利批量流转<Icon type="retweet" /></Button>
  513. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  514. <div>
  515. <span>派单日:</span>
  516. <RangePicker style={{ width: '240px' }}
  517. allowClear={false}
  518. value={[this.state.createTime[0] ? moment(this.state.createTime[0]) : null,
  519. this.state.createTime[1] ? moment(this.state.createTime[1]) : null]}
  520. onChange={(date, dateString) => { this.setState({ createTime: dateString }) }} />
  521. <span>申请日:</span>
  522. <RangePicker style={{ width: '240px' }}
  523. allowClear={false}
  524. value={[this.state.acceptTime[0] ? moment(this.state.acceptTime[0]) : null,
  525. this.state.acceptTime[1] ? moment(this.state.acceptTime[1]) : null]}
  526. onChange={(date, dateString) => { this.setState({ acceptTime: dateString }) }} />
  527. <Select placeholder="选择省份"
  528. showSearch
  529. filterOption={companySearch}
  530. style={{ width: 100 }}
  531. value={this.state.province}
  532. onChange={(e) => { this.setState({ province: e }); }}>
  533. {this.state.provinceOption}
  534. </Select>
  535. <Select placeholder="选择公司"
  536. style={{ width: 200 }}
  537. showSearch
  538. filterOption={companySearch}
  539. value={this.state.unitId}
  540. onChange={(e) => { this.setState({ unitId: e }); }}>
  541. {this.state.companyOption}
  542. </Select>
  543. </div>
  544. </div>
  545. </div>
  546. <div className="patent-table">
  547. <Spin spinning={this.state.loading}>
  548. <Table columns={this.state.columns}
  549. rowSelection={rowSelection}
  550. dataSource={this.state.dataSource}
  551. pagination={this.state.pagination}
  552. onRowClick={this.tableRowClick} />
  553. </Spin>
  554. </div>
  555. <PatentDesc
  556. data={this.state.RowData}
  557. adminOption={this.state.adminOption}
  558. patentStateOption={this.state.patentStateOption}
  559. showDesc={this.state.showDesc}
  560. closeDesc={this.closeDesc} />
  561. <Modal title="专利批量流转" visible={this.state.visible}
  562. onCancel={this.handleCancel}
  563. width='800px'
  564. footer={[
  565. <Button key="submit" type="primary" size="large" onClick={this.circulation}>保存</Button>,
  566. <Button key="back" type="ghost" size="large" onClick={this.handleCancel}>取消</Button>,
  567. ]} className="patent-desc-content">
  568. <div className="clearfix">
  569. <div className="widthThird">
  570. <span>状态流转:</span>
  571. <Select placeholder='请选择状态'
  572. value={this.state.status}
  573. style={{ width: 150 }}
  574. onChange={(e) => { this.setState({ status: e }); }}>
  575. {this.state.patentStateOption}
  576. </Select>
  577. </div>
  578. <p className="widthThird">
  579. <span>处理时间:</span>
  580. <DatePicker
  581. value={this.state.recordTime ? moment(this.state.recordTime) : undefined}
  582. format="YYYY-MM-DD HH:mm:ss"
  583. onChange={(data, dataString) => { this.setState({ recordTime: dataString }); }} />
  584. </p>
  585. <div className="widthThird">
  586. <span>负责人:</span>
  587. <Select placeholder='请填写负责人'
  588. value={this.state.principal}
  589. style={{ width: 150 }}
  590. onChange={(e) => { this.setState({ principal: e }); }}>
  591. {this.state.adminOption}
  592. </Select>
  593. </div>
  594. </div>
  595. <div>
  596. <span>备注:</span>
  597. <Input value={this.state.comment} placeholder='请填写备注' style={{ width: 400 }} onChange={(e) => { this.setState({ comment: e.target.value }); }} />
  598. </div>
  599. </Modal>
  600. </div >
  601. );
  602. }
  603. });
  604. export default Patent;
  605. //<PatentAdd closeDesc={this.closeDesc} />