highTechFoster.jsx 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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. techPrincipal:thisdata.techPrincipal
  56. });
  57. };
  58. this.state.pagination.current = data.data.pageNo;
  59. this.state.pagination.total = data.data.totalCount;
  60. this.setState({
  61. dataSource: this.state.data,
  62. pagination: this.state.pagination
  63. });
  64. }.bind(this),
  65. }).always(function () {
  66. this.setState({
  67. loading: false
  68. });
  69. }.bind(this));
  70. },
  71. getCompanyList() {
  72. this.setState({
  73. loading: true
  74. });
  75. $.ajax({
  76. method: "get",
  77. dataType: "json",
  78. crossDomain: false,
  79. url: globalConfig.context + "/api/admin/getUnitNames",
  80. success: function (data) {
  81. if (!data.data) {
  82. if (data.error && data.error.length) {
  83. message.warning(data.error[0].message);
  84. };
  85. return;
  86. };
  87. let _me = this;
  88. for (var item in data.data) {
  89. _me.state.companyOption.push(
  90. <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
  91. )
  92. };
  93. }.bind(this),
  94. }).always(function () {
  95. this.setState({
  96. loading: false
  97. });
  98. }.bind(this));
  99. },
  100. getInitialState() {
  101. return {
  102. provinceOption: [],
  103. companyOption: [],
  104. fosterDescDisplay: 'none',
  105. fosterDisplay: 'block',
  106. data: [],
  107. loading: false,
  108. pagination: {
  109. defaultCurrent: 1,
  110. defaultPageSize: 10,
  111. showQuickJumper: true,
  112. pageSize: 10,
  113. onChange: function (page) {
  114. this.loadData(page);
  115. }.bind(this),
  116. showTotal: function (total) {
  117. return '共' + total + '条数据';
  118. }
  119. },
  120. columns: [
  121. {
  122. title: '省份',
  123. dataIndex: 'province',
  124. key: 'province',
  125. }, {
  126. title: '公司名称',
  127. dataIndex: 'unitName',
  128. key: 'unitName',
  129. }, {
  130. title: '联系人',
  131. dataIndex: 'contacts',
  132. key: 'contacts',
  133. render: (text) => {
  134. for (let item in text[1]) {
  135. if (text[0] == item) {
  136. return text[1][item];
  137. };
  138. };
  139. }
  140. }, {
  141. title: '状态',
  142. dataIndex: 'state',
  143. key: 'state',
  144. render: text => {
  145. if (text) {
  146. let n = moment(new Date()).format("YYYY-MM-DD");
  147. if (text > n) {
  148. return '已下证';
  149. } else {
  150. return '已到期';
  151. }
  152. } else {
  153. return '培育中';
  154. }
  155. }
  156. }, {
  157. title: '证书编号',
  158. dataIndex: 'certificateNumber',
  159. key: 'certificateNumber',
  160. }, {
  161. title: '发证日期',
  162. dataIndex: 'issuingDateFormattedDate',
  163. key: 'issuingDateFormattedDate',
  164. }, {
  165. title: '到期日期',
  166. dataIndex: 'endtime',
  167. key: 'endtime'
  168. }, {
  169. title: '业务员',
  170. dataIndex: 'consultant',
  171. key: 'consultant',
  172. }, {
  173. title: '技术员',
  174. dataIndex: 'techPrincipal',
  175. key: 'techPrincipal',
  176. }
  177. ],
  178. dataSource: []
  179. };
  180. },
  181. componentWillMount() {
  182. let _me = this;
  183. provinceArr.map(function (item) {
  184. _me.state.provinceOption.push(
  185. <Select.Option value={item} key={item}>{item}</Select.Option>
  186. )
  187. });
  188. this.loadData();
  189. this.getCompanyList();
  190. },
  191. tableRowClick(record, index) {
  192. this.state.RowData = record;
  193. this.setState({
  194. fosterDisplay: 'none',
  195. fosterDescDisplay: 'block'
  196. });
  197. },
  198. search() {
  199. this.loadData();
  200. },
  201. reset() {
  202. this.state.province = undefined;
  203. this.state.unitName = undefined;
  204. this.loadData();
  205. },
  206. returnBtn() {
  207. this.setState({
  208. fosterDisplay: 'block',
  209. fosterDescDisplay: 'none'
  210. });
  211. this.loadData();
  212. },
  213. render() {
  214. return (
  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. <Spin spinning={this.state.loading}>
  242. <Table columns={this.state.columns}
  243. dataSource={this.state.dataSource}
  244. pagination={this.state.pagination}
  245. onRowClick={this.tableRowClick} />
  246. </Spin>
  247. </div>
  248. </div >
  249. <FosterDesc
  250. style={this.state.fosterDescDisplay}
  251. data={this.state.RowData}
  252. returnBtn={this.returnBtn} />
  253. </div>
  254. );
  255. }
  256. });
  257. export default Patent;