technology.jsx 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. import React from 'react';
  2. import { Icon, Button, Select, Spin, Table, message } from 'antd';
  3. import { companySearch, getTechnologyState } from '../../tools.js';
  4. import ajax from 'jquery/src/ajax/xhr.js';
  5. import $ from 'jquery/src/ajax';
  6. import './technology.less';
  7. import ApplyAdd from './technologyAdd.jsx';
  8. import ApplyChange from './technologyChange.jsx';
  9. const Technology = React.createClass({
  10. loadData(pageNo) {
  11. this.state.data = [];
  12. this.setState({
  13. loading: true
  14. });
  15. $.ajax({
  16. method: "post",
  17. dataType: "json",
  18. crossDomain: false,
  19. url: globalConfig.context + "/api/techproject/listClientTechProject",
  20. success: function (data) {
  21. if (data.error.length || !data.data || !data.data.list) {
  22. message.warning(data.error[0].message);
  23. return;
  24. }
  25. for (let i = 0; i < data.data.list.length; i++) {
  26. let thisdata = data.data.list[i];
  27. switch (thisdata.contacts){
  28. case 1:
  29. thisdata.contacts = thisdata.firstContacts;
  30. break;
  31. case 2:
  32. thisdata.contacts = thisdata.secondContacts;
  33. break;
  34. case 3:
  35. thisdata.contacts = thisdata.thirdContacts;
  36. break;
  37. }
  38. this.state.data.push({
  39. key: i,
  40. pid: thisdata.id,
  41. uid: thisdata.uid,
  42. serialNumber: thisdata.serialNumber,
  43. province: thisdata.province,
  44. unitName: thisdata.unitName,
  45. contacts: thisdata.contacts,
  46. projectName: thisdata.projectName,
  47. projectCatagory: thisdata.projectCatagory,
  48. techField: thisdata.techField,
  49. state: thisdata.state,
  50. createTime: thisdata.createTimeFormattedDate,
  51. website: thisdata.website,
  52. accountNumber: thisdata.accountNumber,
  53. password: thisdata.password,
  54. consultant: thisdata.consultant
  55. });
  56. };
  57. this.state.pagination.current = data.data.pageNo;
  58. this.state.pagination.total = data.data.totalCount;
  59. this.setState({
  60. dataSource: this.state.data,
  61. pagination: this.state.pagination
  62. });
  63. }.bind(this),
  64. }).always(function () {
  65. this.setState({
  66. loading: false
  67. });
  68. }.bind(this));
  69. },
  70. getAuthorList() {
  71. this.setState({
  72. loading: true
  73. });
  74. $.ajax({
  75. method: "get",
  76. dataType: "json",
  77. crossDomain: false,
  78. url: globalConfig.context + "/techservice/patent/getAdmin",
  79. success: function (data) {
  80. if (data.error.length || !data.data) {
  81. return;
  82. };
  83. let _me = this;
  84. for (var item in data.data) {
  85. _me.state.authorOption.push(
  86. <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
  87. )
  88. };
  89. }.bind(this),
  90. }).always(function () {
  91. this.setState({
  92. loading: false
  93. });
  94. }.bind(this));
  95. },
  96. getInitialState() {
  97. return {
  98. authorOption: [],
  99. selectedRows: [],
  100. loading: false,
  101. showAdd: false,
  102. showDesc: false,
  103. pagination: {
  104. defaultCurrent: 1,
  105. defaultPageSize: 10,
  106. showQuickJumper: true,
  107. pageSize: 10,
  108. onChange: function (page) {
  109. this.loadData(page);
  110. }.bind(this),
  111. showTotal: function (total) {
  112. return '共' + total + '条数据';
  113. }
  114. },
  115. columns: [
  116. {
  117. title: '编号',
  118. dataIndex: 'serialNumber',
  119. key: 'serialNumber'
  120. }, {
  121. title: '省份',
  122. dataIndex: 'province',
  123. key: 'province'
  124. }, {
  125. title: '公司',
  126. dataIndex: 'unitName',
  127. key: 'unitName'
  128. }, {
  129. title: '联系方式',
  130. dataIndex: 'contacts',
  131. key: 'contacts'
  132. }, {
  133. title: '项目名称',
  134. dataIndex: 'projectName',
  135. key: 'projectName'
  136. }, {
  137. title: '项目类型',
  138. dataIndex: 'projectCatagory',
  139. key: 'projectCatagory'
  140. },{
  141. title: '技术领域',
  142. dataIndex: 'techField',
  143. key: 'techField'
  144. }, {
  145. title: '项目情况',
  146. dataIndex: 'state',
  147. key: 'state',
  148. render: text => { return getTechnologyState(text) },
  149. },{
  150. title: '派单日',
  151. dataIndex: 'createTime',
  152. key: 'createTime'
  153. }, {
  154. title: '网址',
  155. dataIndex: 'website',
  156. key: 'website'
  157. }, {
  158. title: '用户名',
  159. dataIndex: 'accountNumber',
  160. key: 'accountNumber'
  161. }, {
  162. title: '密码',
  163. dataIndex: 'password',
  164. key: 'password'
  165. }, {
  166. title: '咨询师',
  167. dataIndex: 'consultant',
  168. key: 'consultant'
  169. }
  170. ],
  171. dataSource: []
  172. };
  173. },
  174. componentWillMount() {
  175. this.loadData();
  176. this.getAuthorList();
  177. // this.getContactsList();
  178. },
  179. tableRowClick(record, index) {
  180. this.state.RowData = record;
  181. this.setState({
  182. showDesc: true
  183. });
  184. },
  185. addClick() {
  186. this.setState({
  187. showAdd: true
  188. });
  189. },
  190. delectRow() {
  191. let deletedIds = [];
  192. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  193. let rowItem = this.state.selectedRows[idx];
  194. if (rowItem.id) {
  195. deletedIds.push(rowItem.id)
  196. }
  197. }
  198. $.ajax({
  199. method: "POST",
  200. dataType: "json",
  201. crossDomain: false,
  202. url: globalConfig.context + "/techservice/cognizance/deleteCognizance",
  203. data: {
  204. ids: deletedIds
  205. }
  206. }).done(function (data) {
  207. if (!data.error.length) {
  208. message.success('保存成功!');
  209. this.setState({
  210. loading: false,
  211. });
  212. } else {
  213. message.warning(data.error[0].message);
  214. };
  215. this.loadData();
  216. }.bind(this));
  217. },
  218. closeDesc(e) {
  219. this.state.showDesc = e;
  220. this.loadData();
  221. },
  222. closeAdd(e) {
  223. this.state.showAdd = e;
  224. this.loadData();
  225. },
  226. render() {
  227. return (
  228. <div className="foster-content" >
  229. <div className="content-title">
  230. <span>科技项目申报管理</span>
  231. <div className="foster-query" style={{ float: "right" }}>
  232. <div>
  233. <Button style={{ background: "#ea0862", border: "none", color: "#fff" }}
  234. onClick={this.addClick}>申请新科技项目<Icon type="plus" /></Button>
  235. </div>
  236. </div>
  237. </div>
  238. <div className="patent-table">
  239. <Spin spinning={this.state.loading}>
  240. <Table columns={this.state.columns}
  241. dataSource={this.state.dataSource}
  242. pagination={this.state.pagination}
  243. onRowClick={this.tableRowClick} />
  244. </Spin>
  245. </div>
  246. <ApplyChange
  247. data={this.state.RowData}
  248. authorOption={this.state.authorOption}
  249. showDesc={this.state.showDesc}
  250. closeDesc={this.closeDesc} />
  251. <ApplyAdd
  252. authorOption={this.state.authorOption}
  253. showAdd={this.state.showAdd}
  254. closeAdd={this.closeAdd} />
  255. </div >
  256. );
  257. }
  258. });
  259. export default Technology;