comprehensive.jsx 26 KB

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