| | |
| | | import React, { useState, useEffect } from 'react'; |
| | | import { useCreateContext, useTranslate } from 'react-admin' |
| | | import { useCreateContext, useTranslate, useRecordContext } from 'react-admin' |
| | | import { MenuItem, Select, FormControl, InputLabel, Typography } from '@mui/material'; |
| | | import request from '@/utils/request'; |
| | | import * as Common from '@/utils/common'; |
| | |
| | | |
| | | const [proxyVal, setProxyVal] = React.useState(''); |
| | | |
| | | const record = useRecordContext() |
| | | const val = value || record[source]; |
| | | |
| | | useEffect(() => { |
| | | const http = async (resource) => { |
| | | const res = await request.post(resource + '/tree', { |
| | |
| | | }); |
| | | if (res?.data?.code === 200) { |
| | | setTreeData(Common.flattenTree(res.data.data)); |
| | | setProxyVal(value); |
| | | setProxyVal(val); |
| | | } else { |
| | | notify(res.data.msg); |
| | | } |