1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
| import * as React from 'react';
| import { SelectArrayInput } from 'react-admin';
| import request from '@/utils/request'
|
| const RolesSelect = (props) => {
| const [arr, setArr] = React.useState([]);
|
| React.useEffect(() => {
| request.post('/role/list', {}).then(res => {
| if (res?.data?.code === 200) {
| setArr(res.data.data.map(item => {
| return {
| id: item.id,
| name: item.name
| }
| }))
| }
| })
| }, [])
|
| return (
| <SelectArrayInput
| {...props}
| choices={arr}
| />
| )
| };
|
| export default RolesSelect;
|
|