comprehensive.jsx 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  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 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. author: this.state.author
  36. },
  37. success: function (data) {
  38. if (data.error.length || !data.data || !data.data.list) {
  39. message.warning(data.error[0].message);
  40. return;
  41. }
  42. for (let i = 0; i < data.data.list.length; i++) {
  43. let thisdata = data.data.list[i];
  44. this.state.data.push({
  45. key: i,
  46. pid: thisdata.id,
  47. oid: thisdata.oid,
  48. uid: thisdata.uid,
  49. number: thisdata.serialNumber || '',
  50. patentNumber: thisdata.patentNumber || '',
  51. unitName: thisdata.unitName || '',
  52. patentName: thisdata.patentName || '',
  53. patentCatagory: thisdata.patentCatagory || '0',
  54. patentState: thisdata.patentState || '0',
  55. patentField: thisdata.patentField || '0',
  56. patentDes: thisdata.patentDes || '',
  57. patentProryStatementUrl: thisdata.patentProryStatementUrl, //专利代理委托书
  58. patentWritingUrl: thisdata.patentWritingUrl, //专利稿件
  59. authorizationNoticeUrl: thisdata.authorizationNoticeUrl, //授权通知书
  60. patentCertificateUrl: thisdata.patentCertificateUrl, //专利证书
  61. lastYearTaxReportUrl: thisdata.lastYearTaxReportUrl, //上年度纳税表
  62. patentProryStatementDownloadFileName: thisdata.patentProryStatementDownloadFileName, //专利代理委托书
  63. patentWritingDownloadFileName: thisdata.patentWritingDownloadFileName, //专利稿件
  64. authorizationNoticeDownloadFileName: thisdata.authorizationNoticeDownloadFileName, //授权通知书
  65. patentCertificateDownloadFileName: thisdata.patentCertificateDownloadFileName, //专利证书
  66. lastYearTaxReportDownloadFileName: thisdata.lastYearTaxReportDownloadFileName, //上年度纳税表
  67. startTime: thisdata.patentApplicationDate,
  68. endTime: thisdata.authorizedDate,
  69. orgCode: thisdata.orgCode,
  70. province: thisdata.locationProvince,
  71. companyAddress: thisdata.locationProvince || thisdata.locationCity || thisdata.locationArea ? thisdata.locationProvince + '/' + thisdata.locationCity + '/' + thisdata.locationArea : '',
  72. companyContacts: thisdata.contacts, //联系人
  73. firstInventorName: thisdata.firstInventorName,
  74. firstInventorNationality: thisdata.firstInventorNationality, //国籍
  75. firstInventorIdNumber: thisdata.firstInventorIdNumber, //id
  76. firstInventorIsPublish: thisdata.firstInventorIsPublish, //是否公布
  77. secondInventorName: thisdata.secondInventorName,
  78. secondInventorNationality: thisdata.secondInventorNationality,
  79. secondInventorIsPublish: thisdata.secondInventorIsPublish,
  80. thirdInventorName: thisdata.thirdInventorName,
  81. thirdInventorNationality: thisdata.thirdInventorNationality,
  82. thirdInventorIsPublish: thisdata.thirdInventorIsPublish,
  83. createTime: thisdata.createTime, //派单日
  84. author: thisdata.author, //撰写人
  85. office: thisdata.office, //事务所
  86. principal: thisdata.principal //负责人
  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. getCompanyList() {
  103. this.setState({
  104. loading: true
  105. });
  106. $.ajax({
  107. method: "get",
  108. dataType: "json",
  109. crossDomain: false,
  110. url: globalConfig.context + "/api/admin/getUnitNames",
  111. success: function (data) {
  112. if (data.error.length || !data.data) {
  113. return;
  114. };
  115. let _me = this;
  116. for (var item in data.data) {
  117. _me.state.companyOption.push(
  118. <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
  119. )
  120. };
  121. }.bind(this),
  122. }).always(function () {
  123. this.setState({
  124. loading: false
  125. });
  126. }.bind(this));
  127. },
  128. getInitialState() {
  129. return {
  130. createTime: [],
  131. acceptTime: [],
  132. authTime: [],
  133. patentTypeOption: [],
  134. patentStateOption: [],
  135. companyOption: [],
  136. authorOption: [],
  137. provinceOption: [],
  138. searchMore: true,
  139. data: [],
  140. loading: false,
  141. selectedRowKeys: [],
  142. selectedRows: [],
  143. pagination: {
  144. defaultCurrent: 1,
  145. defaultPageSize: 10,
  146. showQuickJumper: true,
  147. pageSize: 10,
  148. onChange: function (page) {
  149. this.loadData(page);
  150. }.bind(this),
  151. showTotal: function (total) {
  152. return '共' + total + '条数据';
  153. }
  154. },
  155. columns: [
  156. {
  157. title: '编号',
  158. dataIndex: 'number',
  159. key: 'number',
  160. }, {
  161. title: '申请号/专利号',
  162. dataIndex: 'patentNumber',
  163. key: 'patentNumber',
  164. }, {
  165. title: '事务所',
  166. dataIndex: 'office',
  167. key: 'office',
  168. }, {
  169. title: '省份',
  170. dataIndex: 'province',
  171. key: 'province',
  172. }, {
  173. title: '公司名称',
  174. dataIndex: 'unitName',
  175. key: 'unitName',
  176. }, {
  177. title: '专利名称',
  178. dataIndex: 'patentName',
  179. key: 'patentName',
  180. }, {
  181. title: '专利状态',
  182. dataIndex: 'patentState',
  183. key: 'patentState',
  184. render: text => { return getPatentState(text) },
  185. }, {
  186. title: '派单日',
  187. dataIndex: 'createTime',
  188. key: 'createTime',
  189. render: text => { return getTime(text) },
  190. }, {
  191. title: '申请日',
  192. dataIndex: 'startTime',
  193. key: 'startTime',
  194. render: text => { return getTime(text) },
  195. }, {
  196. title: '授权日',
  197. dataIndex: 'endTime',
  198. key: 'endTime',
  199. render: text => { return getTime(text) },
  200. }
  201. ],
  202. dataSource: []
  203. };
  204. },
  205. componentWillMount() {
  206. let _me = this;
  207. patentTypeList.map(function (item) {
  208. _me.state.patentTypeOption.push(
  209. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  210. )
  211. });
  212. patentStateList.map(function (item) {
  213. _me.state.patentStateOption.push(
  214. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  215. )
  216. });
  217. provinceArr.map(function (item) {
  218. _me.state.provinceOption.push(
  219. <Select.Option value={item} key={item}>{item}</Select.Option>
  220. )
  221. });
  222. this.loadData();
  223. this.getAuthorList();
  224. this.getCompanyList();
  225. },
  226. tableRowClick(record, index) {
  227. this.state.RowData = record;
  228. this.setState({
  229. showDesc: true
  230. });
  231. },
  232. closeDesc(e, s) {
  233. this.state.showDesc = e;
  234. if (s) {
  235. this.loadData();
  236. };
  237. },
  238. search() {
  239. this.loadData();
  240. },
  241. reset() {
  242. this.state.number = undefined;
  243. this.state.patentNumber = undefined;
  244. this.state.province = undefined;
  245. this.state.unitName = undefined;
  246. this.state.patentType = undefined;
  247. this.state.patentName = undefined;
  248. this.state.patentState = undefined;
  249. this.state.createTime = [];
  250. this.state.acceptTime = [];
  251. this.state.authTime = [];
  252. this.state.author = undefined;
  253. this.state.searchKey = undefined;
  254. this.state.searchValue = undefined;
  255. this.loadData();
  256. },
  257. exportComposite() {
  258. window.open(globalConfig.context + "/api/admin/patent/exportComposite" +
  259. "?" + "serialNumber" + "=" + this.state.number +
  260. "&" + "patentNumber" + "=" + this.state.patentNumber +
  261. "&" + "patentName" + "=" + this.state.patentName +
  262. "&" + "locationProvince" + "=" + this.state.locationProvince +
  263. "&" + "unitName" + "=" + this.state.unitName +
  264. "&" + "patentCatagory" + "=" + this.state.patentCatagory +
  265. "&" + "patentState" + "=" + this.state.patentState +
  266. "&" + "createTime" + "=" + this.state.createTime +
  267. "&" + "patentApplicationDate" + "=" + this.state.acceptTime +
  268. "&" + "author" + "=" + this.state.author);
  269. },
  270. searchSwitch() {
  271. this.setState({
  272. searchMore: !this.state.searchMore
  273. });
  274. },
  275. searchSelect(e) {
  276. let _me = this;
  277. this.setState({
  278. searchValue: e.target.value
  279. });
  280. switch (_me.state.searchKey) {
  281. case "patentNumber":
  282. _me.state.patentNumber = e.target.value;
  283. _me.state.number = '';
  284. _me.state.patentName = '';
  285. break;
  286. case "serialNumber":
  287. _me.state.number = e.target.value;
  288. _me.state.patentNumber = '';
  289. _me.state.patentName = '';
  290. break;
  291. case "patentName":
  292. _me.state.patentNumber = '';
  293. _me.state.number = '';
  294. _me.state.patentName = e.target.value;
  295. break;
  296. }
  297. },
  298. getAuthorList() {
  299. this.setState({
  300. loading: true
  301. });
  302. $.ajax({
  303. method: "get",
  304. dataType: "json",
  305. crossDomain: false,
  306. url: globalConfig.context + "/api/admin/patent/getAuthor",
  307. success: function (data) {
  308. if (data.error.length || !data.data) {
  309. return;
  310. };
  311. let _me = this;
  312. for (var item in data.data) {
  313. _me.state.authorOption.push(
  314. <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
  315. )
  316. };
  317. }.bind(this),
  318. }).always(function () {
  319. this.setState({
  320. loading: false
  321. });
  322. }.bind(this));
  323. },
  324. delectRow() {
  325. let deletedIds = [];
  326. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  327. let rowItem = this.state.selectedRows[idx];
  328. if (rowItem.pid) {
  329. deletedIds.push(rowItem.pid)
  330. }
  331. }
  332. this.setState({
  333. selectedRowKeys: [],
  334. loading: deletedIds.length > 0
  335. });
  336. $.ajax({
  337. method: "POST",
  338. dataType: "json",
  339. crossDomain: false,
  340. url: globalConfig.context + "/api/admin/patent/delete",
  341. data: {
  342. ids: deletedIds
  343. }
  344. }).done(function (data) {
  345. if (!data.error.length) {
  346. message.success('保存成功!');
  347. this.setState({
  348. loading: false,
  349. });
  350. } else {
  351. message.warning(data.error[0].message);
  352. };
  353. this.loadData();
  354. }.bind(this));
  355. },
  356. render() {
  357. const rowSelection = {
  358. selectedRowKeys: this.state.selectedRowKeys,
  359. onChange: (selectedRowKeys, selectedRows) => {
  360. this.setState({
  361. selectedRows: selectedRows,
  362. selectedRowKeys: selectedRowKeys
  363. });
  364. }
  365. };
  366. const hasSelected = this.state.selectedRowKeys.length > 0;
  367. const { MonthPicker, RangePicker } = DatePicker;
  368. return (
  369. <div className="patent-content" >
  370. <div className="content-title">
  371. <span>专利综合管理</span>
  372. <div className="patent-addNew">
  373. <Upload style={{ float: 'right' }}
  374. name="ratepay"
  375. showUploadList={false}
  376. action={globalConfig.context + "/api/admin/patent/uploadTemplate"}
  377. data={{ 'sign': 'patent_prory_statement' }}
  378. beforeUpload={beforeUploadFile}
  379. onChange={(info) => {
  380. if (info.file.status === 'done') {
  381. if (!info.file.response.error.length) {
  382. if (!info.file.response.error.length) {
  383. message.success(`${info.file.name} 文件上传成功!`);
  384. } else {
  385. message.warning(info.file.response.error[0].message);
  386. return;
  387. };
  388. } else {
  389. message.warning(info.file.response.error[0].message);
  390. };
  391. } else if (info.file.status === 'error') {
  392. message.error(`${info.file.name} 文件上传失败。`);
  393. }
  394. }}
  395. >
  396. <Button>上传专利代理委托书模板 <Icon type="upload" /></Button>
  397. </Upload>
  398. </div>
  399. <PatentAdd closeDesc={this.closeDesc} />
  400. </div>
  401. <div className="patent-query">
  402. <Select placeholder="请选择" value={this.state.searchKey} style={{ width: 160 }} onChange={(e) => { this.setState({ searchKey: e, searchValue: '' }); }}>
  403. <Select.Option value="patentNumber">专利号</Select.Option>
  404. <Select.Option value="serialNumber">编号</Select.Option>
  405. <Select.Option value="patentName">专利名称</Select.Option>
  406. </Select>
  407. <Input value={this.state.searchValue} style={{ width: 160 }} onChange={this.searchSelect} />
  408. <Select placeholder="专利状态" value={this.state.patentState} style={{ width: 160 }} onChange={(e) => { this.setState({ patentState: e }); }}>{this.state.patentStateOption}</Select>
  409. <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  410. <Button type="primary" onClick={this.search}>搜索</Button>
  411. <Button onClick={this.reset}>重置</Button>
  412. <Button type="ghost" onClick={this.exportComposite}>导出</Button>
  413. <Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
  414. disabled={!hasSelected}
  415. onClick={this.delectRow}>删除<Icon type="minus" /></Button>
  416. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  417. <p>
  418. <span>派单日:</span>
  419. <RangePicker style={{ width: '240px' }}
  420. allowClear={false}
  421. value={[this.state.createTime[0] ? moment(this.state.createTime[0]) : null,
  422. this.state.createTime[1] ? moment(this.state.createTime[1]) : null]}
  423. onChange={(date, dateString) => { this.setState({ createTime: dateString }) }} />
  424. <span>申请日:</span>
  425. <RangePicker style={{ width: '240px' }}
  426. allowClear={false}
  427. value={[this.state.acceptTime[0] ? moment(this.state.acceptTime[0]) : null,
  428. this.state.acceptTime[1] ? moment(this.state.acceptTime[1]) : null]}
  429. onChange={(date, dateString) => { this.setState({ acceptTime: dateString }) }} />
  430. </p>
  431. <div>
  432. <Select placeholder="选择省份"
  433. showSearch
  434. filterOption={companySearch}
  435. style={{ width: 200 }}
  436. onChange={(e) => { this.state.province = e }}>
  437. {this.state.provinceOption}
  438. </Select>
  439. <Select placeholder="选择撰写人"
  440. style={{ width: 200 }}
  441. onChange={(e) => { this.state.author = e }}>
  442. {this.state.authorOption}
  443. </Select>
  444. <Select placeholder="选择公司"
  445. style={{ width: 200 }}
  446. showSearch
  447. filterOption={companySearch}
  448. onChange={(e) => { this.state.companyName = e }}>
  449. {this.state.companyOption}
  450. </Select>
  451. </div>
  452. </div>
  453. </div>
  454. <div className="patent-table">
  455. <Spin spinning={this.state.loading}>
  456. <Table columns={this.state.columns}
  457. rowSelection={rowSelection}
  458. dataSource={this.state.dataSource}
  459. pagination={this.state.pagination}
  460. onRowClick={this.tableRowClick} />
  461. </Spin>
  462. </div>
  463. <PatentDesc data={this.state.RowData} showDesc={this.state.showDesc} closeDesc={this.closeDesc} />
  464. </div >
  465. );
  466. }
  467. });
  468. export default Patent;
  469. // <span>授权日:</span>
  470. // <RangePicker style={{ width: '240px' }}
  471. // allowClear={false}
  472. // value={[moment(this.state.authTime[0]), moment(this.state.authTime[1])]}
  473. // onChange={(date, dateString) => { this.setState({ authTime: dateString }) }} />