highTechFoster.jsx 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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, companySearch } 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. data: [],
  125. loading: false,
  126. pagination: {
  127. defaultCurrent: 1,
  128. defaultPageSize: 10,
  129. showQuickJumper: true,
  130. pageSize: 10,
  131. onChange: function (page) {
  132. this.loadData(page);
  133. }.bind(this),
  134. showTotal: function (total) {
  135. return '共' + total + '条数据';
  136. }
  137. },
  138. columns: [
  139. {
  140. title: '省份',
  141. dataIndex: 'locationProvince',
  142. key: 'locationProvince',
  143. }, {
  144. title: '公司名称',
  145. dataIndex: 'unitName',
  146. key: 'unitName',
  147. }, {
  148. title: '联系方式',
  149. dataIndex: 'contacts',
  150. key: 'contacts',
  151. }, {
  152. title: '状态',
  153. dataIndex: 'state',
  154. key: 'state',
  155. render: text => { return getPatentState(text) }
  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. ],
  174. dataSource: []
  175. };
  176. },
  177. componentWillMount() {
  178. let _me = this;
  179. provinceArr.map(function (item) {
  180. _me.state.provinceOption.push(
  181. <Select.Option value={item} key={item}>{item}</Select.Option>
  182. )
  183. });
  184. this.loadData();
  185. this.getAuthorList();
  186. this.getCompanyList();
  187. },
  188. tableRowClick(record, index) {
  189. this.state.RowData = record;
  190. this.setState({
  191. fosterDisplay: 'none',
  192. fosterDescDisplay: 'block'
  193. });
  194. },
  195. search() {
  196. this.loadData();
  197. },
  198. reset() {
  199. this.state.province = undefined;
  200. this.state.unitName = undefined;
  201. this.loadData();
  202. },
  203. returnBtn() {
  204. this.setState({
  205. fosterDisplay: 'block',
  206. fosterDescDisplay: 'none'
  207. });
  208. this.loadData();
  209. },
  210. render() {
  211. return (
  212. <div className="foster-box">
  213. <div className="foster-content" style={{ display: this.state.fosterDisplay }}>
  214. <div className="content-title">
  215. <span>高企认定培育</span>
  216. </div>
  217. <div className="foster-query">
  218. <Select placeholder="选择省份"
  219. style={{ width: 200 }}
  220. value={this.state.province}
  221. showSearch
  222. filterOption={companySearch}
  223. onChange={(e) => { this.setState({ province: e }) }}>
  224. {this.state.provinceOption}
  225. </Select>
  226. <Select placeholder="选择公司"
  227. style={{ width: 200 }}
  228. value={this.state.unitName}
  229. showSearch
  230. filterOption={companySearch}
  231. onChange={(e) => { this.setState({ unitName: e }) }}>
  232. {this.state.companyOption}
  233. </Select>
  234. <Button type="primary" onClick={this.search}>搜索</Button>
  235. <Button onClick={this.reset}>重置</Button>
  236. </div>
  237. <div className="foster-table">
  238. <Spin spinning={this.state.loading}>
  239. <Table columns={this.state.columns}
  240. dataSource={this.state.dataSource}
  241. pagination={this.state.pagination}
  242. onRowClick={this.tableRowClick} />
  243. </Spin>
  244. </div>
  245. </div >
  246. <FosterDesc style={this.state.fosterDescDisplay}
  247. data={this.state.RowData}
  248. returnBtn={this.returnBtn} />
  249. </div>
  250. );
  251. }
  252. });
  253. export default Patent;