techAuth.jsx 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  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,authState } from '@/dataDic.js';
  8. import { getAuthState,getIndustry } from '@/tools.js';
  9. const DemandList = React.createClass({
  10. loadData(pageNo) {
  11. this.state.data = [];
  12. this.setState({
  13. page:pageNo,
  14. loading: true
  15. });
  16. $.ajax({
  17. method: "get",
  18. dataType: "json",
  19. crossDomain: false,
  20. url: globalConfig.context + "/api/user/getExpertAuditList",
  21. data: {
  22. pageNo: pageNo || 1,
  23. pageSize: this.state.pagination.pageSize,
  24. identifyName: this.state.nameSearch,
  25. industry:this.state.demandTypeSearch,
  26. expert: this.state.statusSearch,
  27. auditStatus:this.state.authState,
  28. },
  29. success: function (data) {
  30. let theArr = [];
  31. if (!data.data || !data.data.list) {
  32. if (data.error && data.error.length) {
  33. message.warning(data.error[0].message);
  34. };
  35. } else {
  36. for (let i = 0; i < data.data.list.length; i++) {
  37. let thisdata = data.data.list[i];
  38. theArr.push({
  39. key: i,
  40. uid:thisdata.uid,
  41. id: thisdata.id,
  42. serialNumber: thisdata.serialNumber,
  43. expert: thisdata.expert,
  44. industry:thisdata.industry,
  45. identifyName: thisdata.identifyName,
  46. mobile:thisdata.contactMobile,
  47. auditStatus:thisdata.auditStatus,
  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: 'expert',
  116. key: 'expert',
  117. render: text => { return text=='1'?'专家认证':text=='2'?'顾问认证':'未认证' }
  118. },
  119. // {
  120. // title:'认证成功时间',
  121. // dataIndex:'releaseDate',
  122. // key:'releaseDate',
  123. // },
  124. {
  125. title:'认证状态',
  126. dataIndex:'auditStatus',
  127. key: 'auditStatus',
  128. render:(text)=>{
  129. return getAuthState(text)
  130. }
  131. }
  132. ],
  133. dataSource: [],
  134. searchTime: [,]
  135. };
  136. },
  137. componentWillMount() {
  138. let theArr = [];
  139. industry.map(function (item) {
  140. theArr.push(
  141. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  142. )
  143. });
  144. let authList = [];
  145. authState.map(function (item) {
  146. authList.push(
  147. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  148. )
  149. });
  150. this.state.demandTypeOption = theArr;
  151. this.state.authStateList = authList
  152. this.loadData();
  153. },
  154. tableRowClick(record, index) {
  155. this.state.RowData = record;
  156. this.setState({
  157. showDesc: true,
  158. examineState:false
  159. });
  160. },
  161. closeDesc(e, s) {
  162. this.state.showDesc = e;
  163. if (s) {
  164. this.loadData(this.state.page);
  165. };
  166. },
  167. search() {
  168. this.loadData();
  169. },
  170. reset() {
  171. this.state.nameSearch = '';
  172. this.state.demandTypeSearch = undefined;
  173. this.state.auditStatusSearch = undefined;
  174. this.state.statusSearch = undefined;
  175. this.state.authState=undefined;
  176. this.loadData();
  177. },
  178. searchSwitch() {
  179. this.setState({
  180. searchMore: !this.state.searchMore
  181. });
  182. },
  183. render() {
  184. const rowSelection = {
  185. selectedRowKeys: this.state.selectedRowKeys,
  186. onChange: (selectedRowKeys, selectedRows) => {
  187. this.setState({
  188. selectedRows: selectedRows.slice(-1),
  189. selectedRowKeys: selectedRowKeys.slice(-1)
  190. });
  191. }
  192. };
  193. const hasSelected = this.state.selectedRowKeys.length > 0;
  194. return (
  195. <div className="user-content" >
  196. <div className="content-title">
  197. <span>专家顾问库</span>
  198. </div>
  199. <div className="user-search">
  200. <Input placeholder="姓名"
  201. value={this.state.nameSearch}
  202. onChange={(e) => { this.setState({ nameSearch: e.target.value }); }} />
  203. <Select placeholder="行业"
  204. style={{ width: 120 }}
  205. value={this.state.demandTypeSearch}
  206. onChange={(e) => { this.setState({ demandTypeSearch: e }) }}>
  207. {this.state.demandTypeOption}
  208. </Select>
  209. <Select placeholder="认证类型" style={{ width: 160 }}
  210. value={this.state.statusSearch}
  211. onChange={(e) => { this.setState({ statusSearch: e }) }}>
  212. <Select.Option value="0" >专家认证</Select.Option>
  213. <Select.Option value="1" >顾问认证</Select.Option>
  214. </Select>
  215. <Select placeholder="认证状态" style={{ width: 160 }}
  216. value={this.state.authState}
  217. onChange={(e) => { this.setState({ authState: e }) }}>
  218. {this.state.authStateList}
  219. </Select>
  220. <Button type="primary" onClick={this.search}>搜索</Button>
  221. <Button onClick={this.reset}>重置</Button>
  222. </div>
  223. <div className="patent-table">
  224. <Spin spinning={this.state.loading}>
  225. <Table columns={this.state.columns}
  226. dataSource={this.state.dataSource}
  227. rowSelection={rowSelection}
  228. pagination={this.state.pagination}
  229. onRowClick={this.tableRowClick} />
  230. </Spin>
  231. </div>
  232. <TechDemandDesc
  233. data={this.state.RowData}
  234. examineState={this.state.examineState}
  235. demandTypeOption={this.state.demandTypeOption}
  236. showDesc={this.state.showDesc}
  237. closeDesc={this.closeDesc} />
  238. </div>
  239. );
  240. }
  241. });
  242. export default DemandList;