temp
This commit is contained in:
@@ -5,11 +5,14 @@ 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<AddUser>();
|
||||
private changePwdRef = React.createRef<ChangePwd>();
|
||||
|
||||
state = {
|
||||
filterDropdownVisible: false,
|
||||
@@ -22,10 +25,6 @@ class UserManage extends React.Component {
|
||||
componentDidMount() {
|
||||
this.refreshUser();
|
||||
}
|
||||
|
||||
onInputChange = (e: any) => {
|
||||
this.setState({ searchText: e.target.value });
|
||||
};
|
||||
refreshUser = () => {
|
||||
trailwayListUsers().then((res) => {
|
||||
this.setState({
|
||||
@@ -33,12 +32,19 @@ class UserManage extends React.Component {
|
||||
});
|
||||
});
|
||||
};
|
||||
handleSwitchShow = () => {
|
||||
showAddUser = () => {
|
||||
this.addUserRef.current?.switchShow();
|
||||
console.log('handleSwitchShow');
|
||||
};
|
||||
showChangePwd = (userId: Number) => {
|
||||
this.changePwdRef.current?.switchShow(userId);
|
||||
};
|
||||
handleDel = (id: Number) => {
|
||||
trailwayDelUser(id);
|
||||
this.refreshUser();
|
||||
trailwayDelUser(id).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.refreshUser();
|
||||
}
|
||||
});
|
||||
};
|
||||
render() {
|
||||
const columns = [
|
||||
@@ -63,8 +69,12 @@ class UserManage extends React.Component {
|
||||
title: '操作',
|
||||
render: (record: any) => (
|
||||
<div>
|
||||
<Button type="primary" size="small">
|
||||
编辑
|
||||
<Button
|
||||
onClick={() => this.showChangePwd(record.id)}
|
||||
type="primary"
|
||||
size="small"
|
||||
>
|
||||
修改密码
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
@@ -79,11 +89,16 @@ class UserManage extends React.Component {
|
||||
];
|
||||
return (
|
||||
<div>
|
||||
<Button onClick={this.refreshUser} type="primary">
|
||||
<Button onClick={this.showAddUser} type="primary">
|
||||
增加用户
|
||||
</Button>
|
||||
<AddUser onSuccess={this.refreshUser}></AddUser>
|
||||
<Table columns={columns} dataSource={this.state.data} />
|
||||
<AddUser ref={this.addUserRef} onSuccess={this.refreshUser}></AddUser>
|
||||
<ChangePwd ref={this.changePwdRef}></ChangePwd>
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={this.state.data}
|
||||
rowKey={(record) => record.id}
|
||||
/>
|
||||
<style>{`
|
||||
.custom-filter-dropdown {
|
||||
padding: 8px;
|
||||
|
||||
Reference in New Issue
Block a user