highTechFoster.jsx 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. import React from 'react';
  2. import { Icon, Button, Input, Select, Spin, Table, message, Cascader } from 'antd';
  3. import { provinceArr } from '../../../dataDic.js';
  4. import { getTime, getCognizanceState, companySearch } from '../../../tools.js';
  5. import ajax from 'jquery/src/ajax/xhr.js';
  6. import $ from 'jquery/src/ajax';
  7. import moment from 'moment';
  8. import './highTechFoster.less';
  9. import FosterDesc from './fosterDesc/content.jsx';
  10. const Patent = 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 + "/api/admin/cultivate",
  21. data: {
  22. pageNo: pageNo || 1,
  23. pageSize: this.state.pagination.pageSize,
  24. locationProvince: this.state.province,
  25. uid: 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. for (let i = 0; i < data.data.list.length; i++) {
  33. let thisdata = data.data.list[i];
  34. this.state.data.push({
  35. key: i,
  36. certificateNumber: thisdata.certificateNumber,
  37. contacts: [thisdata.cogContacts, {
  38. '1': thisdata.firstContacts,
  39. '2': thisdata.secondContacts,
  40. '3': thisdata.thirdContacts
  41. }],
  42. cogContacts: thisdata.cogContacts,
  43. consultant: thisdata.consultant,
  44. techPrincipal: thisdata.techPrincipal,
  45. firstContacts: thisdata.firstContacts,
  46. issuingDate: thisdata.issuingDate,
  47. issuingDateFormattedDate: thisdata.issuingDateFormattedDate,
  48. endtime: thisdata.issuingDateFormattedDate ? getTime(thisdata.issuingDateFormattedDate, 36) : null,
  49. province: thisdata.province,
  50. secondContacts: thisdata.secondContacts,
  51. thirdContacts: thisdata.thirdContacts,
  52. uid: thisdata.uid,
  53. unitName: thisdata.unitName,
  54. state: thisdata.issuingDateFormattedDate ? getTime(thisdata.issuingDateFormattedDate, 36) : null,
  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. getCompanyList() {
  71. this.setState({
  72. loading: true
  73. });
  74. $.ajax({
  75. method: "get",
  76. dataType: "json",
  77. crossDomain: false,
  78. url: globalConfig.context + "/api/admin/getUnitNames",
  79. success: function (data) {
  80. if (!data.data) {
  81. if (data.error && data.error.length) {
  82. message.warning(data.error[0].message);
  83. };
  84. return;
  85. };
  86. let _me = this;
  87. for (var item in data.data) {
  88. _me.state.companyOption.push(
  89. <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
  90. )
  91. };
  92. }.bind(this),
  93. }).always(function () {
  94. this.setState({
  95. loading: false
  96. });
  97. }.bind(this));
  98. },
  99. getInitialState() {
  100. return {
  101. provinceOption: [],
  102. companyOption: [],
  103. fosterDescDisplay: 'none',
  104. fosterDisplay: 'block',
  105. data: [],
  106. loading: false,
  107. pagination: {
  108. defaultCurrent: 1,
  109. defaultPageSize: 10,
  110. showQuickJumper: true,
  111. pageSize: 10,
  112. onChange: function (page) {
  113. this.loadData(page);
  114. }.bind(this),
  115. showTotal: function (total) {
  116. return '共' + total + '条数据';
  117. }
  118. },
  119. columns: [
  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. render: (text) => {
  133. for (let item in text[1]) {
  134. if (text[0] == item) {
  135. return text[1][item];
  136. };
  137. };
  138. }
  139. }, {
  140. title: '状态',
  141. dataIndex: 'state',
  142. key: 'state',
  143. render: text => {
  144. if (text) {
  145. let n = moment(new Date()).format("YYYY-MM-DD");
  146. if (text > n) {
  147. return '已下证';
  148. } else {
  149. return '已到期';
  150. }
  151. } else {
  152. return '培育中';
  153. }
  154. }
  155. }, {
  156. title: '证书编号',
  157. dataIndex: 'certificateNumber',
  158. key: 'certificateNumber',
  159. }, {
  160. title: '发证日期',
  161. dataIndex: 'issuingDateFormattedDate',
  162. key: 'issuingDateFormattedDate',
  163. }, {
  164. title: '到期日期',
  165. dataIndex: 'endtime',
  166. key: 'endtime'
  167. }, {
  168. title: '业务员',
  169. dataIndex: 'consultant',
  170. key: 'consultant',
  171. }, {
  172. title: '技术员',
  173. dataIndex: 'techPrincipal',
  174. key: 'techPrincipal',
  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. this.loadData();
  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. <Spin spinning={this.state.loading}>
  215. <div className="foster-box">
  216. <div className="foster-content" style={{ display: this.state.fosterDisplay }}>
  217. <div className="content-title">
  218. <span>高企认定培育</span>
  219. </div>
  220. <div className="foster-query">
  221. <Select placeholder="选择省份"
  222. style={{ width: 200 }}
  223. value={this.state.province}
  224. showSearch
  225. filterOption={companySearch}
  226. onChange={(e) => { this.setState({ province: e }) }}>
  227. {this.state.provinceOption}
  228. </Select>
  229. <Select placeholder="选择公司"
  230. style={{ width: 200 }}
  231. value={this.state.unitName}
  232. showSearch
  233. filterOption={companySearch}
  234. onChange={(e) => { this.setState({ unitName: e }) }}>
  235. {this.state.companyOption}
  236. </Select>
  237. <Button type="primary" onClick={this.search}>搜索</Button>
  238. <Button onClick={this.reset}>重置</Button>
  239. </div>
  240. <div className="foster-table">
  241. <Table columns={this.state.columns}
  242. dataSource={this.state.dataSource}
  243. pagination={this.state.pagination}
  244. onRowClick={this.tableRowClick} />
  245. </div>
  246. </div >
  247. <FosterDesc
  248. style={this.state.fosterDescDisplay}
  249. data={this.state.RowData}
  250. returnBtn={this.returnBtn} />
  251. </div>
  252. </Spin>
  253. );
  254. }
  255. });
  256. export default Patent;