From 14ddde5c41d8d98fc9b67ebae72b6cdbca73330b Mon Sep 17 00:00:00 2001 From: skyouc <creaycat@gmail.com> Date: 星期五, 25 四月 2025 20:45:10 +0800 Subject: [PATCH] 添加动态字段拦截器 --- rsf-admin/src/page/deviceBind/DeviceBindPanel.jsx | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 111 insertions(+), 0 deletions(-) diff --git a/rsf-admin/src/page/deviceBind/DeviceBindPanel.jsx b/rsf-admin/src/page/deviceBind/DeviceBindPanel.jsx new file mode 100644 index 0000000..fa74506 --- /dev/null +++ b/rsf-admin/src/page/deviceBind/DeviceBindPanel.jsx @@ -0,0 +1,111 @@ +import React, { useState, useRef, useEffect, useMemo } from "react"; +import { Box, Card, CardContent, Grid, Typography, Tooltip } from '@mui/material'; +import { + useTranslate, + useRecordContext, +} from 'react-admin'; +import PanelTypography from "../components/PanelTypography"; +import * as Common from '@/utils/common' + +const DeviceBindPanel = () => { + const record = useRecordContext(); + if (!record) return null; + const translate = useTranslate(); + return ( + <> + <Card sx={{ width: { xs: 300, sm: 500, md: 600, lg: 800 }, margin: 'auto' }}> + <CardContent> + <Grid container spacing={2}> + <Grid item xs={12} sx={{ display: 'flex', justifyContent: 'space-between' }}> + <Typography variant="h6" gutterBottom align="left" sx={{ + maxWidth: { xs: '100px', sm: '180px', md: '260px', lg: '360px' }, + whiteSpace: 'nowrap', + overflow: 'hidden', + textOverflow: 'ellipsis', + }}> + {Common.camelToPascalWithSpaces(translate('table.field.deviceBind.id'))}: {record.id} + </Typography> + {/* inherit, primary, secondary, textPrimary, textSecondary, error */} + <Typography variant="h6" gutterBottom align="right" > + ID: {record.id} + </Typography> + </Grid> + </Grid> + <Grid container spacing={2}> + <Grid item xs={12} container alignContent="flex-end"> + <Typography variant="caption" color="textSecondary" sx={{ wordWrap: 'break-word', wordBreak: 'break-all' }}> + {Common.camelToPascalWithSpaces(translate('common.field.memo'))}:{record.memo} + </Typography> + </Grid> + </Grid> + <Box height={20}> </Box> + <Grid container spacing={2}> + <Grid item xs={6}> + <PanelTypography + title="table.field.deviceBind.currentRow" + property={record.currentRow} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.deviceBind.startRow" + property={record.startRow} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.deviceBind.endRow" + property={record.endRow} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.deviceBind.deviceQty" + property={record.deviceQty} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.deviceBind.startDeviceNo" + property={record.startDeviceNo} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.deviceBind.endDeviceNo" + property={record.endDeviceNo} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.deviceBind.staList" + property={record.staList} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.deviceBind.typeId" + property={record.typeId} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.deviceBind.beSimilar" + property={record.beSimilar} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.deviceBind.emptySimilar" + property={record.emptySimilar} + /> + </Grid> + + </Grid> + </CardContent> + </Card > + </> + ); +}; + +export default DeviceBindPanel; -- Gitblit v1.9.1