comprehensive.jsx 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  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/user/patent/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. title: '资料撰写人',
  202. dataIndex: 'author',
  203. key: 'author',
  204. }
  205. ],
  206. dataSource: []
  207. };
  208. },
  209. componentWillMount() {
  210. let _me = this;
  211. patentTypeList.map(function (item) {
  212. _me.state.patentTypeOption.push(
  213. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  214. )
  215. });
  216. patentStateList.map(function (item) {
  217. _me.state.patentStateOption.push(
  218. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  219. )
  220. });
  221. provinceArr.map(function (item) {
  222. _me.state.provinceOption.push(
  223. <Select.Option value={item} key={item}>{item}</Select.Option>
  224. )
  225. });
  226. this.loadData();
  227. this.getAuthorList();
  228. this.getCompanyList();
  229. },
  230. tableRowClick(record, index) {
  231. this.state.RowData = record;
  232. this.setState({
  233. showDesc: true
  234. });
  235. },
  236. closeDesc(e, s) {
  237. this.state.showDesc = e;
  238. if (s) {
  239. this.loadData();
  240. };
  241. },
  242. search() {
  243. this.loadData();
  244. },
  245. reset() {
  246. this.state.number = undefined;
  247. this.state.patentNumber = undefined;
  248. this.state.province = undefined;
  249. this.state.unitName = undefined;
  250. this.state.patentType = undefined;
  251. this.state.patentName = undefined;
  252. this.state.patentState = undefined;
  253. this.state.createTime = [];
  254. this.state.acceptTime = [];
  255. this.state.authTime = [];
  256. this.state.author = undefined;
  257. this.state.searchKey = undefined;
  258. this.state.searchValue = undefined;
  259. this.loadData();
  260. },
  261. exportComposite() {
  262. window.open(globalConfig.context + "/api/admin/patent/exportComposite" +
  263. "?" + "serialNumber" + "=" + this.state.number +
  264. "&" + "patentNumber" + "=" + this.state.patentNumber +
  265. "&" + "patentName" + "=" + this.state.patentName +
  266. "&" + "locationProvince" + "=" + this.state.locationProvince +
  267. "&" + "unitName" + "=" + this.state.unitName +
  268. "&" + "patentCatagory" + "=" + this.state.patentCatagory +
  269. "&" + "patentState" + "=" + this.state.patentState +
  270. "&" + "createTime" + "=" + this.state.createTime +
  271. "&" + "patentApplicationDate" + "=" + this.state.acceptTime +
  272. "&" + "author" + "=" + this.state.author);
  273. },
  274. searchSwitch() {
  275. this.setState({
  276. searchMore: !this.state.searchMore
  277. });
  278. },
  279. searchSelect(e) {
  280. let _me = this;
  281. this.setState({
  282. searchValue: e.target.value
  283. });
  284. switch (_me.state.searchKey) {
  285. case "patentNumber":
  286. _me.state.patentNumber = e.target.value;
  287. _me.state.number = '';
  288. _me.state.patentName = '';
  289. break;
  290. case "serialNumber":
  291. _me.state.number = e.target.value;
  292. _me.state.patentNumber = '';
  293. _me.state.patentName = '';
  294. break;
  295. case "patentName":
  296. _me.state.patentNumber = '';
  297. _me.state.number = '';
  298. _me.state.patentName = e.target.value;
  299. break;
  300. }
  301. },
  302. getAuthorList() {
  303. this.setState({
  304. loading: true
  305. });
  306. $.ajax({
  307. method: "get",
  308. dataType: "json",
  309. crossDomain: false,
  310. url: globalConfig.context + "/api/admin/patent/getAuthor",
  311. success: function (data) {
  312. if (data.error.length || !data.data) {
  313. return;
  314. };
  315. let _me = this;
  316. for (var item in data.data) {
  317. _me.state.authorOption.push(
  318. <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
  319. )
  320. };
  321. }.bind(this),
  322. }).always(function () {
  323. this.setState({
  324. loading: false
  325. });
  326. }.bind(this));
  327. },
  328. delectRow() {
  329. let deletedIds = [];
  330. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  331. let rowItem = this.state.selectedRows[idx];
  332. if (rowItem.pid) {
  333. deletedIds.push(rowItem.pid)
  334. }
  335. }
  336. this.setState({
  337. selectedRowKeys: [],
  338. loading: deletedIds.length > 0
  339. });
  340. $.ajax({
  341. method: "POST",
  342. dataType: "json",
  343. crossDomain: false,
  344. url: globalConfig.context + "/api/admin/patent/delete",
  345. data: {
  346. ids: deletedIds
  347. }
  348. }).done(function (data) {
  349. if (!data.error.length) {
  350. message.success('保存成功!');
  351. this.setState({
  352. loading: false,
  353. });
  354. } else {
  355. message.warning(data.error[0].message);
  356. };
  357. this.loadData();
  358. }.bind(this));
  359. },
  360. render() {
  361. const rowSelection = {
  362. selectedRowKeys: this.state.selectedRowKeys,
  363. onChange: (selectedRowKeys, selectedRows) => {
  364. this.setState({
  365. selectedRows: selectedRows,
  366. selectedRowKeys: selectedRowKeys
  367. });
  368. }
  369. };
  370. const hasSelected = this.state.selectedRowKeys.length > 0;
  371. const { MonthPicker, RangePicker } = DatePicker;
  372. return (
  373. <div className="patent-content" >
  374. <div className="content-title">
  375. <span>专利综合管理</span>
  376. <div className="patent-addNew">
  377. <Upload style={{ float: 'right' }}
  378. name="ratepay"
  379. showUploadList={false}
  380. action={globalConfig.context + "/api/admin/patent/uploadTemplate"}
  381. data={{ 'sign': 'patent_prory_statement' }}
  382. beforeUpload={beforeUploadFile}
  383. onChange={(info) => {
  384. if (info.file.status === 'done') {
  385. if (!info.file.response.error.length) {
  386. if (!info.file.response.error.length) {
  387. message.success(`${info.file.name} 文件上传成功!`);
  388. } else {
  389. message.warning(info.file.response.error[0].message);
  390. return;
  391. };
  392. } else {
  393. message.warning(info.file.response.error[0].message);
  394. };
  395. } else if (info.file.status === 'error') {
  396. message.error(`${info.file.name} 文件上传失败。`);
  397. }
  398. }}
  399. >
  400. <Button>上传专利代理委托书模板 <Icon type="upload" /></Button>
  401. </Upload>
  402. </div>
  403. <PatentAdd closeDesc={this.closeDesc} />
  404. </div>
  405. <div className="patent-query">
  406. <Select placeholder="请选择" value={this.state.searchKey} style={{ width: 160 }} onChange={(e) => { this.setState({ searchKey: e, searchValue: '' }); }}>
  407. <Select.Option value="patentNumber">专利号</Select.Option>
  408. <Select.Option value="serialNumber">编号</Select.Option>
  409. <Select.Option value="patentName">专利名称</Select.Option>
  410. </Select>
  411. <Input value={this.state.searchValue} style={{ width: 160 }} onChange={this.searchSelect} />
  412. <Select placeholder="专利状态" value={this.state.patentState} style={{ width: 160 }} onChange={(e) => { this.setState({ patentState: e }); }}>{this.state.patentStateOption}</Select>
  413. <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  414. <Button type="primary" onClick={this.search}>搜索</Button>
  415. <Button onClick={this.reset}>重置</Button>
  416. <Button type="ghost" onClick={this.exportComposite}>导出</Button>
  417. <Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
  418. disabled={!hasSelected}
  419. onClick={this.delectRow}>删除<Icon type="minus" /></Button>
  420. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  421. <p>
  422. <span>派单日:</span>
  423. <RangePicker style={{ width: '240px' }}
  424. allowClear={false}
  425. value={[moment(this.state.createTime[0]), moment(this.state.createTime[1])]}
  426. onChange={(date, dateString) => { this.setState({ createTime: dateString }) }} />
  427. <span>申请日:</span>
  428. <RangePicker style={{ width: '240px' }}
  429. allowClear={false}
  430. value={[moment(this.state.acceptTime[0]), moment(this.state.acceptTime[1])]}
  431. onChange={(date, dateString) => { this.setState({ acceptTime: dateString }) }} />
  432. </p>
  433. <div>
  434. <Select placeholder="选择省份"
  435. showSearch
  436. filterOption={companySearch}
  437. style={{ width: 200 }}
  438. onChange={(e) => { this.state.province = e }}>
  439. {this.state.provinceOption}
  440. </Select>
  441. <Select placeholder="选择撰写人"
  442. style={{ width: 200 }}
  443. onChange={(e) => { this.state.author = e }}>
  444. {this.state.authorOption}
  445. </Select>
  446. <Select placeholder="选择公司"
  447. style={{ width: 200 }}
  448. showSearch
  449. filterOption={companySearch}
  450. onChange={(e) => { this.state.companyName = e }}>
  451. {this.state.companyOption}
  452. </Select>
  453. </div>
  454. </div>
  455. </div>
  456. <div className="patent-table">
  457. <Spin spinning={this.state.loading}>
  458. <Table columns={this.state.columns}
  459. rowSelection={rowSelection}
  460. dataSource={this.state.dataSource}
  461. pagination={this.state.pagination}
  462. onRowClick={this.tableRowClick} />
  463. </Spin>
  464. </div>
  465. <PatentDesc data={this.state.RowData} showDesc={this.state.showDesc} closeDesc={this.closeDesc} />
  466. </div >
  467. );
  468. }
  469. });
  470. export default Patent;
  471. // <span>授权日:</span>
  472. // <RangePicker style={{ width: '240px' }}
  473. // allowClear={false}
  474. // value={[moment(this.state.authTime[0]), moment(this.state.authTime[1])]}
  475. // onChange={(date, dateString) => { this.setState({ authTime: dateString }) }} />