intellectual.jsx 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. import React from 'react';
  2. import { Icon, Button, Input, Spin, Table, message, Select, Modal, DatePicker } from 'antd';
  3. import { technicalSourceList } from '../../dataDic.js';
  4. import { getCatagory, getIntellectualObtainWay } from '../../tools.js';
  5. import './intellectual.less';
  6. import moment from 'moment';
  7. import ajax from 'jquery/src/ajax/xhr.js';
  8. import $ from 'jquery/src/ajax';
  9. import IntellectualDesc from './intellectualDesc.jsx';
  10. const Intellectual = 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/user/cognizance/intellectualList",
  21. data: {
  22. pageNo: pageNo || 1,
  23. pageSize: this.state.pagination.pageSize,
  24. startDate: this.state.startDateFormattedDate,
  25. endDate: this.state.endDateFormattedDate
  26. }
  27. }).done((data) => {
  28. if (!data.data) {
  29. if (data.error && data.error.length) {
  30. message.warning(data.error[0].message);
  31. this.state.ButtonDisabled = true;
  32. }
  33. return;
  34. };
  35. for (let i = 0; i < data.data.list.length; i++) {
  36. let thisdata = data.data.list[i];
  37. this.state.data.push({
  38. key: i,
  39. id: thisdata.id,
  40. uid: thisdata.uid,
  41. intellectualPropertyNumber: thisdata.intellectualPropertyNumber,
  42. intellectualPropertyName: thisdata.intellectualPropertyName,
  43. sortNumber: thisdata.sortNumber,
  44. catagory: thisdata.catagory,
  45. obtainWay: thisdata.obtainWay,
  46. authorizationNumber: thisdata.authorizationNumber,
  47. authorizationDate: thisdata.authorizationDate,
  48. evaluationCategory: thisdata.evaluationCategory,
  49. authorizationDateFormattedDate: thisdata.authorizationDateFormattedDate,
  50. propertyRightUrl: thisdata.propertyRightUrl,
  51. propertyRightDownloadFileName: thisdata.propertyRightDownloadFileName,
  52. type:thisdata.type
  53. });
  54. };
  55. this.state.pagination.current = data.data.pageNo;
  56. this.state.pagination.total = data.data.totalCount;
  57. this.setState({
  58. dataSource: this.state.data,
  59. pagination: this.state.pagination
  60. });
  61. }).always(function () {
  62. this.setState({
  63. loading: false
  64. });
  65. }.bind(this));
  66. },
  67. getInitialState() {
  68. return {
  69. selectedRowKeys: [],
  70. selectedRows: [],
  71. loading: false,
  72. pagination: {
  73. defaultCurrent: 1,
  74. defaultPageSize: 10,
  75. showQuickJumper: true,
  76. pageSize: 10,
  77. onChange: function (page) {
  78. this.loadData(page);
  79. }.bind(this),
  80. showTotal: function (total) {
  81. return '共' + total + '条数据';
  82. }
  83. },
  84. columns: [
  85. {
  86. title: '知识产权编号',
  87. dataIndex: 'intellectualPropertyNumber',
  88. key: 'intellectualPropertyNumber'
  89. }, {
  90. title: '知识产权名称',
  91. dataIndex: 'intellectualPropertyName',
  92. key: 'intellectualPropertyName'
  93. }, {
  94. title: '排序号',
  95. dataIndex: 'sortNumber',
  96. key: 'sortNumber'
  97. }, {
  98. title: '知识产权类型',
  99. dataIndex: 'catagory',
  100. key: 'catagory',
  101. render: text => { return getCatagory(text) }
  102. }, {
  103. title: '获取方式',
  104. dataIndex: 'obtainWay',
  105. key: 'obtainWay',
  106. render: text => { return getIntellectualObtainWay(text) }
  107. }, {
  108. title: '授权号',
  109. dataIndex: 'authorizationNumber',
  110. key: 'authorizationNumber'
  111. }, {
  112. title: '授权时间',
  113. dataIndex: 'authorizationDateFormattedDate',
  114. key: 'authorizationDateFormattedDate'
  115. }
  116. ],
  117. dataSource: []
  118. };
  119. },
  120. componentWillMount() {
  121. this.loadData();
  122. },
  123. tableRowClick(record, index) {
  124. this.state.RowData = record;
  125. this.setState({
  126. showDesc: true
  127. });
  128. },
  129. delectRow() {
  130. let deletedIds = [];
  131. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  132. let rowItem = this.state.selectedRows[idx];
  133. if (rowItem.id) {
  134. deletedIds.push(rowItem.id)
  135. }
  136. }
  137. this.setState({
  138. selectedRowKeys: [],
  139. loading: deletedIds.length > 0
  140. });
  141. $.ajax({
  142. method: "POST",
  143. dataType: "json",
  144. crossDomain: false,
  145. url: globalConfig.context + "/api/user/cognizance/deleteIntellectual",
  146. data: {
  147. ids: deletedIds
  148. }
  149. }).done(function (data) {
  150. if (!data.error.length) {
  151. message.success('删除成功!');
  152. this.setState({
  153. loading: false,
  154. });
  155. } else {
  156. message.warning(data.error[0].message);
  157. };
  158. this.loadData();
  159. }.bind(this));
  160. },
  161. closeDesc(e, s) {
  162. this.state.showDesc = e;
  163. if (s) {
  164. this.loadData();
  165. };
  166. },
  167. search() {
  168. this.loadData();
  169. },
  170. reset() {
  171. this.state.startDateFormattedDate = undefined;
  172. this.state.endDateFormattedDate = undefined;
  173. this.loadData();
  174. },
  175. render() {
  176. const rowSelection = {
  177. selectedRowKeys: this.state.selectedRowKeys,
  178. onChange: (selectedRowKeys, selectedRows) => {
  179. this.setState({
  180. selectedRows: selectedRows,
  181. selectedRowKeys: selectedRowKeys
  182. });
  183. }
  184. };
  185. const hasSelected = this.state.selectedRowKeys.length > 0;
  186. return (
  187. <div className="user-content" >
  188. <div className="content-title">
  189. <span>知识产权列表</span>
  190. <Button
  191. disabled={this.state.ButtonDisabled}
  192. style={{ background: "#ea0862", border: "none", color: "#fff", float: "right" }}
  193. onClick={this.tableRowClick}>添加知识产权<Icon type="plus" /></Button>
  194. </div>
  195. <div className="user-search">
  196. <span>开始日期:</span>
  197. <DatePicker
  198. value={this.state.startDateFormattedDate ? moment(this.state.startDateFormattedDate) : null}
  199. onChange={(data, dataString) => { this.setState({ startDateFormattedDate: dataString }); }} />
  200. <span>结束日期:</span>
  201. <DatePicker
  202. value={this.state.endDateFormattedDate ? moment(this.state.endDateFormattedDate) : null}
  203. onChange={(data, dataString) => { this.setState({ endDateFormattedDate: dataString }); }} />
  204. <Button type="primary" onClick={this.search}>搜索</Button>
  205. <Button onClick={this.reset}>重置</Button>
  206. <Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
  207. disabled={!hasSelected}
  208. onClick={this.delectRow}>删除<Icon type="minus" /></Button>
  209. </div>
  210. <div className="patent-table">
  211. <Spin spinning={this.state.loading}>
  212. <Table columns={this.state.columns}
  213. dataSource={this.state.dataSource}
  214. pagination={this.state.pagination}
  215. rowSelection={rowSelection}
  216. onRowClick={this.tableRowClick} />
  217. </Spin>
  218. </div>
  219. <IntellectualDesc data={this.state.RowData} showDesc={this.state.showDesc} closeDesc={this.closeDesc} />
  220. </div >
  221. );
  222. }
  223. });
  224. export default Intellectual;