techAuth.jsx 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  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 ,getAdviserType} 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?this.state.statusSearch=='1'?this.state.statusSearch:'2':'',
  27. auditStatus:this.state.authState,
  28. consultantType:this.state.statusSearch=='3'?'4':''
  29. },
  30. success: function (data) {
  31. let theArr = [];
  32. if (!data.data || !data.data.list) {
  33. if (data.error && data.error.length) {
  34. message.warning(data.error[0].message);
  35. };
  36. } else {
  37. for (let i = 0; i < data.data.list.length; i++) {
  38. let thisdata = data.data.list[i];
  39. theArr.push({
  40. key: i,
  41. uid:thisdata.uid,
  42. id: thisdata.id,
  43. serialNumber: thisdata.serialNumber,
  44. expert: thisdata.expert,
  45. industry:thisdata.industry,
  46. identifyName: thisdata.identifyName,
  47. mobile:thisdata.contactMobile,
  48. auditStatus:thisdata.auditStatus,
  49. consultantType:thisdata.consultantType,
  50. releaseDate:thisdata.releaseDate?(new Date(thisdata.releaseDate)).toLocaleString():'未通过审核认证'
  51. });
  52. };
  53. }
  54. this.state.pagination.current = data.data.pageNo;
  55. this.state.pagination.total = data.data.totalCount;
  56. if(data.data&&data.data.list&&!data.data.list.length){
  57. this.state.pagination.current=0
  58. this.state.pagination.total=0
  59. }
  60. this.setState({
  61. dataSource: theArr,
  62. pagination: this.state.pagination
  63. });
  64. }.bind(this),
  65. }).always(function () {
  66. this.setState({
  67. loading: false
  68. });
  69. }.bind(this));
  70. },
  71. getInitialState() {
  72. return {
  73. searchMore: true,
  74. validityPeriodDate: [],
  75. releaseDate: [],
  76. selectedRowKeys: [],
  77. selectedRows: [],
  78. loading: false,
  79. pagination: {
  80. defaultCurrent: 1,
  81. defaultPageSize: 10,
  82. showQuickJumper: true,
  83. pageSize: 10,
  84. onChange: function (page) {
  85. this.loadData(page);
  86. }.bind(this),
  87. showTotal: function (total) {
  88. return '共' + total + '条数据';
  89. }
  90. },
  91. columns: [
  92. {
  93. title: '姓名',
  94. dataIndex: 'identifyName',
  95. key: 'identifyName',
  96. render:text=>{
  97. return text&&text.length>16?text.substr(0,16)+'...':text
  98. }
  99. },
  100. {
  101. title: '手机号码',
  102. dataIndex: 'mobile',
  103. key: 'mobile',
  104. },
  105. {
  106. title: '行业',
  107. dataIndex: 'industry',
  108. key: 'industry',
  109. render: (text) => { return getIndustry(text); }
  110. },
  111. {
  112. title: '认证类型',
  113. dataIndex: 'expert',
  114. key: 'expert',
  115. render: (text,recard) => {
  116. if(text=='1'){
  117. return '专家认证';
  118. }else if(text=='2'){
  119. return getAdviserType(recard.consultantType)
  120. }else {
  121. return '未认证';
  122. }
  123. }
  124. },
  125. {
  126. title:'认证状态',
  127. dataIndex:'auditStatus',
  128. key: 'auditStatus',
  129. render:(text)=>{
  130. return getAuthState(text)
  131. }
  132. }
  133. ],
  134. dataSource: [],
  135. searchTime: [,]
  136. };
  137. },
  138. componentWillMount() {
  139. let theArr = [];
  140. industry.map(function (item) {
  141. theArr.push(
  142. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  143. )
  144. });
  145. let authList = [];
  146. authState.map(function (item) {
  147. authList.push(
  148. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  149. )
  150. });
  151. this.state.demandTypeOption = theArr;
  152. this.state.authStateList = authList
  153. this.loadData();
  154. },
  155. tableRowClick(record, index) {
  156. this.state.RowData = record;
  157. this.setState({
  158. showDesc: true,
  159. examineState:false
  160. });
  161. },
  162. closeDesc(e, s) {
  163. this.state.showDesc = e;
  164. if (s) {
  165. this.loadData(this.state.page);
  166. };
  167. },
  168. //下架功能
  169. delectRow(recard) {
  170. this.setState({
  171. loading:true
  172. })
  173. let deletedIds =[];
  174. let rowItem = this.state.selectedRowKeys[0];
  175. let data = this.state.dataSource ||[];
  176. if (data.length) {
  177. deletedIds.push(data[rowItem].id);
  178. }
  179. $.ajax({
  180. method: "POST",
  181. dataType: "json",
  182. crossDomain: false,
  183. url: globalConfig.context + "/api/admin/annul",
  184. data: {
  185. id: deletedIds[0]
  186. }
  187. }).done(function (data) {
  188. if (!data.error.length) {
  189. message.success('下架成功!');
  190. this.setState({
  191. loading: false,
  192. selectedRowKeys:[],
  193. });
  194. } else {
  195. message.warning(data.error[0].message);
  196. };
  197. this.loadData();
  198. }.bind(this));
  199. },
  200. search() {
  201. this.loadData();
  202. },
  203. reset() {
  204. this.state.nameSearch = '';
  205. this.state.demandTypeSearch = undefined;
  206. this.state.auditStatusSearch = undefined;
  207. this.state.statusSearch = undefined;
  208. this.state.authState=undefined;
  209. this.loadData();
  210. },
  211. searchSwitch() {
  212. this.setState({
  213. searchMore: !this.state.searchMore
  214. });
  215. },
  216. render() {
  217. const rowSelection = {
  218. selectedRowKeys: this.state.selectedRowKeys,
  219. onChange: (selectedRowKeys, selectedRows) => {
  220. this.setState({
  221. selectedRows: selectedRows.slice(-1),
  222. selectedRowKeys: selectedRowKeys.slice(-1)
  223. });
  224. }
  225. };
  226. const hasSelect = this.state.selectedRowKeys.length;
  227. const hasSelected = this.state.selectedRowKeys.length > 0;
  228. return (
  229. <div className="user-content" >
  230. <div className="content-title">
  231. <span>专家顾问库</span>
  232. </div>
  233. <div className="user-search">
  234. <Input placeholder="姓名"
  235. value={this.state.nameSearch}
  236. onChange={(e) => { this.setState({ nameSearch: e.target.value }); }} />
  237. <Select placeholder="行业"
  238. style={{ width: 120 }}
  239. value={this.state.demandTypeSearch}
  240. onChange={(e) => { this.setState({ demandTypeSearch: e }) }}>
  241. {this.state.demandTypeOption}
  242. </Select>
  243. <Select placeholder="认证类型" style={{ width: 160 }}
  244. value={this.state.statusSearch}
  245. onChange={(e) => { this.setState({ statusSearch: e }) }}>
  246. <Select.Option value="1" >专家认证</Select.Option>
  247. <Select.Option value="2" >顾问认证</Select.Option>
  248. <Select.Option value="3" >法律顾问认证</Select.Option>
  249. </Select>
  250. <Select placeholder="认证状态" style={{ width: 160 }}
  251. value={this.state.authState}
  252. onChange={(e) => { this.setState({ authState: e }) }}>
  253. {this.state.authStateList}
  254. </Select>
  255. <Button type="primary" onClick={this.search}>搜索</Button>
  256. <Button onClick={this.reset}>重置</Button>
  257. <Button type="danger" disabled={!hasSelect} onClick={(e)=>{this.delectRow()}}>下架</Button>
  258. </div>
  259. <div className="patent-table">
  260. <Spin spinning={this.state.loading}>
  261. <Table columns={this.state.columns}
  262. dataSource={this.state.dataSource}
  263. rowSelection={rowSelection}
  264. pagination={this.state.pagination}
  265. onRowClick={this.tableRowClick} />
  266. </Spin>
  267. </div>
  268. <TechDemandDesc
  269. data={this.state.RowData}
  270. examineState={this.state.examineState}
  271. demandTypeOption={this.state.demandTypeOption}
  272. showDesc={this.state.showDesc}
  273. closeDesc={this.closeDesc} />
  274. </div>
  275. );
  276. }
  277. });
  278. export default DemandList;