comprehensive.jsx 26 KB

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