highTechFoster.jsx 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. import React from 'react';
  2. import { Icon, Button, Input, Select, Spin, Table, DatePicker, message, Cascader } from 'antd';
  3. import { techFieldList, provinceArr } from '../../../dataDic.js';
  4. import { getTime, getPatentState } from '../../../tools.js';
  5. import ajax from 'jquery/src/ajax/xhr.js';
  6. import $ from 'jquery/src/ajax';
  7. import './highTechFoster.less';
  8. import FosterDesc from './fosterDesc/content.jsx';
  9. const Patent = 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/admin/listCognizance",
  20. data: {
  21. pageNo: pageNo || 1,
  22. pageSize: this.state.pagination.pageSize,
  23. locationProvince: this.state.province,
  24. unitName: this.state.unitName,
  25. },
  26. success: function (data) {
  27. if (data.error.length || !data.data || !data.data.list) {
  28. message.warning(data.error[0].message);
  29. return;
  30. }
  31. for (let i = 0; i < data.data.list.length; i++) {
  32. let thisdata = data.data.list[i];
  33. this.state.data.push({
  34. key: i,
  35. uid: thisdata.uid,
  36. cid: thisdata.cid,
  37. serialNumber: thisdata.serialNumber,
  38. locationProvince: thisdata.locationProvince,
  39. unitName: thisdata.unitName,
  40. contacts: thisdata.contacts,
  41. createTime: thisdata.createTime,
  42. comment: thisdata.comment,
  43. state: thisdata.state,
  44. certificateNumber: thisdata.certificateNumber,
  45. issuingDate: thisdata.issuingDate,
  46. consultant: thisdata.consultant,
  47. createTimeFormattedDate: thisdata.createTimeFormattedDate,
  48. issuingDateFormattedDate: thisdata.issuingDateFormattedDate,
  49. endtime: getTime(thisdata.issuingDateFormattedDate, 36)
  50. });
  51. };
  52. this.state.pagination.current = data.data.pageNo;
  53. this.state.pagination.total = data.data.totalCount;
  54. this.setState({
  55. dataSource: this.state.data,
  56. pagination: this.state.pagination
  57. });
  58. }.bind(this),
  59. }).always(function () {
  60. this.setState({
  61. loading: false
  62. });
  63. }.bind(this));
  64. },
  65. getAuthorList() {
  66. this.setState({
  67. loading: true
  68. });
  69. $.ajax({
  70. method: "get",
  71. dataType: "json",
  72. crossDomain: false,
  73. url: globalConfig.context + "/techservice/patent/getAdmin",
  74. success: function (data) {
  75. if (data.error.length || !data.data) {
  76. return;
  77. };
  78. let _me = this;
  79. for (var item in data.data) {
  80. _me.state.authorOption.push(
  81. <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
  82. )
  83. };
  84. }.bind(this),
  85. }).always(function () {
  86. this.setState({
  87. loading: false
  88. });
  89. }.bind(this));
  90. },
  91. getCompanyList() {
  92. this.setState({
  93. loading: true
  94. });
  95. $.ajax({
  96. method: "get",
  97. dataType: "json",
  98. crossDomain: false,
  99. url: globalConfig.context + "/techservice/patent/getUnitNames",
  100. success: function (data) {
  101. if (data.error.length || !data.data) {
  102. return;
  103. };
  104. let _me = this;
  105. for (var item in data.data) {
  106. _me.state.companyOption.push(
  107. <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
  108. )
  109. };
  110. }.bind(this),
  111. }).always(function () {
  112. this.setState({
  113. loading: false
  114. });
  115. }.bind(this));
  116. },
  117. getInitialState() {
  118. return {
  119. provinceOption: [],
  120. companyOption: [],
  121. authorOption: [],
  122. fosterDescDisplay: 'none',
  123. fosterDisplay: 'block',
  124. province: '',
  125. unitName: '',
  126. data: [],
  127. loading: false,
  128. pagination: {
  129. defaultCurrent: 1,
  130. defaultPageSize: 10,
  131. showQuickJumper: true,
  132. pageSize: 10,
  133. onChange: function (page) {
  134. this.loadData(page);
  135. }.bind(this),
  136. showTotal: function (total) {
  137. return '共' + total + '条数据';
  138. }
  139. },
  140. columns: [
  141. {
  142. title: '省份',
  143. dataIndex: 'locationProvince',
  144. key: 'locationProvince',
  145. }, {
  146. title: '公司名称',
  147. dataIndex: 'unitName',
  148. key: 'unitName',
  149. }, {
  150. title: '联系方式',
  151. dataIndex: 'contacts',
  152. key: 'contacts',
  153. }, {
  154. title: '状态',
  155. dataIndex: 'state',
  156. key: 'state',
  157. render: text => { return getPatentState(text) }
  158. }, {
  159. title: '证书编号',
  160. dataIndex: 'certificateNumber',
  161. key: 'certificateNumber',
  162. }, {
  163. title: '发证日期',
  164. dataIndex: 'issuingDateFormattedDate',
  165. key: 'issuingDateFormattedDate',
  166. }, {
  167. title: '到期日期',
  168. dataIndex: 'endtime',
  169. key: 'endtime'
  170. }, {
  171. title: '咨询师',
  172. dataIndex: 'consultant',
  173. key: 'consultant',
  174. }
  175. ],
  176. dataSource: []
  177. };
  178. },
  179. componentWillMount() {
  180. let _me = this;
  181. provinceArr.map(function (item) {
  182. _me.state.provinceOption.push(
  183. <Select.Option value={item} key={item}>{item}</Select.Option>
  184. )
  185. });
  186. this.loadData();
  187. this.getAuthorList();
  188. this.getCompanyList();
  189. },
  190. tableRowClick(record, index) {
  191. this.state.RowData = record;
  192. this.setState({
  193. fosterDisplay: 'none',
  194. fosterDescDisplay: 'block'
  195. });
  196. },
  197. search() {
  198. this.loadData();
  199. },
  200. reset() {
  201. this.state.province = undefined;
  202. this.state.unitName = undefined;
  203. this.loadData();
  204. },
  205. returnBtn() {
  206. this.setState({
  207. fosterDisplay: 'block',
  208. fosterDescDisplay: 'none'
  209. });
  210. this.loadData();
  211. },
  212. render() {
  213. return (
  214. <div className="foster-box">
  215. <div className="foster-content" style={{ display: this.state.fosterDisplay }}>
  216. <div className="content-title">
  217. <span>高企认定培育</span>
  218. </div>
  219. <div className="foster-query">
  220. <Select placeholder="选择省份" style={{ width: 200 }} onChange={(e) => { this.state.province = e }}>{this.state.provinceOption}</Select>
  221. <Select placeholder="选择公司" style={{ width: 200 }} onChange={(e) => { this.state.unitName = e }}>{this.state.companyOption}</Select>
  222. <Button type="primary" onClick={this.search}>搜索</Button>
  223. <Button onClick={this.reset}>重置</Button>
  224. </div>
  225. <div className="foster-table">
  226. <Spin spinning={this.state.loading}>
  227. <Table columns={this.state.columns}
  228. dataSource={this.state.dataSource}
  229. pagination={this.state.pagination}
  230. onRowClick={this.tableRowClick} />
  231. </Spin>
  232. </div>
  233. </div >
  234. <FosterDesc style={this.state.fosterDescDisplay}
  235. data={this.state.RowData}
  236. returnBtn={this.returnBtn} />
  237. </div>
  238. );
  239. }
  240. });
  241. export default Patent;