123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281 |
- import React from 'react';
- import {Button, Input, Select, Spin, Table, Switch, message, DatePicker } from 'antd';
- import $ from 'jquery/src/ajax';
- import moment from 'moment';
- import './techDemand.less';
- import TechDemandDesc from './authDesc.jsx';
- import { industry,authState } from '@/dataDic.js';
- import { getAuthState,getIndustry ,getAdviserType} from '@/tools.js';
- const DemandList = React.createClass({
- loadData(pageNo) {
- this.state.data = [];
- this.setState({
- page:pageNo,
- loading: true
- });
-
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/admin/getExpertAuditList",
- data: {
- pageNo: pageNo || 1,
- pageSize: this.state.pagination.pageSize,
- identifyName: this.state.nameSearch,
- industry:this.state.demandTypeSearch,
- expert: this.state.statusSearch?this.state.statusSearch=='1'?this.state.statusSearch:'2':'',
- auditStatus:this.state.authState,
- consultantType:this.state.statusSearch=='3'?'4':''
- },
- success: function (data) {
- let theArr = [];
- if (!data.data || !data.data.list) {
- if (data.error && data.error.length) {
- message.warning(data.error[0].message);
- };
- } else {
- for (let i = 0; i < data.data.list.length; i++) {
- let thisdata = data.data.list[i];
- theArr.push({
- key: i,
- uid:thisdata.uid,
- id: thisdata.id,
- serialNumber: thisdata.serialNumber,
- expert: thisdata.expert,
- industry:thisdata.industry,
- identifyName: thisdata.identifyName,
- mobile:thisdata.contactMobile,
- auditStatus:thisdata.auditStatus,
- consultantType:thisdata.consultantType,
- releaseDate:thisdata.releaseDate?(new Date(thisdata.releaseDate)).toLocaleString():'未通过审核认证'
- });
- };
- }
- this.state.pagination.current = data.data.pageNo;
- this.state.pagination.total = data.data.totalCount;
- if(data.data&&data.data.list&&!data.data.list.length){
- this.state.pagination.current=0
- this.state.pagination.total=0
- }
- this.setState({
- dataSource: theArr,
- pagination: this.state.pagination
- });
- }.bind(this),
- }).always(function () {
- this.setState({
- loading: false
- });
- }.bind(this));
- },
- getInitialState() {
- return {
- searchMore: true,
- validityPeriodDate: [],
- releaseDate: [],
- selectedRowKeys: [],
- selectedRows: [],
- loading: false,
- pagination: {
- defaultCurrent: 1,
- defaultPageSize: 10,
- showQuickJumper: true,
- pageSize: 10,
- onChange: function (page) {
- this.loadData(page);
- }.bind(this),
- showTotal: function (total) {
- return '共' + total + '条数据';
- }
- },
- columns: [
- {
- title: '姓名',
- dataIndex: 'identifyName',
- key: 'identifyName',
- render:text=>{
- return text&&text.length>16?text.substr(0,16)+'...':text
- }
- },
- {
- title: '手机号码',
- dataIndex: 'mobile',
- key: 'mobile',
- },
- {
- title: '行业',
- dataIndex: 'industry',
- key: 'industry',
- render: (text) => { return getIndustry(text); }
- },
- {
- title: '认证类型',
- dataIndex: 'expert',
- key: 'expert',
- render: (text,recard) => {
- if(text=='1'){
- return '专家认证';
- }else if(text=='2'){
- return getAdviserType(recard.consultantType)
- }else {
- return '未认证';
- }
- }
- },
- {
- title:'认证状态',
- dataIndex:'auditStatus',
- key: 'auditStatus',
- render:(text)=>{
- return getAuthState(text)
- }
- }
- ],
- dataSource: [],
- searchTime: [,]
- };
- },
- componentWillMount() {
- let theArr = [];
- industry.map(function (item) {
- theArr.push(
- <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
- )
- });
- let authList = [];
- authState.map(function (item) {
- authList.push(
- <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
- )
- });
- this.state.demandTypeOption = theArr;
- this.state.authStateList = authList
- this.loadData();
- },
- tableRowClick(record, index) {
- this.state.RowData = record;
- this.setState({
- showDesc: true,
- examineState:false
- });
- },
- closeDesc(e, s) {
- this.state.showDesc = e;
- if (s) {
- this.loadData(this.state.page);
- };
- },
- //下架功能
- delectRow(recard) {
- this.setState({
- loading:true
- })
- let deletedIds =[];
- let rowItem = this.state.selectedRowKeys[0];
- let data = this.state.dataSource ||[];
- if (data.length) {
- deletedIds.push(data[rowItem].id);
- }
- $.ajax({
- method: "POST",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/admin/annul",
- data: {
- id: deletedIds[0]
- }
- }).done(function (data) {
- if (!data.error.length) {
- message.success('下架成功!');
- this.setState({
- loading: false,
- selectedRowKeys:[],
- });
- } else {
- message.warning(data.error[0].message);
- };
- this.loadData();
- }.bind(this));
- },
- search() {
- this.loadData();
- },
- reset() {
- this.state.nameSearch = '';
- this.state.demandTypeSearch = undefined;
- this.state.auditStatusSearch = undefined;
- this.state.statusSearch = undefined;
- this.state.authState=undefined;
- this.loadData();
- },
- searchSwitch() {
- this.setState({
- searchMore: !this.state.searchMore
- });
- },
- render() {
- const rowSelection = {
- selectedRowKeys: this.state.selectedRowKeys,
- onChange: (selectedRowKeys, selectedRows) => {
- this.setState({
- selectedRows: selectedRows.slice(-1),
- selectedRowKeys: selectedRowKeys.slice(-1)
- });
- }
- };
- const hasSelect = this.state.selectedRowKeys.length;
- const hasSelected = this.state.selectedRowKeys.length > 0;
- return (
- <div className="user-content" >
- <div className="content-title">
- <span>专家顾问库</span>
- </div>
- <div className="user-search">
- <Input placeholder="姓名"
- value={this.state.nameSearch}
- onChange={(e) => { this.setState({ nameSearch: e.target.value }); }} />
- <Select placeholder="行业"
- style={{ width: 120 }}
- value={this.state.demandTypeSearch}
- onChange={(e) => { this.setState({ demandTypeSearch: e }) }}>
- {this.state.demandTypeOption}
- </Select>
- <Select placeholder="认证类型" style={{ width: 160 }}
- value={this.state.statusSearch}
- onChange={(e) => { this.setState({ statusSearch: e }) }}>
- <Select.Option value="1" >专家认证</Select.Option>
- <Select.Option value="2" >顾问认证</Select.Option>
- <Select.Option value="3" >法律顾问认证</Select.Option>
- </Select>
- <Select placeholder="认证状态" style={{ width: 160 }}
- value={this.state.authState}
- onChange={(e) => { this.setState({ authState: e }) }}>
- {this.state.authStateList}
- </Select>
- <Button type="primary" onClick={this.search}>搜索</Button>
- <Button onClick={this.reset}>重置</Button>
- <Button type="danger" disabled={!hasSelect} onClick={(e)=>{this.delectRow()}}>下架</Button>
- </div>
- <div className="patent-table">
- <Spin spinning={this.state.loading}>
- <Table columns={this.state.columns}
- dataSource={this.state.dataSource}
- rowSelection={rowSelection}
- pagination={this.state.pagination}
- onRowClick={this.tableRowClick} />
- </Spin>
- </div>
- <TechDemandDesc
- data={this.state.RowData}
- examineState={this.state.examineState}
- demandTypeOption={this.state.demandTypeOption}
- showDesc={this.state.showDesc}
- closeDesc={this.closeDesc} />
- </div>
- );
- }
- });
- export default DemandList;
|