1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
| import React, { useState, useRef, useEffect, useMemo, useCallback } from "react";
| import {
| useRecordContext,
| } from 'react-admin';
| import { Box, Typography, Card, Stack } from '@mui/material';
| import { useTheme } from '@mui/material/styles';
|
| const DictField = ({ source }) => {
| const record = useRecordContext();
| const theme = useTheme();
|
| const value = JSON.parse(localStorage.getItem('sys_dicts'))?.find(dict => (dict.value == record[source])).label;
|
|
| return record ? (
| <Typography
| variant="body2"
| >
| {value}
| </Typography >
| ) : null;
| }
|
| export default DictField;
|
|