comprehensive.jsx 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  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 + "/techservice/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. pagination: {
  141. defaultCurrent: 1,
  142. defaultPageSize: 10,
  143. showQuickJumper: true,
  144. pageSize: 10,
  145. onChange: function (page) {
  146. this.loadData(page);
  147. }.bind(this),
  148. showTotal: function (total) {
  149. return '共' + total + '条数据';
  150. }
  151. },
  152. columns: [
  153. {
  154. title: '编号',
  155. dataIndex: 'number',
  156. key: 'number',
  157. }, {
  158. title: '申请号/专利号',
  159. dataIndex: 'patentNumber',
  160. key: 'patentNumber',
  161. }, {
  162. title: '事务所',
  163. dataIndex: 'office',
  164. key: 'office',
  165. }, {
  166. title: '省份',
  167. dataIndex: 'province',
  168. key: 'province',
  169. }, {
  170. title: '公司名称',
  171. dataIndex: 'unitName',
  172. key: 'unitName',
  173. }, {
  174. title: '专利名称',
  175. dataIndex: 'patentName',
  176. key: 'patentName',
  177. }, {
  178. title: '专利状态',
  179. dataIndex: 'patentState',
  180. key: 'patentState',
  181. render: text => { return getPatentState(text) },
  182. }, {
  183. title: '派单日',
  184. dataIndex: 'createTime',
  185. key: 'createTime',
  186. render: text => { return getTime(text) },
  187. }, {
  188. title: '申请日',
  189. dataIndex: 'startTime',
  190. key: 'startTime',
  191. render: text => { return getTime(text) },
  192. }, {
  193. title: '授权日',
  194. dataIndex: 'endTime',
  195. key: 'endTime',
  196. render: text => { return getTime(text) },
  197. }, {
  198. title: '资料撰写人',
  199. dataIndex: 'author',
  200. key: 'author',
  201. }
  202. ],
  203. dataSource: []
  204. };
  205. },
  206. componentWillMount() {
  207. let _me = this;
  208. patentTypeList.map(function (item) {
  209. _me.state.patentTypeOption.push(
  210. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  211. )
  212. });
  213. patentStateList.map(function (item) {
  214. _me.state.patentStateOption.push(
  215. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  216. )
  217. });
  218. provinceArr.map(function (item) {
  219. _me.state.provinceOption.push(
  220. <Select.Option value={item} key={item}>{item}</Select.Option>
  221. )
  222. });
  223. this.loadData();
  224. //this.getAuthorList();
  225. this.getCompanyList();
  226. },
  227. tableRowClick(record, index) {
  228. this.state.RowData = record;
  229. this.setState({
  230. showDesc: true
  231. });
  232. },
  233. closeDesc(e, s) {
  234. this.state.showDesc = e;
  235. if (s) {
  236. this.loadData();
  237. };
  238. },
  239. search() {
  240. this.loadData();
  241. },
  242. reset() {
  243. this.state.number = undefined;
  244. this.state.patentNumber = undefined;
  245. this.state.province = undefined;
  246. this.state.unitName = undefined;
  247. this.state.patentType = undefined;
  248. this.state.patentName = undefined;
  249. this.state.patentState = undefined;
  250. this.state.createTime = [];
  251. this.state.endTime = [];
  252. this.state.startTime = [];
  253. this.state.author = undefined;
  254. this.state.searchKey = undefined;
  255. this.state.searchValue = undefined;
  256. this.loadData();
  257. },
  258. exportComposite() {
  259. window.open(globalConfig.context + "/api/admin/patent/exportComposite" +
  260. "?" + "serialNumber" + "=" + this.state.number +
  261. "&" + "patentNumber" + "=" + this.state.patentNumber +
  262. "&" + "patentName" + "=" + this.state.patentName +
  263. "&" + "locationProvince" + "=" + this.state.locationProvince +
  264. "&" + "unitName" + "=" + this.state.unitName +
  265. "&" + "patentCatagory" + "=" + this.state.patentCatagory +
  266. "&" + "patentState" + "=" + this.state.patentState +
  267. "&" + "createTime" + "=" + this.state.createTime +
  268. "&" + "patentApplicationDate" + "=" + this.state.startTime +
  269. "&" + "author" + "=" + this.state.author);
  270. },
  271. searchSwitch() {
  272. this.setState({
  273. searchMore: !this.state.searchMore
  274. });
  275. },
  276. searchcreateTime(date, dateString) {
  277. this.state.createTime = dateString;
  278. },
  279. searchstartTime(date, dateString) {
  280. this.state.startTime = dateString;
  281. },
  282. searchSelect(e) {
  283. let _me = this;
  284. this.setState({
  285. searchValue: e.target.value
  286. });
  287. switch (_me.state.searchKey) {
  288. case "patentNumber":
  289. _me.state.patentNumber = e.target.value;
  290. _me.state.number = '';
  291. _me.state.patentName = '';
  292. break;
  293. case "serialNumber":
  294. _me.state.number = e.target.value;
  295. _me.state.patentNumber = '';
  296. _me.state.patentName = '';
  297. break;
  298. case "patentName":
  299. _me.state.patentNumber = '';
  300. _me.state.number = '';
  301. _me.state.patentName = e.target.value;
  302. break;
  303. }
  304. },
  305. render() {
  306. const { MonthPicker, RangePicker } = DatePicker;
  307. return (
  308. <div className="patent-content" >
  309. <div className="content-title">
  310. <span>专利综合管理</span>
  311. <div className="patent-addNew">
  312. <Upload style={{ float: 'right' }}
  313. name="ratepay"
  314. showUploadList={false}
  315. action={globalConfig.context + "/api/admin/patent/uploadTemplate"}
  316. data={{ 'sign': 'patent_prory_statement' }}
  317. beforeUpload={beforeUploadFile}
  318. onChange={(info) => {
  319. if (info.file.status === 'done') {
  320. if (!info.file.response.error.length) {
  321. if (!info.file.response.error.length) {
  322. message.success(`${info.file.name} 文件上传成功!`);
  323. } else {
  324. message.warning(info.file.response.error[0].message);
  325. return;
  326. };
  327. } else {
  328. message.warning(info.file.response.error[0].message);
  329. };
  330. } else if (info.file.status === 'error') {
  331. message.error(`${info.file.name} 文件上传失败。`);
  332. }
  333. }}
  334. >
  335. <Button>上传专利代理委托书模板 <Icon type="upload" /></Button>
  336. </Upload>
  337. </div>
  338. <PatentAdd closeDesc={this.closeDesc} />
  339. </div>
  340. <div className="patent-query">
  341. <Select placeholder="请选择" value={this.state.searchKey} style={{ width: 200 }} onChange={(e) => { this.setState({ searchKey: e, searchValue: '' }); }}>
  342. <Select.Option value="patentNumber">专利号</Select.Option>
  343. <Select.Option value="serialNumber">编号</Select.Option>
  344. <Select.Option value="patentName">专利名称</Select.Option>
  345. </Select>
  346. <Input value={this.state.searchValue} onChange={this.searchSelect} />
  347. <Select placeholder="专利状态" value={this.state.patentState} style={{ width: 200 }} onChange={(e) => { this.setState({ patentState: e }); }}>{this.state.patentStateOption}</Select>
  348. <Button type="primary" onClick={this.search}>搜索</Button>
  349. <Button onClick={this.reset}>重置</Button>
  350. <Button type="ghost" onClick={this.exportComposite}>导出</Button>
  351. <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  352. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  353. <p>
  354. <span>派单日:</span><RangePicker onChange={this.searchcreateTime} />
  355. <span>申请日:</span><RangePicker onChange={this.searchstartTime} />
  356. </p>
  357. <div>
  358. <Select placeholder="选择省份"
  359. showSearch
  360. filterOption={companySearch}
  361. style={{ width: 200 }}
  362. onChange={(e) => { this.state.province = e }}>
  363. {this.state.provinceOption}
  364. </Select>
  365. <Select placeholder="选择公司"
  366. style={{ width: 200 }}
  367. showSearch
  368. filterOption={companySearch}
  369. onChange={(e) => { this.state.companyName = e }}>
  370. {this.state.companyOption}
  371. </Select>
  372. </div>
  373. </div>
  374. </div>
  375. <div className="patent-table">
  376. <Spin spinning={this.state.loading}>
  377. <Table columns={this.state.columns}
  378. dataSource={this.state.dataSource}
  379. pagination={this.state.pagination}
  380. onRowClick={this.tableRowClick} />
  381. </Spin>
  382. </div>
  383. <PatentDesc data={this.state.RowData} showDesc={this.state.showDesc} closeDesc={this.closeDesc} />
  384. </div >
  385. );
  386. }
  387. });
  388. export default Patent;
  389. //<Select placeholder="选择撰写人" style={{ width: 200 }} onChange={(e) => { this.state.author = e }}>{this.state.authorOption}</Select>
  390. // getAuthorList() {
  391. // this.setState({
  392. // loading: true
  393. // });
  394. // $.ajax({
  395. // method: "get",
  396. // dataType: "json",
  397. // crossDomain: false,
  398. // url: globalConfig.context + "/api/admin/getAdmin",
  399. // success: function (data) {
  400. // if (data.error.length || !data.data) {
  401. // return;
  402. // };
  403. // let _me = this;
  404. // for (var item in data.data) {
  405. // _me.state.authorOption.push(
  406. // <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
  407. // )
  408. // };
  409. // }.bind(this),
  410. // }).always(function () {
  411. // this.setState({
  412. // loading: false
  413. // });
  414. // }.bind(this));
  415. // },