comprehensive.jsx 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  1. import React from 'react';
  2. import { Icon, Button, Input, Select, Spin, Table, Switch, DatePicker, message, Upload } from 'antd';
  3. import { patentTypeList, patentStateList, provinceArr } from '../../../dataDic.js';
  4. import { getTime, getPatentState, beforeUploadFile, companySearch } from '../../../tools.js';
  5. import ajax from 'jquery/src/ajax/xhr.js';
  6. import $ from 'jquery/src/ajax';
  7. import './comprehensive.less';
  8. import PatentAdd from './comPatentAdd.jsx';
  9. import PatentDesc from './comPatentDesc.jsx';
  10. const Patent = React.createClass({
  11. loadData(pageNo) {
  12. this.state.data = [];
  13. this.setState({
  14. loading: true
  15. });
  16. $.ajax({
  17. method: "get",
  18. dataType: "json",
  19. crossDomain: false,
  20. url: globalConfig.context + "/api/admin/patent/patentList",
  21. data: {
  22. page: pageNo || 1,
  23. pageSize: this.state.pagination.pageSize || null,
  24. serialNumber: this.state.number || null,
  25. patentNumber: this.state.patentNumber || null,
  26. patentName: this.state.patentName || null,
  27. locationProvince: this.state.province || null,
  28. unitName: this.state.unitName || null,
  29. patentCatagory: this.state.patentType || null,
  30. patentState: this.state.patentState || null,
  31. createTime: this.state.createTime || null,
  32. patentApplicationDate: this.state.startTime || null,
  33. authorizedDate: this.state.endTime || null,
  34. author: this.state.author
  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. patentType: 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. });
  87. };
  88. this.state.pagination.current = data.data.pageNo;
  89. this.state.pagination.total = data.data.totalCount;
  90. this.setState({
  91. dataSource: this.state.data,
  92. pagination: this.state.pagination
  93. });
  94. }.bind(this),
  95. }).always(function () {
  96. this.setState({
  97. loading: false
  98. });
  99. }.bind(this));
  100. },
  101. getCompanyList() {
  102. this.setState({
  103. loading: true
  104. });
  105. $.ajax({
  106. method: "get",
  107. dataType: "json",
  108. crossDomain: false,
  109. url: globalConfig.context + "/api/user/patent/getUnitNames",
  110. success: function (data) {
  111. if (data.error.length || !data.data) {
  112. return;
  113. };
  114. let _me = this;
  115. for (var item in data.data) {
  116. _me.state.companyOption.push(
  117. <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
  118. )
  119. };
  120. }.bind(this),
  121. }).always(function () {
  122. this.setState({
  123. loading: false
  124. });
  125. }.bind(this));
  126. },
  127. getInitialState() {
  128. return {
  129. createTime: [],
  130. endTime: [],
  131. startTime: [],
  132. patentTypeOption: [],
  133. patentStateOption: [],
  134. companyOption: [],
  135. authorOption: [],
  136. provinceOption: [],
  137. searchMore: true,
  138. data: [],
  139. loading: false,
  140. selectedRowKeys: [],
  141. selectedRows: [],
  142. pagination: {
  143. defaultCurrent: 1,
  144. defaultPageSize: 10,
  145. showQuickJumper: true,
  146. pageSize: 10,
  147. onChange: function (page) {
  148. this.loadData(page);
  149. }.bind(this),
  150. showTotal: function (total) {
  151. return '共' + total + '条数据';
  152. }
  153. },
  154. columns: [
  155. {
  156. title: '编号',
  157. dataIndex: 'number',
  158. key: 'number',
  159. }, {
  160. title: '申请号/专利号',
  161. dataIndex: 'patentNumber',
  162. key: 'patentNumber',
  163. }, {
  164. title: '事务所',
  165. dataIndex: 'office',
  166. key: 'office',
  167. }, {
  168. title: '省份',
  169. dataIndex: 'province',
  170. key: 'province',
  171. }, {
  172. title: '公司名称',
  173. dataIndex: 'unitName',
  174. key: 'unitName',
  175. }, {
  176. title: '专利名称',
  177. dataIndex: 'patentName',
  178. key: 'patentName',
  179. }, {
  180. title: '专利状态',
  181. dataIndex: 'patentState',
  182. key: 'patentState',
  183. render: text => { return getPatentState(text) },
  184. }, {
  185. title: '派单日',
  186. dataIndex: 'createTime',
  187. key: 'createTime',
  188. render: text => { return getTime(text) },
  189. }, {
  190. title: '申请日',
  191. dataIndex: 'startTime',
  192. key: 'startTime',
  193. render: text => { return getTime(text) },
  194. }, {
  195. title: '授权日',
  196. dataIndex: 'endTime',
  197. key: 'endTime',
  198. render: text => { return getTime(text) },
  199. }, {
  200. title: '资料撰写人',
  201. dataIndex: 'author',
  202. key: 'author',
  203. }
  204. ],
  205. dataSource: []
  206. };
  207. },
  208. componentWillMount() {
  209. let _me = this;
  210. patentTypeList.map(function (item) {
  211. _me.state.patentTypeOption.push(
  212. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  213. )
  214. });
  215. patentStateList.map(function (item) {
  216. _me.state.patentStateOption.push(
  217. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  218. )
  219. });
  220. provinceArr.map(function (item) {
  221. _me.state.provinceOption.push(
  222. <Select.Option value={item} key={item}>{item}</Select.Option>
  223. )
  224. });
  225. this.loadData();
  226. this.getAuthorList();
  227. this.getCompanyList();
  228. },
  229. tableRowClick(record, index) {
  230. this.state.RowData = record;
  231. this.setState({
  232. showDesc: true
  233. });
  234. },
  235. closeDesc(e, s) {
  236. this.state.showDesc = e;
  237. if (s) {
  238. this.loadData();
  239. };
  240. },
  241. search() {
  242. this.loadData();
  243. },
  244. reset() {
  245. this.state.number = undefined;
  246. this.state.patentNumber = undefined;
  247. this.state.province = undefined;
  248. this.state.unitName = undefined;
  249. this.state.patentType = undefined;
  250. this.state.patentName = undefined;
  251. this.state.patentState = undefined;
  252. this.state.createTime = [];
  253. this.state.endTime = [];
  254. this.state.startTime = [];
  255. this.state.author = undefined;
  256. this.state.searchKey = undefined;
  257. this.state.searchValue = undefined;
  258. this.loadData();
  259. },
  260. exportComposite() {
  261. window.open(globalConfig.context + "/api/admin/patent/exportComposite" +
  262. "?" + "serialNumber" + "=" + this.state.number +
  263. "&" + "patentNumber" + "=" + this.state.patentNumber +
  264. "&" + "patentName" + "=" + this.state.patentName +
  265. "&" + "locationProvince" + "=" + this.state.locationProvince +
  266. "&" + "unitName" + "=" + this.state.unitName +
  267. "&" + "patentCatagory" + "=" + this.state.patentCatagory +
  268. "&" + "patentState" + "=" + this.state.patentState +
  269. "&" + "createTime" + "=" + this.state.createTime +
  270. "&" + "patentApplicationDate" + "=" + this.state.startTime +
  271. "&" + "author" + "=" + this.state.author);
  272. },
  273. searchSwitch() {
  274. this.setState({
  275. searchMore: !this.state.searchMore
  276. });
  277. },
  278. searchcreateTime(date, dateString) {
  279. this.state.createTime = dateString;
  280. },
  281. searchstartTime(date, dateString) {
  282. this.state.startTime = dateString;
  283. },
  284. searchSelect(e) {
  285. let _me = this;
  286. this.setState({
  287. searchValue: e.target.value
  288. });
  289. switch (_me.state.searchKey) {
  290. case "patentNumber":
  291. _me.state.patentNumber = e.target.value;
  292. _me.state.number = '';
  293. _me.state.patentName = '';
  294. break;
  295. case "serialNumber":
  296. _me.state.number = e.target.value;
  297. _me.state.patentNumber = '';
  298. _me.state.patentName = '';
  299. break;
  300. case "patentName":
  301. _me.state.patentNumber = '';
  302. _me.state.number = '';
  303. _me.state.patentName = e.target.value;
  304. break;
  305. }
  306. },
  307. getAuthorList() {
  308. this.setState({
  309. loading: true
  310. });
  311. $.ajax({
  312. method: "get",
  313. dataType: "json",
  314. crossDomain: false,
  315. url: globalConfig.context + "/api/admin/patent/getAuthor",
  316. success: function (data) {
  317. if (data.error.length || !data.data) {
  318. return;
  319. };
  320. let _me = this;
  321. for (var item in data.data) {
  322. _me.state.authorOption.push(
  323. <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
  324. )
  325. };
  326. }.bind(this),
  327. }).always(function () {
  328. this.setState({
  329. loading: false
  330. });
  331. }.bind(this));
  332. },
  333. delectRow() {
  334. let deletedIds = [];
  335. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  336. let rowItem = this.state.selectedRows[idx];
  337. if (rowItem.pid) {
  338. deletedIds.push(rowItem.pid)
  339. }
  340. }
  341. this.setState({
  342. selectedRowKeys: [],
  343. loading: deletedIds.length > 0
  344. });
  345. $.ajax({
  346. method: "POST",
  347. dataType: "json",
  348. crossDomain: false,
  349. url: globalConfig.context + "/api/admin/patent/delete",
  350. data: {
  351. ids: deletedIds
  352. }
  353. }).done(function (data) {
  354. if (!data.error.length) {
  355. message.success('保存成功!');
  356. this.setState({
  357. loading: false,
  358. });
  359. } else {
  360. message.warning(data.error[0].message);
  361. };
  362. this.loadData();
  363. }.bind(this));
  364. },
  365. render() {
  366. const rowSelection = {
  367. selectedRowKeys: this.state.selectedRowKeys,
  368. onChange: (selectedRowKeys, selectedRows) => {
  369. this.setState({
  370. selectedRows: selectedRows,
  371. selectedRowKeys: selectedRowKeys
  372. });
  373. }
  374. };
  375. const hasSelected = this.state.selectedRowKeys.length > 0;
  376. const { MonthPicker, RangePicker } = DatePicker;
  377. return (
  378. <div className="patent-content" >
  379. <div className="content-title">
  380. <span>专利综合管理</span>
  381. <div className="patent-addNew">
  382. <Upload style={{ float: 'right' }}
  383. name="ratepay"
  384. showUploadList={false}
  385. action={globalConfig.context + "/api/admin/patent/uploadTemplate"}
  386. data={{ 'sign': 'patent_prory_statement' }}
  387. beforeUpload={beforeUploadFile}
  388. onChange={(info) => {
  389. if (info.file.status === 'done') {
  390. if (!info.file.response.error.length) {
  391. if (!info.file.response.error.length) {
  392. message.success(`${info.file.name} 文件上传成功!`);
  393. } else {
  394. message.warning(info.file.response.error[0].message);
  395. return;
  396. };
  397. } else {
  398. message.warning(info.file.response.error[0].message);
  399. };
  400. } else if (info.file.status === 'error') {
  401. message.error(`${info.file.name} 文件上传失败。`);
  402. }
  403. }}
  404. >
  405. <Button>上传专利代理委托书模板 <Icon type="upload" /></Button>
  406. </Upload>
  407. </div>
  408. <PatentAdd closeDesc={this.closeDesc} />
  409. </div>
  410. <div className="patent-query">
  411. <Select placeholder="请选择" value={this.state.searchKey} style={{ width: 160 }} onChange={(e) => { this.setState({ searchKey: e, searchValue: '' }); }}>
  412. <Select.Option value="patentNumber">专利号</Select.Option>
  413. <Select.Option value="serialNumber">编号</Select.Option>
  414. <Select.Option value="patentName">专利名称</Select.Option>
  415. </Select>
  416. <Input value={this.state.searchValue} style={{ width: 160 }} onChange={this.searchSelect} />
  417. <Select placeholder="专利状态" value={this.state.patentState} style={{ width: 160 }} onChange={(e) => { this.setState({ patentState: e }); }}>{this.state.patentStateOption}</Select>
  418. <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  419. <Button type="primary" onClick={this.search}>搜索</Button>
  420. <Button onClick={this.reset}>重置</Button>
  421. <Button type="ghost" onClick={this.exportComposite}>导出</Button>
  422. <Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
  423. disabled={!hasSelected}
  424. onClick={this.delectRow}>删除<Icon type="minus" /></Button>
  425. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  426. <p>
  427. <span>派单日:</span><RangePicker onChange={this.searchcreateTime} />
  428. <span>申请日:</span><RangePicker onChange={this.searchstartTime} />
  429. </p>
  430. <div>
  431. <Select placeholder="选择省份"
  432. showSearch
  433. filterOption={companySearch}
  434. style={{ width: 200 }}
  435. onChange={(e) => { this.state.province = e }}>
  436. {this.state.provinceOption}
  437. </Select>
  438. <Select placeholder="选择撰写人"
  439. style={{ width: 200 }}
  440. onChange={(e) => { this.state.author = e }}>
  441. {this.state.authorOption}
  442. </Select>
  443. <Select placeholder="选择公司"
  444. style={{ width: 200 }}
  445. showSearch
  446. filterOption={companySearch}
  447. onChange={(e) => { this.state.companyName = e }}>
  448. {this.state.companyOption}
  449. </Select>
  450. </div>
  451. </div>
  452. </div>
  453. <div className="patent-table">
  454. <Spin spinning={this.state.loading}>
  455. <Table columns={this.state.columns}
  456. rowSelection={rowSelection}
  457. dataSource={this.state.dataSource}
  458. pagination={this.state.pagination}
  459. onRowClick={this.tableRowClick} />
  460. </Spin>
  461. </div>
  462. <PatentDesc data={this.state.RowData} showDesc={this.state.showDesc} closeDesc={this.closeDesc} />
  463. </div >
  464. );
  465. }
  466. });
  467. export default Patent;