techAuth.jsx 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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/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: 'identifyName',
  93. key: 'identifyName',
  94. render:text=>{
  95. return text&&text.length>16?text.substr(0,16)+'...':text
  96. }
  97. },
  98. {
  99. title: '手机号码',
  100. dataIndex: 'mobile',
  101. key: 'mobile',
  102. },
  103. {
  104. title: '行业',
  105. dataIndex: 'industry',
  106. key: 'industry',
  107. render: (text) => { return getIndustry(text); }
  108. },
  109. {
  110. title: '认证类型',
  111. dataIndex: 'expert',
  112. key: 'expert',
  113. render: text => { return text=='1'?'专家认证':text=='2'?'顾问认证':'未认证' }
  114. },
  115. {
  116. title:'认证状态',
  117. dataIndex:'auditStatus',
  118. key: 'auditStatus',
  119. render:(text)=>{
  120. return getAuthState(text)
  121. }
  122. }
  123. ],
  124. dataSource: [],
  125. searchTime: [,]
  126. };
  127. },
  128. componentWillMount() {
  129. let theArr = [];
  130. industry.map(function (item) {
  131. theArr.push(
  132. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  133. )
  134. });
  135. let authList = [];
  136. authState.map(function (item) {
  137. authList.push(
  138. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  139. )
  140. });
  141. this.state.demandTypeOption = theArr;
  142. this.state.authStateList = authList
  143. this.loadData();
  144. },
  145. tableRowClick(record, index) {
  146. this.state.RowData = record;
  147. this.setState({
  148. showDesc: true,
  149. examineState:false
  150. });
  151. },
  152. closeDesc(e, s) {
  153. this.state.showDesc = e;
  154. if (s) {
  155. this.loadData(this.state.page);
  156. };
  157. },
  158. //下架功能
  159. delectRow(recard) {
  160. this.setState({
  161. loading:true
  162. })
  163. let deletedIds =[];
  164. let rowItem = this.state.selectedRowKeys[0];
  165. let data = this.state.dataSource ||[];
  166. if (data.length) {
  167. deletedIds.push(data[rowItem].id);
  168. }
  169. $.ajax({
  170. method: "POST",
  171. dataType: "json",
  172. crossDomain: false,
  173. url: globalConfig.context + "/api/admin/annul",
  174. data: {
  175. id: deletedIds[0]
  176. }
  177. }).done(function (data) {
  178. if (!data.error.length) {
  179. message.success('下架成功!');
  180. this.setState({
  181. loading: false,
  182. selectedRowKeys:[],
  183. });
  184. } else {
  185. message.warning(data.error[0].message);
  186. };
  187. this.loadData();
  188. }.bind(this));
  189. },
  190. search() {
  191. this.loadData();
  192. },
  193. reset() {
  194. this.state.nameSearch = '';
  195. this.state.demandTypeSearch = undefined;
  196. this.state.auditStatusSearch = undefined;
  197. this.state.statusSearch = undefined;
  198. this.state.authState=undefined;
  199. this.loadData();
  200. },
  201. searchSwitch() {
  202. this.setState({
  203. searchMore: !this.state.searchMore
  204. });
  205. },
  206. render() {
  207. const rowSelection = {
  208. selectedRowKeys: this.state.selectedRowKeys,
  209. onChange: (selectedRowKeys, selectedRows) => {
  210. this.setState({
  211. selectedRows: selectedRows.slice(-1),
  212. selectedRowKeys: selectedRowKeys.slice(-1)
  213. });
  214. }
  215. };
  216. const hasSelect = this.state.selectedRowKeys.length;
  217. const hasSelected = this.state.selectedRowKeys.length > 0;
  218. return (
  219. <div className="user-content" >
  220. <div className="content-title">
  221. <span>专家顾问库</span>
  222. </div>
  223. <div className="user-search">
  224. <Input placeholder="姓名"
  225. value={this.state.nameSearch}
  226. onChange={(e) => { this.setState({ nameSearch: e.target.value }); }} />
  227. <Select placeholder="行业"
  228. style={{ width: 120 }}
  229. value={this.state.demandTypeSearch}
  230. onChange={(e) => { this.setState({ demandTypeSearch: e }) }}>
  231. {this.state.demandTypeOption}
  232. </Select>
  233. <Select placeholder="认证类型" style={{ width: 160 }}
  234. value={this.state.statusSearch}
  235. onChange={(e) => { this.setState({ statusSearch: e }) }}>
  236. <Select.Option value="1" >专家认证</Select.Option>
  237. <Select.Option value="2" >顾问认证</Select.Option>
  238. </Select>
  239. <Select placeholder="认证状态" style={{ width: 160 }}
  240. value={this.state.authState}
  241. onChange={(e) => { this.setState({ authState: e }) }}>
  242. {this.state.authStateList}
  243. </Select>
  244. <Button type="primary" onClick={this.search}>搜索</Button>
  245. <Button onClick={this.reset}>重置</Button>
  246. <Button type="danger" disabled={!hasSelect} onClick={(e)=>{this.delectRow()}}>下架</Button>
  247. </div>
  248. <div className="patent-table">
  249. <Spin spinning={this.state.loading}>
  250. <Table columns={this.state.columns}
  251. dataSource={this.state.dataSource}
  252. rowSelection={rowSelection}
  253. pagination={this.state.pagination}
  254. onRowClick={this.tableRowClick} />
  255. </Spin>
  256. </div>
  257. <TechDemandDesc
  258. data={this.state.RowData}
  259. examineState={this.state.examineState}
  260. demandTypeOption={this.state.demandTypeOption}
  261. showDesc={this.state.showDesc}
  262. closeDesc={this.closeDesc} />
  263. </div>
  264. );
  265. }
  266. });
  267. export default DemandList;