This commit is contained in:
xuyucheng 2022-03-10 15:08:15 +08:00
parent 4987128f63
commit c950cc7f0f
1 changed files with 49 additions and 2 deletions

View File

@ -1,7 +1,8 @@
import React, { Component } from 'react' import React, { Component } from 'react'
import { Row, Input, Button, Modal, Form, Select, message } from 'antd' import { Row, Input, Button, Modal, Form, Select, message, Space } from 'antd'
import { rsaKey } from "@/utils/rsaKey.js"; import { rsaKey } from "@/utils/rsaKey.js";
import api from "@/api/request" import api from "@/api/request"
import FeTable from "@/components/table"
const { Search } = Input const { Search } = Input
@ -11,7 +12,9 @@ class UserSet extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
visible: false visible: false,
data: [],
columns: []
} }
} }
@ -33,6 +36,49 @@ class UserSet extends Component {
}) })
} }
onSearch = (value) => {
api.get("/admin/user/list_user", {
criteria: value,
skip: 1,
limit: 10
})
.then(res => {
const col = Object.keys(res.result.data[0]).map((item, key) => {
return {
title: item,
dataIndex: item,
key,
align: 'center',
}
})
col.push(
{
title: "operation",
dataIndex: "operation",
key: res.result.data[0].length - 1,
align: 'center',
render: (record) => <Space><Button type="info" danger> </Button><Button type="primary" danger> </Button></Space>,
}
)
this.setState({
data: res.result.data,
columns: col
})
})
.catch(err => {
console.log(err)
})
}
callback = (e, value) => {
e === '停 用' ? api.get("/admin/user/disable_user", { UID: value.UID }).then(res => {
message.success(res.info)
}) : api.get("/admin/user/delete_user", { UID: value.UID }).then(res => {
message.success(res.info)
})
}
onAdd = () => { onAdd = () => {
const form = this.AddForm.current const form = this.AddForm.current
const data = { const data = {
@ -58,6 +104,7 @@ class UserSet extends Component {
新增用户 新增用户
</Button> </Button>
</Row> </Row>
<FeTable data={this.state.data} columns={this.state.columns} callback={this.callback.bind(this)} />
<Modal <Modal
visible={this.state.visible} visible={this.state.visible}
title="新增" title="新增"