comprehensive.jsx 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  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. delectRow() {
  308. let deletedIds = [];
  309. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  310. let rowItem = this.state.selectedRows[idx];
  311. if (rowItem.pid) {
  312. deletedIds.push(rowItem.pid)
  313. }
  314. }
  315. this.setState({
  316. selectedRowKeys: [],
  317. loading: deletedIds.length > 0
  318. });
  319. $.ajax({
  320. method: "POST",
  321. dataType: "json",
  322. crossDomain: false,
  323. url: globalConfig.context + "/api/admin/patent/delete",
  324. data: {
  325. ids: deletedIds
  326. }
  327. }).done(function (data) {
  328. if (!data.error.length) {
  329. message.success('保存成功!');
  330. this.setState({
  331. loading: false,
  332. });
  333. } else {
  334. message.warning(data.error[0].message);
  335. };
  336. this.loadData();
  337. }.bind(this));
  338. },
  339. render() {
  340. const rowSelection = {
  341. selectedRowKeys: this.state.selectedRowKeys,
  342. onChange: (selectedRowKeys, selectedRows) => {
  343. this.setState({
  344. selectedRows: selectedRows,
  345. selectedRowKeys: selectedRowKeys
  346. });
  347. }
  348. };
  349. const hasSelected = this.state.selectedRowKeys.length > 0;
  350. const { MonthPicker, RangePicker } = DatePicker;
  351. return (
  352. <div className="patent-content" >
  353. <div className="content-title">
  354. <span>专利综合管理</span>
  355. <div className="patent-addNew">
  356. <Upload style={{ float: 'right' }}
  357. name="ratepay"
  358. showUploadList={false}
  359. action={globalConfig.context + "/api/admin/patent/uploadTemplate"}
  360. data={{ 'sign': 'patent_prory_statement' }}
  361. beforeUpload={beforeUploadFile}
  362. onChange={(info) => {
  363. if (info.file.status === 'done') {
  364. if (!info.file.response.error.length) {
  365. if (!info.file.response.error.length) {
  366. message.success(`${info.file.name} 文件上传成功!`);
  367. } else {
  368. message.warning(info.file.response.error[0].message);
  369. return;
  370. };
  371. } else {
  372. message.warning(info.file.response.error[0].message);
  373. };
  374. } else if (info.file.status === 'error') {
  375. message.error(`${info.file.name} 文件上传失败。`);
  376. }
  377. }}
  378. >
  379. <Button>上传专利代理委托书模板 <Icon type="upload" /></Button>
  380. </Upload>
  381. </div>
  382. <PatentAdd closeDesc={this.closeDesc} />
  383. </div>
  384. <div className="patent-query">
  385. <Select placeholder="请选择" value={this.state.searchKey} style={{ width: 200 }} onChange={(e) => { this.setState({ searchKey: e, searchValue: '' }); }}>
  386. <Select.Option value="patentNumber">专利号</Select.Option>
  387. <Select.Option value="serialNumber">编号</Select.Option>
  388. <Select.Option value="patentName">专利名称</Select.Option>
  389. </Select>
  390. <Input value={this.state.searchValue} onChange={this.searchSelect} />
  391. <Select placeholder="专利状态" value={this.state.patentState} style={{ width: 200 }} onChange={(e) => { this.setState({ patentState: e }); }}>{this.state.patentStateOption}</Select>
  392. <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  393. <Button type="primary" onClick={this.search}>搜索</Button>
  394. <Button onClick={this.reset}>重置</Button>
  395. <Button type="ghost" onClick={this.exportComposite}>导出</Button>
  396. <Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
  397. disabled={!hasSelected}
  398. onClick={this.delectRow}>删除<Icon type="minus" /></Button>
  399. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  400. <p>
  401. <span>派单日:</span><RangePicker onChange={this.searchcreateTime} />
  402. <span>申请日:</span><RangePicker onChange={this.searchstartTime} />
  403. </p>
  404. <div>
  405. <Select placeholder="选择省份"
  406. showSearch
  407. filterOption={companySearch}
  408. style={{ width: 200 }}
  409. onChange={(e) => { this.state.province = e }}>
  410. {this.state.provinceOption}
  411. </Select>
  412. <Select placeholder="选择公司"
  413. style={{ width: 200 }}
  414. showSearch
  415. filterOption={companySearch}
  416. onChange={(e) => { this.state.companyName = e }}>
  417. {this.state.companyOption}
  418. </Select>
  419. </div>
  420. </div>
  421. </div>
  422. <div className="patent-table">
  423. <Spin spinning={this.state.loading}>
  424. <Table columns={this.state.columns}
  425. rowSelection={rowSelection}
  426. dataSource={this.state.dataSource}
  427. pagination={this.state.pagination}
  428. onRowClick={this.tableRowClick} />
  429. </Spin>
  430. </div>
  431. <PatentDesc data={this.state.RowData} showDesc={this.state.showDesc} closeDesc={this.closeDesc} />
  432. </div >
  433. );
  434. }
  435. });
  436. export default Patent;
  437. //<Select placeholder="选择撰写人" style={{ width: 200 }} onChange={(e) => { this.state.author = e }}>{this.state.authorOption}</Select>
  438. // getAuthorList() {
  439. // this.setState({
  440. // loading: true
  441. // });
  442. // $.ajax({
  443. // method: "get",
  444. // dataType: "json",
  445. // crossDomain: false,
  446. // url: globalConfig.context + "/api/admin/getAdmin",
  447. // success: function (data) {
  448. // if (data.error.length || !data.data) {
  449. // return;
  450. // };
  451. // let _me = this;
  452. // for (var item in data.data) {
  453. // _me.state.authorOption.push(
  454. // <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
  455. // )
  456. // };
  457. // }.bind(this),
  458. // }).always(function () {
  459. // this.setState({
  460. // loading: false
  461. // });
  462. // }.bind(this));
  463. // },