copyright.jsx 9.2 KB

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