/**
|
* 徐祥健<xuxj@hugeinfo.com.cn>
|
* 2018年9月18日 15:24
|
*
|
*/
|
|
|
import React from 'react';
|
|
import HeadView from '../view/HeadView';
|
import TableBtnView from '../view/TableBtnView';
|
import { Input, Button, Divider, Breadcrumb, Select, Badge } from 'antd';
|
import moment from 'moment';
|
import Fetch from '../fetch';
|
import TableView from '../view/TableView';
|
const Option = Select.Option;
|
function typeOfName(type) {
|
switch (type) {
|
case '0':
|
return "普通用户";
|
case '1':
|
return "律师";
|
case '2':
|
return "人大代表";
|
case '3':
|
return "政协委员";
|
case '4':
|
return "人民监督员";
|
case '5':
|
return "特约监察员";
|
default:
|
return "其他";
|
}
|
}
|
export default class BusList extends React.Component {
|
constructor(props) {
|
super(props);
|
this.state = {
|
data: [],
|
formdata: {},
|
resetKey: Date.now(),
|
loading: false
|
};
|
}
|
|
componentDidMount() {
|
|
document.title = '用户审核';
|
this.getData();
|
}
|
|
getData = () => {
|
const { formdata } = this.state;
|
Fetch.getUserList(formdata)
|
.then(res => {
|
for (var i = 0; i < res.length; i++) {
|
res[i]['index'] = i + 1;
|
}
|
this.setState({
|
data: res
|
});
|
});
|
}
|
onInputChange = ({ target: { value, name } }) => {
|
this.setState(({ formdata }) => ({
|
formdata: {
|
...formdata,
|
[name]: value
|
}
|
}))
|
}
|
|
Seaech = () => {
|
const { formdata } = this.state;
|
Fetch.getUserList(formdata)
|
.then(res => {
|
for (var i = 0; i < res.length; i++) {
|
res[i]['index'] = i + 1;
|
}
|
this.setState({
|
data: res
|
});
|
});
|
}
|
Reset = () => {
|
this.setState({
|
resetKey: Date.now(),
|
formdata: {}
|
}, this.getData);
|
}
|
onClick = (id, flag) => {
|
this.props.history.push('/userDetail/' + id + '/' + flag)
|
}
|
render() {
|
const columns = [{
|
title: '序号',
|
dataIndex: 'index',
|
key: 'index'
|
}, {
|
title: '姓名',
|
dataIndex: 'userName',
|
key: 'userName',
|
render: text => <span>{text ? text : '暂未补充'}</span>
|
}, {
|
title: '身份证号',
|
dataIndex: 'idcard',
|
key: 'idcard',
|
render: text => <span>{text ? text : '暂未补充'}</span>
|
}, {
|
title: '电话号码',
|
dataIndex: 'mobile',
|
key: 'mobile',
|
render: text => <span>{text ? text : '暂未补充'}</span>
|
}, {
|
title: '身份类型',
|
dataIndex: 'userType',
|
key: 'userType',
|
render: text => <span>{text ? typeOfName(text) : '暂未补充'}</span>
|
}, {
|
title: '是否人脸认证',
|
dataIndex: 'isFaceVerify',
|
key: 'isFaceVerify',
|
render: text => (
|
text == 1 ?
|
<Badge count={'已认证'} style={{ backgroundColor: '#52c41a' }} /> : <Badge count={'未认证'} />
|
)
|
}, {
|
title: '是否审核',
|
dataIndex: 'isAudit',
|
key: 'isAudit',
|
render: text => (
|
text == 0 ?
|
<Badge count={'未审核'} /> : <Badge count={'已审核'} style={{ backgroundColor: '#52c41a' }}/>
|
)
|
}, {
|
title: '创建时间',
|
dataIndex: 'createTime',
|
key: 'createTime',
|
render: text => <span>{moment(text).format("YYYY-MM-DD HH:mm")}</span>
|
}, {
|
title: '操作',
|
key: 'action',
|
render: (text, record) => (
|
<span>
|
{
|
text.isAudit == 0 ? <span>
|
<label className='theme-color' onClick={() => this.onClick(record.id, 'do')} style={{ cursor: 'pointer' }}>审核</label>
|
<Divider type="vertical" />
|
</span> : null
|
}
|
<label className='theme-color' onClick={() => this.onClick(record.id, 'see')} style={{ cursor: 'pointer' }}>查看</label>
|
</span>
|
),
|
}];
|
const { data, loading, resetKey } = this.state;
|
return (
|
<div className="app-page">
|
<HeadView history={this.props.history} />
|
<Breadcrumb style={{ padding: '20px' }}>
|
<Breadcrumb.Item><a href="">后台中心</a></Breadcrumb.Item>
|
<Breadcrumb.Item>用户审核</Breadcrumb.Item>
|
</Breadcrumb>
|
<TableBtnView name={''} key={resetKey}>
|
<Select
|
style={{ width: 200 }}
|
placeholder="根据用户类型查找"
|
onChange={(value) => this.onInputChange({ target: { name: 'userType', value } })}
|
>
|
<Option value="0">普通用户</Option>
|
<Option value="1">律师</Option>
|
<Option value="2">人大代表</Option>
|
<Option value="3">政协委员</Option>
|
<Option value="4">人民监督员</Option>
|
<Option value="5">特约监督员</Option>
|
</Select>
|
<Input placeholder="根据姓名模糊查询" style={{ width: "200px" }} name='userName' onChange={this.onInputChange} />
|
<Input placeholder="根据身份证号模糊查询" style={{ width: "200px" }} name='idcard' onChange={this.onInputChange} />
|
<Input placeholder="根据电话号码模糊查询" style={{ width: "200px" }} name='mobile' onChange={this.onInputChange} />
|
<Select
|
style={{ width: 200 }}
|
placeholder="根据状态查询"
|
onChange={(value) => this.onInputChange({ target: { name: 'isAudit', value } })}
|
>
|
<Option value="2">已审核</Option>
|
<Option value="1">待审核</Option>
|
</Select>
|
<Button type="primary" onClick={this.Seaech}>查询</Button>
|
<Button onClick={this.Reset}>重置</Button>
|
</TableBtnView>
|
<TableView columns={columns} data={data} pageSize='10' size='default' loading={loading} />
|
</div>
|
);
|
}
|
|
}
|