copyright.jsx 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. import React from 'react';
  2. import { Icon, Button, Input, Select, Spin, Table, DatePicker, message } from 'antd';
  3. import { copyrightStateList } from '../../../dataDic.js';
  4. import { getTime, getCopyrightState } from '../../../tools.js';
  5. import ajax from 'jquery/src/ajax/xhr.js';
  6. import $ from 'jquery/src/ajax';
  7. import PatentAdd from './comPatentAdd.jsx';
  8. import PatentChange from './comPatentChange.jsx';
  9. import './copyright.less';
  10. const copyright = React.createClass({
  11. loadData(pageNo) {
  12. this.state.data = [];
  13. this.setState({
  14. loading: true
  15. });
  16. $.ajax({
  17. method: "post",
  18. dataType: "json",
  19. crossDomain: false,
  20. url: globalConfig.context + "/techservice/patent/managePatentList",
  21. data: {
  22. pageNo: pageNo || 1,
  23. pageSize: this.state.pagination.pageSize,
  24. locationProvince: this.state.province,
  25. unitName: this.state.unitName,
  26. },
  27. success: function (data) {
  28. if (data.error.length || !data.data || !data.data.list) {
  29. message.warning(data.error[0].message);
  30. return;
  31. }
  32. this.state.pagination.defaultCurrent = data.data.pageNo;
  33. this.state.pagination.total = data.data.totalCount;
  34. this.setState({
  35. dataSource: data.data.list,
  36. pagination: this.state.pagination
  37. });
  38. }.bind(this),
  39. }).always(function () {
  40. this.setState({
  41. loading: false
  42. });
  43. }.bind(this));
  44. },
  45. getAuthorList() {
  46. this.setState({
  47. loading: true
  48. });
  49. $.ajax({
  50. method: "get",
  51. dataType: "json",
  52. crossDomain: false,
  53. url: globalConfig.context + "/techservice/cognizance/getContacts",
  54. success: function (data) {
  55. if (data.error.length || !data.data) {
  56. return;
  57. };
  58. this.state.contactsOption = [];
  59. for (let item in data2[0].data) {
  60. let theData = data2[0].data[item];
  61. contactsOption.push(
  62. <Select.Option value={item} key={theData}>{theData}</Select.Option>
  63. );
  64. };
  65. }.bind(this),
  66. }).always(function () {
  67. this.setState({
  68. loading: false
  69. });
  70. }.bind(this));
  71. },
  72. getInitialState() {
  73. return {
  74. visible: false,
  75. stateOption: [],
  76. data: [],
  77. selectedRowKeys: [],
  78. selectedRows: [],
  79. loading: false,
  80. showAdd: false,
  81. showDesc: false,
  82. pagination: {
  83. defaultCurrent: 1,
  84. defaultPageSize: 10,
  85. showQuickJumper: true,
  86. pageSize: 10,
  87. onChange: function (page) {
  88. this.loadData(page);
  89. }.bind(this),
  90. showTotal: function (total) {
  91. return '共' + total + '条数据';
  92. }
  93. },
  94. columns: [
  95. {
  96. title: '编号',
  97. dataIndex: 'number',
  98. key: 'number',
  99. }, {
  100. title: '软著名称',
  101. dataIndex: 'copyrightName',
  102. key: 'copyrightName',
  103. }, {
  104. title: '加急',
  105. dataIndex: 'urgent',
  106. key: 'urgent',
  107. }, {
  108. title: '咨询师',
  109. dataIndex: 'consultant',
  110. key: 'consultant',
  111. }, {
  112. title: '派单日',
  113. dataIndex: 'createTime',
  114. key: 'createTime',
  115. }, {
  116. title: '受理日',
  117. dataIndex: 'acceptanceTime',
  118. key: 'acceptanceTime',
  119. }, {
  120. title: '(预计)下证时间',
  121. dataIndex: 'endTime',
  122. key: 'endTime',
  123. }, {
  124. title: '派单信息',
  125. dataIndex: 'createInfo',
  126. key: 'createInfo',
  127. }, {
  128. title: '备注',
  129. dataIndex: 'explain',
  130. key: 'explain',
  131. }
  132. ],
  133. dataSource: []
  134. };
  135. },
  136. componentWillMount() {
  137. let _me = this;
  138. copyrightStateList.map(function (item) {
  139. _me.state.stateOption.push(
  140. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  141. )
  142. });
  143. this.loadData();
  144. this.getAuthorList();
  145. },
  146. tableRowClick(record, index) {
  147. this.state.RowData = record;
  148. this.setState({
  149. showDesc: true
  150. });
  151. },
  152. delectRow() {
  153. let deletedIds = [];
  154. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  155. let rowItem = this.state.selectedRows[idx];
  156. if (rowItem.cid) {
  157. deletedIds.push(rowItem.cid)
  158. }
  159. }
  160. this.setState({
  161. selectedRowKeys: [],
  162. loading: deletedIds.length > 0
  163. });
  164. $.ajax({
  165. method: "POST",
  166. dataType: "json",
  167. crossDomain: false,
  168. url: globalConfig.context + "/api/admin/deleteCognizance",
  169. data: {
  170. ids: deletedIds
  171. }
  172. }).done(function (data) {
  173. if (!data.error.length) {
  174. message.success('保存成功!');
  175. this.setState({
  176. loading: false,
  177. });
  178. } else {
  179. message.warning(data.error[0].message);
  180. };
  181. this.loadData();
  182. }.bind(this));
  183. },
  184. closeDesc(e, s) {
  185. this.state.showDesc = e;
  186. if (s) {
  187. this.loadData();
  188. };
  189. },
  190. addClick() {
  191. this.setState({
  192. showAdd: true
  193. });
  194. },
  195. closeAdd(e, s) {
  196. this.state.showAdd = e;
  197. if (s) {
  198. this.loadData();
  199. };
  200. },
  201. search() {
  202. this.loadData();
  203. },
  204. reset() {
  205. this.state.searchNumber = undefined;
  206. this.state.searchName = undefined;
  207. this.state.searchState = undefined;
  208. this.loadData();
  209. },
  210. render() {
  211. const rowSelection = {
  212. selectedRowKeys: this.state.selectedRowKeys,
  213. onChange: (selectedRowKeys, selectedRows) => {
  214. this.setState({
  215. selectedRows: selectedRows,
  216. selectedRowKeys: selectedRowKeys
  217. });
  218. }
  219. };
  220. const hasSelected = this.state.selectedRowKeys.length > 0;
  221. return (
  222. <div className="foster-box">
  223. <div className="foster-content">
  224. <div className="content-title">
  225. <span>软著申请管理</span>
  226. <PatentAdd
  227. onClick={this.addClick}
  228. closeAdd={this.closeAdd} />
  229. </div>
  230. <div className="foster-query">
  231. <Input placeholder="软著编号" value={this.state.searchNumber} onChange={(e) => { this.setState({ searchNumber: e.target.value }); }} />
  232. <Input placeholder="软著名称" value={this.state.searchName} onChange={(e) => { this.setState({ searchName: e.target.value }); }} />
  233. <Select placeholder="软著状态" value={this.state.searchState} style={{ width: 200 }} onChange={(e) => { this.setState({ searchState: e }); }}>{this.state.stateOption}</Select>
  234. <Button type="primary" onClick={this.search}>搜索</Button>
  235. <Button onClick={this.reset}>重置</Button>
  236. <Button style={{ background: "#3fcf9e", border: "none", color: "#fff", display: 'none' }}
  237. disabled={!hasSelected}
  238. onClick={this.delectRow}>删除<Icon type="minus" /></Button>
  239. </div>
  240. <div className="foster-table">
  241. <Spin spinning={this.state.loading}>
  242. <Table columns={this.state.columns}
  243. //rowSelection={rowSelection}
  244. dataSource={this.state.dataSource}
  245. pagination={this.state.pagination}
  246. onRowClick={this.tableRowClick} />
  247. </Spin>
  248. </div>
  249. <PatentChange
  250. data={this.state.RowData}
  251. showDesc={this.state.showDesc}
  252. closeDesc={this.closeDesc} />
  253. </div >
  254. </div>
  255. );
  256. }
  257. });
  258. export default copyright;