techAuth.jsx 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  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/admin/demand/list",
  21. data: {
  22. pageNo: pageNo || 1,
  23. pageSize: this.state.pagination.pageSize,
  24. username: this.state.nameSearch,
  25. industry:this.state.demandTypeSearch,
  26. expert: this.state.statusSearch,
  27. expertAudit: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. identifyName: thisdata.username,
  45. mobile:thisdata.contactMobile,
  46. expertAudit:thisdata.expertAudit,
  47. releaseDate:thisdata.releaseDate?(new Date(thisdata.releaseDate)).toLocaleString():'未通过审核认证'
  48. });
  49. };
  50. }
  51. this.state.pagination.current = data.data.pageNo;
  52. this.state.pagination.total = data.data.totalCount;
  53. if(data.data&&data.data.list&&!data.data.list.length){
  54. this.state.pagination.current=0
  55. this.state.pagination.total=0
  56. }
  57. this.setState({
  58. dataSource: theArr,
  59. pagination: this.state.pagination
  60. });
  61. }.bind(this),
  62. }).always(function () {
  63. this.setState({
  64. loading: false
  65. });
  66. }.bind(this));
  67. },
  68. getInitialState() {
  69. return {
  70. searchMore: true,
  71. validityPeriodDate: [],
  72. releaseDate: [],
  73. selectedRowKeys: [],
  74. selectedRows: [],
  75. loading: false,
  76. pagination: {
  77. defaultCurrent: 1,
  78. defaultPageSize: 10,
  79. showQuickJumper: true,
  80. pageSize: 10,
  81. onChange: function (page) {
  82. this.loadData(page);
  83. }.bind(this),
  84. showTotal: function (total) {
  85. return '共' + total + '条数据';
  86. }
  87. },
  88. columns: [
  89. {
  90. title: '编号',
  91. dataIndex: 'serialNumber',
  92. key: 'serialNumber',
  93. }, {
  94. title: '姓名',
  95. dataIndex: 'identifyName',
  96. key: 'identifyName',
  97. render:text=>{
  98. return text&&text.length>16?text.substr(0,16)+'...':text
  99. }
  100. },
  101. {
  102. title: '手机号码',
  103. dataIndex: 'mobile',
  104. key: 'mobile',
  105. },
  106. {
  107. title: '行业',
  108. dataIndex: 'industry',
  109. key: 'industry',
  110. render: (text) => { return getIndustry(text); }
  111. },
  112. {
  113. title: '认证类型',
  114. dataIndex: 'expert',
  115. key: 'expert',
  116. render: text => { return text=='1'?'专家认证':text=='2'?'顾问认证':'未认证' }
  117. },
  118. // {
  119. // title:'认证成功时间',
  120. // dataIndex:'releaseDate',
  121. // key:'releaseDate',
  122. // },
  123. {
  124. title:'认证状态',
  125. dataIndex:'expertAudit',
  126. key: 'expertAudit',
  127. render:(text)=>{
  128. return getAuthState(text)
  129. }
  130. }
  131. ],
  132. dataSource: [],
  133. searchTime: [,]
  134. };
  135. },
  136. componentWillMount() {
  137. let theArr = [];
  138. industry.map(function (item) {
  139. theArr.push(
  140. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  141. )
  142. });
  143. let authList = [];
  144. authState.map(function (item) {
  145. authList.push(
  146. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  147. )
  148. });
  149. this.state.demandTypeOption = theArr;
  150. this.state.authStateList = authList
  151. this.loadData();
  152. },
  153. tableRowClick(record, index) {
  154. this.state.RowData = record;
  155. this.setState({
  156. showDesc: true,
  157. examineState:false
  158. });
  159. },
  160. closeDesc(e, s) {
  161. this.state.showDesc = e;
  162. if (s) {
  163. this.loadData(this.state.page);
  164. };
  165. },
  166. search() {
  167. this.loadData();
  168. },
  169. reset() {
  170. this.state.nameSearch = '';
  171. this.state.demandTypeSearch = undefined;
  172. this.state.auditStatusSearch = undefined;
  173. this.state.statusSearch = undefined;
  174. this.state.authState=undefined;
  175. this.loadData();
  176. },
  177. searchSwitch() {
  178. this.setState({
  179. searchMore: !this.state.searchMore
  180. });
  181. },
  182. render() {
  183. const rowSelection = {
  184. selectedRowKeys: this.state.selectedRowKeys,
  185. onChange: (selectedRowKeys, selectedRows) => {
  186. this.setState({
  187. selectedRows: selectedRows.slice(-1),
  188. selectedRowKeys: selectedRowKeys.slice(-1)
  189. });
  190. }
  191. };
  192. const hasSelected = this.state.selectedRowKeys.length > 0;
  193. return (
  194. <div className="user-content" >
  195. <div className="content-title">
  196. <span>专家顾问库</span>
  197. </div>
  198. <div className="user-search">
  199. <Input placeholder="姓名"
  200. value={this.state.nameSearch}
  201. onChange={(e) => { this.setState({ nameSearch: e.target.value }); }} />
  202. <Select placeholder="行业"
  203. style={{ width: 120 }}
  204. value={this.state.demandTypeSearch}
  205. onChange={(e) => { this.setState({ demandTypeSearch: e }) }}>
  206. {this.state.demandTypeOption}
  207. </Select>
  208. <Select placeholder="认证类型" style={{ width: 160 }}
  209. value={this.state.statusSearch}
  210. onChange={(e) => { this.setState({ statusSearch: e }) }}>
  211. <Select.Option value="0" >专家认证</Select.Option>
  212. <Select.Option value="1" >顾问认证</Select.Option>
  213. </Select>
  214. <Select placeholder="认证状态" style={{ width: 160 }}
  215. value={this.state.authState}
  216. onChange={(e) => { this.setState({ authState: e }) }}>
  217. {this.state.authStateList}
  218. </Select>
  219. <Button type="primary" onClick={this.search}>搜索</Button>
  220. <Button onClick={this.reset}>重置</Button>
  221. </div>
  222. <div className="patent-table">
  223. <Spin spinning={this.state.loading}>
  224. <Table columns={this.state.columns}
  225. dataSource={this.state.dataSource}
  226. rowSelection={rowSelection}
  227. pagination={this.state.pagination}
  228. onRowClick={this.tableRowClick} />
  229. </Spin>
  230. </div>
  231. <TechDemandDesc
  232. data={this.state.RowData}
  233. examineState={this.state.examineState}
  234. demandTypeOption={this.state.demandTypeOption}
  235. showDesc={this.state.showDesc}
  236. closeDesc={this.closeDesc} />
  237. </div>
  238. );
  239. }
  240. });
  241. export default DemandList;