authExamine.jsx 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. import React from 'react';
  2. import { Button, Input, Select, Spin, Table, Switch, message, DatePicker } from 'antd';
  3. import $ from 'jquery/src/ajax';
  4. import moment from 'moment';
  5. import './techDemand.less';
  6. import TechDemandDesc from './authDesc.jsx';
  7. import {industry} from '@/dataDic.js';
  8. import { getIndustry } from '@/tools.js';
  9. const DemandList = React.createClass({
  10. loadData(pageNo) {
  11. this.state.data = [];
  12. this.setState({
  13. loading: true
  14. });
  15. $.ajax({
  16. method: "get",
  17. dataType: "json",
  18. crossDomain: false,
  19. url: globalConfig.context + "/api/admin/demand/list",
  20. data: {
  21. pageNo: pageNo || 1,
  22. pageSize: this.state.pagination.pageSize,
  23. identifyName: this.state.nameSearch,
  24. industry:this.state.demandTypeSearch,
  25. authType: this.state.statusSearch
  26. },
  27. success: function (data) {
  28. let theArr = [];
  29. if (!data.data || !data.data.list) {
  30. if (data.error && data.error.length) {
  31. message.warning(data.error[0].message);
  32. };
  33. } else {
  34. for (let i = 0; i < data.data.list.length; i++) {
  35. let thisdata = data.data.list[i];
  36. theArr.push({
  37. key: i,
  38. id: thisdata.id,
  39. serialNumber: thisdata.serialNumber,
  40. status: thisdata.status,
  41. name: thisdata.name,
  42. demandType: thisdata.demandType,
  43. auditStatus: thisdata.auditStatus,
  44. isHot: thisdata.isHot,
  45. isUrgent: thisdata.isUrgent,
  46. employerName:thisdata.employerName,
  47. createTime:thisdata.createTime?(new Date(thisdata.createTime)).toLocaleString():'',
  48. releaseDate:thisdata.releaseDate?(new Date(thisdata.releaseDate)).toLocaleString():''
  49. });
  50. };
  51. }
  52. this.state.pagination.current = data.data.pageNo;
  53. this.state.pagination.total = data.data.totalCount;
  54. if(data.data&&data.data.list&&!data.data.list.length){
  55. this.state.pagination.current=0
  56. this.state.pagination.total=0
  57. }
  58. this.setState({
  59. dataSource: theArr,
  60. pagination: this.state.pagination
  61. });
  62. }.bind(this),
  63. }).always(function () {
  64. this.setState({
  65. loading: false
  66. });
  67. }.bind(this));
  68. },
  69. getInitialState() {
  70. return {
  71. searchMore: true,
  72. validityPeriodDate: [],
  73. releaseDate: [],
  74. selectedRowKeys: [],
  75. selectedRows: [],
  76. loading: false,
  77. pagination: {
  78. defaultCurrent: 1,
  79. defaultPageSize: 10,
  80. showQuickJumper: true,
  81. pageSize: 10,
  82. onChange: function (page) {
  83. this.loadData(page);
  84. }.bind(this),
  85. showTotal: function (total) {
  86. return '共' + total + '条数据';
  87. }
  88. },
  89. columns: [
  90. {
  91. title: '编号',
  92. dataIndex: 'serialNumber',
  93. key: 'serialNumber',
  94. }, {
  95. title: '姓名',
  96. dataIndex: 'identifyName',
  97. key: 'identifyName',
  98. render:text=>{
  99. return text&&text.length>16?text.substr(0,16)+'...':text
  100. }
  101. },
  102. {
  103. title: '手机号码',
  104. dataIndex: 'mobile',
  105. key: 'mobile',
  106. },
  107. {
  108. title: '行业',
  109. dataIndex: 'industry',
  110. key: 'industry',
  111. render: (text) => { return getIndustry(text); }
  112. },
  113. {
  114. title: '认证类型',
  115. dataIndex: 'authType',
  116. key: 'authType',
  117. render: text => { return text=='0'?'专家认证':text=='1'?'顾问认证':'未认证' }
  118. },
  119. {
  120. title: '认证审核',
  121. dataIndex: 'caozuo',
  122. key: 'caozuo',
  123. render:(text,recard) => {
  124. return <div className="btnRight">
  125. <Button type="primary" onClick={(e)=>{e.stopPropagation();this.tableRowClick(recard)}}>审核</Button>
  126. </div>
  127. }
  128. }
  129. ],
  130. dataSource: [],
  131. searchTime: [,]
  132. };
  133. },
  134. componentWillMount() {
  135. let theArr = [];
  136. industry.map(function (item) {
  137. theArr.push(
  138. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  139. )
  140. });
  141. this.state.demandTypeOption = theArr;
  142. this.loadData();
  143. },
  144. tableRowClick(record, index) {
  145. this.state.RowData = record;
  146. this.setState({
  147. showDesc: true,
  148. examineState:true
  149. });
  150. },
  151. closeDesc(e, s) {
  152. this.state.showDesc = e;
  153. if (s) {
  154. if(this.state.pagination.total%10==1){
  155. this.loadData((this.state.page)-1);
  156. }else{
  157. this.loadData(this.state.page);
  158. }
  159. };
  160. },
  161. search() {
  162. this.loadData();
  163. },
  164. reset() {
  165. this.state.nameSearch = '';
  166. this.state.demandTypeSearch = undefined;
  167. this.state.auditStatus = undefined;
  168. this.state.statusSearch = undefined;
  169. this.state.employerNameSearch='';
  170. this.state.releaseDate = [];
  171. this.loadData();
  172. },
  173. searchSwitch() {
  174. this.setState({
  175. searchMore: !this.state.searchMore
  176. });
  177. },
  178. render() {
  179. const rowSelection = {
  180. selectedRowKeys: this.state.selectedRowKeys,
  181. onChange: (selectedRowKeys, selectedRows) => {
  182. this.setState({
  183. selectedRows: selectedRows.slice(-1),
  184. selectedRowKeys: selectedRowKeys.slice(-1)
  185. });
  186. }
  187. };
  188. const hasSelected = this.state.selectedRowKeys.length > 0;
  189. const { RangePicker } = DatePicker;
  190. return (
  191. <div className="user-content" >
  192. <div className="content-title">
  193. <span>专家顾问认证审核</span>
  194. </div>
  195. <div className="user-search">
  196. <Input placeholder="姓名"
  197. value={this.state.nameSearch}
  198. onChange={(e) => { this.setState({ nameSearch: e.target.value }); }} />
  199. <Select placeholder="行业"
  200. style={{ width: 120 }}
  201. value={this.state.demandTypeSearch}
  202. onChange={(e) => { this.setState({ demandTypeSearch: e }) }}>
  203. {this.state.demandTypeOption}
  204. </Select>
  205. <Select placeholder="认证类型" style={{ width: 160 }}
  206. value={this.state.statusSearch}
  207. onChange={(e) => { this.setState({ statusSearch: e }) }}>
  208. <Select.Option value="0" >专家认证</Select.Option>
  209. <Select.Option value="1" >顾问认证</Select.Option>
  210. </Select>
  211. <Button type="primary" onClick={this.search}>搜索</Button>
  212. <Button onClick={this.reset}>重置</Button>
  213. </div>
  214. <div className="patent-table">
  215. <Spin spinning={this.state.loading}>
  216. <Table columns={this.state.columns}
  217. dataSource={this.state.dataSource}
  218. rowSelection={rowSelection}
  219. pagination={this.state.pagination}
  220. />
  221. </Spin>
  222. </div>
  223. <TechDemandDesc
  224. data={this.state.RowData}
  225. demandTypeOption={this.state.demandTypeOption}
  226. examineState={this.state.examineState}
  227. showDesc={this.state.showDesc}
  228. closeDesc={this.closeDesc} />
  229. </div >
  230. );
  231. }
  232. });
  233. export default DemandList;