/** * Created by hao.cheng on 2017/4/16. */ import React from 'react'; import { Table, Input, Button } from 'antd'; import { trailwayDelUser, trailwayListUsers } from '../../service'; import AddUser from './AddUser'; import ChangePwd from './ChangePwd'; class UserManage extends React.Component { constructor(props: {}) { super(props); } private addUserRef = React.createRef(); private changePwdRef = React.createRef(); state = { filterDropdownVisible: false, data: [], searchText: '', filtered: false, }; searchInput: any; componentDidMount() { this.refreshUser(); } refreshUser = () => { trailwayListUsers().then((res) => { this.setState({ data: res.data, }); }); }; showAddUser = () => { this.addUserRef.current?.switchShow(); console.log('handleSwitchShow'); }; showChangePwd = (userId: Number) => { this.changePwdRef.current?.switchShow(userId); }; handleDel = (id: Number) => { trailwayDelUser(id).then((res) => { if (res.code == 200) { this.refreshUser(); } }); }; render() { const columns = [ { title: 'ID', dataIndex: 'id', key: 'id', sorter: (a: any, b: any) => a.id - b.id, }, { title: '用户名', dataIndex: 'username', key: 'username', }, { title: '管理员', dataIndex: 'role', key: 'role', render: (role: any) => (role === 1 ? '是' : '否'), }, { title: '操作', render: (record: any) => (
), }, ]; return (
record.id} /> ); } } export default UserManage;