copyright.jsx 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. import React from 'react';
  2. import { Icon, Button, Input, Select, Spin, Table, DatePicker, message, Cascader } from 'antd';
  3. import { provinceArr } from '../../../dataDic.js';
  4. import { getTime, getPatentState, companySearch } 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 PatentDesc from '../patent/comPatentDesc.jsx';
  10. import './copyright.less';
  11. const copyright = React.createClass({
  12. loadData(pageNo) {
  13. this.state.data = [];
  14. this.setState({
  15. loading: true
  16. });
  17. $.ajax({
  18. method: "post",
  19. dataType: "json",
  20. crossDomain: false,
  21. url: globalConfig.context + "/techservice/patent/managePatentList",
  22. data: {
  23. pageNo: pageNo || 1,
  24. pageSize: this.state.pagination.pageSize,
  25. locationProvince: this.state.province,
  26. unitName: this.state.unitName,
  27. },
  28. success: function (data) {
  29. if (data.error.length || !data.data || !data.data.list) {
  30. message.warning(data.error[0].message);
  31. return;
  32. }
  33. this.state.pagination.defaultCurrent = data.data.pageNo;
  34. this.state.pagination.total = data.data.totalCount;
  35. this.setState({
  36. dataSource: data.data.list,
  37. pagination: this.state.pagination
  38. });
  39. }.bind(this),
  40. }).always(function () {
  41. this.setState({
  42. loading: false
  43. });
  44. }.bind(this));
  45. },
  46. getAuthorList() {
  47. this.setState({
  48. loading: true
  49. });
  50. $.ajax({
  51. method: "get",
  52. dataType: "json",
  53. crossDomain: false,
  54. url: globalConfig.context + "/techservice/patent/getAdmin",
  55. success: function (data) {
  56. if (data.error.length || !data.data) {
  57. return;
  58. };
  59. let _me = this;
  60. for (var item in data.data) {
  61. _me.state.authorOption.push(
  62. <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
  63. )
  64. };
  65. }.bind(this),
  66. }).always(function () {
  67. this.setState({
  68. loading: false
  69. });
  70. }.bind(this));
  71. },
  72. getCompanyList() {
  73. this.setState({
  74. loading: true
  75. });
  76. $.ajax({
  77. method: "get",
  78. dataType: "json",
  79. crossDomain: false,
  80. url: globalConfig.context + "/techservice/patent/getUnitNames",
  81. success: function (data) {
  82. if (data.error.length || !data.data) {
  83. return;
  84. };
  85. let _me = this;
  86. for (var item in data.data) {
  87. _me.state.companyOption.push(
  88. <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
  89. )
  90. };
  91. }.bind(this),
  92. }).always(function () {
  93. this.setState({
  94. loading: false
  95. });
  96. }.bind(this));
  97. },
  98. getInitialState() {
  99. return {
  100. visible: false,
  101. provinceOption: [],
  102. companyOption: [],
  103. authorOption: [],
  104. data: [],
  105. selectedRowKeys: [],
  106. selectedRows: [],
  107. loading: false,
  108. showAdd: false,
  109. showDesc: false,
  110. pagination: {
  111. defaultCurrent: 1,
  112. defaultPageSize: 10,
  113. showQuickJumper: true,
  114. pageSize: 10,
  115. onChange: function (page) {
  116. this.loadData(page);
  117. }.bind(this),
  118. showTotal: function (total) {
  119. return '共' + total + '条数据';
  120. }
  121. },
  122. columns: [
  123. {
  124. title: '编号',
  125. dataIndex: 'number',
  126. key: 'number',
  127. }, {
  128. title: '省份',
  129. dataIndex: 'province',
  130. key: 'province',
  131. }, {
  132. title: '外包公司',
  133. dataIndex: 'outsource',
  134. key: 'outsource',
  135. }, {
  136. title: '公司名称',
  137. dataIndex: 'unitName',
  138. key: 'unitName',
  139. }, {
  140. title: '联系方式',
  141. dataIndex: 'contacts',
  142. key: 'contacts',
  143. }, {
  144. title: '派单信息',
  145. dataIndex: 'createInfo',
  146. key: 'createInfo',
  147. }, {
  148. title: '软著名称',
  149. dataIndex: 'copyrightName',
  150. key: 'copyrightName',
  151. }, {
  152. title: '加急',
  153. dataIndex: 'urgent',
  154. key: 'urgent',
  155. }, {
  156. title: '咨询师',
  157. dataIndex: 'consultant',
  158. key: 'consultant',
  159. }, {
  160. title: '派单日',
  161. dataIndex: 'createTime',
  162. key: 'createTime',
  163. }, {
  164. title: '受理日',
  165. dataIndex: 'acceptanceTime',
  166. key: 'acceptanceTime',
  167. }, {
  168. title: '(预计)下证时间',
  169. dataIndex: 'endTime',
  170. key: 'endTime',
  171. }, {
  172. title: '备注',
  173. dataIndex: 'explain',
  174. key: 'explain',
  175. }
  176. ],
  177. dataSource: []
  178. };
  179. },
  180. componentWillMount() {
  181. let _me = this;
  182. provinceArr.map(function (item) {
  183. _me.state.provinceOption.push(
  184. <Select.Option value={item} key={item}>{item}</Select.Option>
  185. )
  186. });
  187. //console.log(this.state.pagination.total);
  188. this.loadData();
  189. this.getAuthorList();
  190. this.getCompanyList();
  191. },
  192. tableRowClick(record, index) {
  193. this.state.RowData = record;
  194. this.setState({
  195. showDesc: true
  196. });
  197. },
  198. delectRow() {
  199. let deletedIds = [];
  200. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  201. let rowItem = this.state.selectedRows[idx];
  202. if (rowItem.cid) {
  203. deletedIds.push(rowItem.cid)
  204. }
  205. }
  206. this.setState({
  207. selectedRowKeys: [],
  208. loading: deletedIds.length > 0
  209. });
  210. $.ajax({
  211. method: "POST",
  212. dataType: "json",
  213. crossDomain: false,
  214. url: globalConfig.context + "/api/admin/deleteCognizance",
  215. data: {
  216. ids: deletedIds
  217. }
  218. }).done(function (data) {
  219. if (!data.error.length) {
  220. message.success('保存成功!');
  221. this.setState({
  222. loading: false,
  223. });
  224. } else {
  225. message.warning(data.error[0].message);
  226. };
  227. this.loadData();
  228. }.bind(this));
  229. },
  230. closeDesc(e, s) {
  231. this.state.showDesc = e;
  232. if (s) {
  233. this.loadData();
  234. };
  235. },
  236. addClick() {
  237. this.setState({
  238. showAdd: true
  239. });
  240. },
  241. closeAdd(e, s) {
  242. this.state.showAdd = e;
  243. if (s) {
  244. this.loadData();
  245. };
  246. },
  247. search() {
  248. this.loadData();
  249. },
  250. reset() {
  251. this.state.province = undefined;
  252. this.state.unitName = undefined;
  253. this.loadData();
  254. },
  255. render() {
  256. const rowSelection = {
  257. selectedRowKeys: this.state.selectedRowKeys,
  258. onChange: (selectedRowKeys, selectedRows) => {
  259. this.setState({
  260. selectedRows: selectedRows,
  261. selectedRowKeys: selectedRowKeys
  262. });
  263. }
  264. };
  265. const hasSelected = this.state.selectedRowKeys.length > 0;
  266. return (
  267. <div className="foster-box">
  268. <div className="foster-content">
  269. <div className="content-title">
  270. <span>软著申请管理</span>
  271. <PatentAdd
  272. companyOption={this.state.companyOption}
  273. authorOption={this.state.authorOption}
  274. onClick={this.addClick}
  275. closeAdd={this.closeAdd} />
  276. </div>
  277. <div className="foster-query">
  278. <Select placeholder="选择省份"
  279. style={{ width: 200 }}
  280. value={this.state.province}
  281. showSearch
  282. filterOption={companySearch}
  283. onChange={(e) => { this.setState({ province: e }) }}>
  284. {this.state.provinceOption}
  285. </Select>
  286. <Select placeholder="选择公司"
  287. style={{ width: 200 }}
  288. value={this.state.unitName}
  289. showSearch
  290. filterOption={companySearch}
  291. onChange={(e) => { this.setState({ unitName: e }) }}>
  292. {this.state.companyOption}
  293. </Select>
  294. <Button type="primary" onClick={this.search}>搜索</Button>
  295. <Button onClick={this.reset}>重置</Button>
  296. <Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
  297. disabled={!hasSelected}
  298. onClick={this.delectRow}>删除<Icon type="minus" /></Button>
  299. </div>
  300. <div className="foster-table">
  301. <Spin spinning={this.state.loading}>
  302. <Table columns={this.state.columns}
  303. rowSelection={rowSelection}
  304. dataSource={this.state.dataSource}
  305. pagination={this.state.pagination}
  306. onRowClick={this.tableRowClick} />
  307. </Spin>
  308. </div>
  309. <PatentChange
  310. data={this.state.RowData}
  311. authorOption={this.state.authorOption}
  312. showDesc={this.state.showDesc}
  313. closeDesc={this.closeDesc} />
  314. </div >
  315. </div>
  316. );
  317. }
  318. });
  319. export default copyright;