highTechFoster.jsx 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. import React from 'react';
  2. import { Icon, Button, Input, Select, Spin, Table, message, Cascader } from 'antd';
  3. import { provinceSelect, getProvince } from '../../../NewDicProvinceList';
  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 ? this.state.province[0] : undefined,
  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. companyOption: [],
  102. fosterDescDisplay: 'none',
  103. fosterDisplay: 'block',
  104. data: [],
  105. loading: false,
  106. pagination: {
  107. defaultCurrent: 1,
  108. defaultPageSize: 10,
  109. showQuickJumper: true,
  110. pageSize: 10,
  111. onChange: function (page) {
  112. this.loadData(page);
  113. }.bind(this),
  114. showTotal: function (total) {
  115. return '共' + total + '条数据';
  116. }
  117. },
  118. columns: [
  119. {
  120. title: '省份',
  121. dataIndex: 'province',
  122. key: 'province',
  123. render: text => { return getProvince(text) }
  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. this.loadData();
  183. this.getCompanyList();
  184. },
  185. tableRowClick(record, index) {
  186. this.state.RowData = record;
  187. this.setState({
  188. fosterDisplay: 'none',
  189. fosterDescDisplay: 'block'
  190. });
  191. },
  192. search() {
  193. this.loadData();
  194. },
  195. reset() {
  196. this.state.province = undefined;
  197. this.state.unitName = undefined;
  198. this.loadData();
  199. },
  200. returnBtn() {
  201. this.setState({
  202. fosterDisplay: 'block',
  203. fosterDescDisplay: 'none'
  204. });
  205. this.loadData();
  206. },
  207. render() {
  208. return (
  209. <Spin spinning={this.state.loading}>
  210. <div className="foster-box">
  211. <div className="foster-content" style={{ display: this.state.fosterDisplay }}>
  212. <div className="content-title">
  213. <span>高企认定培育</span>
  214. </div>
  215. <div className="foster-query">
  216. <Cascader placeholder="选择省份"
  217. style={{ width: 100, marginTop: "-4px", marginRight: '20px' }}
  218. value={this.state.province}
  219. options={provinceSelect()}
  220. showSearch
  221. filterOption={companySearch}
  222. onChange={(e) => { this.setState({ province: e }) }} />
  223. <Select placeholder="选择公司"
  224. style={{ width: 200 }}
  225. value={this.state.unitName}
  226. showSearch
  227. filterOption={companySearch}
  228. onChange={(e) => { this.setState({ unitName: e }) }}>
  229. {this.state.companyOption}
  230. </Select>
  231. <Button type="primary" onClick={this.search}>搜索</Button>
  232. <Button onClick={this.reset}>重置</Button>
  233. </div>
  234. <div className="foster-table">
  235. <Table columns={this.state.columns}
  236. dataSource={this.state.dataSource}
  237. pagination={this.state.pagination}
  238. style={{
  239. cursor: 'pointer',
  240. }}
  241. onRowClick={this.tableRowClick} />
  242. </div>
  243. </div >
  244. <FosterDesc
  245. style={this.state.fosterDescDisplay}
  246. data={this.state.RowData}
  247. returnBtn={this.returnBtn} />
  248. </div>
  249. </Spin>
  250. );
  251. }
  252. });
  253. export default Patent;