comprehensive.jsx 26 KB

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