highTechFoster.jsx 9.7 KB

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