| | |
| | | primaryText={node.name} |
| | | leftIcon={getIcon(node.icon)} |
| | | dense={dense} |
| | | sx={{ '& .RaMenuItemLink-icon': { visibility: 'hidden', minWidth: '24px' } }} |
| | | /> |
| | | ); |
| | | } |
| | |
| | | const header = ( |
| | | <MenuItem dense={dense} onClick={handleToggle} sx={{ display: 'flex', alignItems: 'center' }}> |
| | | <ListItemIcon sx={{ minWidth: 40, color: 'text.secondary', display: 'flex', alignItems: 'center' }}> |
| | | {isOpen ? <ExpandMore /> : icon} |
| | | {/* {isOpen ? <ExpandMore /> : icon} */} |
| | | {icon} |
| | | </ListItemIcon> |
| | | <Typography variant="inherit" color="textSecondary" sx={{ ml: 1, display: 'flex', alignItems: 'center' }}> |
| | | {translate(name)} |
| | |
| | | import ConfirmModal from "@/page/components/ConfirmModal"; |
| | | import { DataGrid } from '@mui/x-data-grid'; |
| | | import request from '@/utils/request'; |
| | | import { haveChildren } from '@/utils/common'; |
| | | |
| | | |
| | | const LocAreaMatPanel = () => { |
| | | const record = useRecordContext(); |
| | |
| | | const { data: { code, data, msg } } = await request.get(`/locAreaMatRela/groups/${record.id}`); |
| | | |
| | | if (code === 200) { |
| | | setMatnrTree(data || []) |
| | | setMatnrTree(haveChildren(data) || []) |
| | | } else { |
| | | notify(msg); |
| | | } |
| | |
| | | const { data: { code, data, msg } } = await request.get(`/locAreaMatRela/locType/${record.id}`); |
| | | |
| | | if (code === 200) { |
| | | setLocTree(data || []) |
| | | setLocTree(haveChildren(data) || []) |
| | | } else { |
| | | notify(msg); |
| | | } |
| | |
| | | }); |
| | | return result; |
| | | }; |
| | | |
| | | export const haveChildren = (item) => { |
| | | if (Array.isArray(item)) { |
| | | return item.map((k) => haveChildren(k)); |
| | | } |
| | | |
| | | if (item && typeof item === 'object') { |
| | | if (item.id !== undefined) { |
| | | item.id = item.id.toString(); |
| | | } |
| | | |
| | | if (item.children && Array.isArray(item.children)) { |
| | | item.children = haveChildren(item.children); |
| | | } |
| | | } |
| | | |
| | | return item; |
| | | }; |