From a6ad2390ec0ae92302ebb4d75945c416ca45060c Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期六, 21 九月 2024 15:55:43 +0800 Subject: [PATCH] # --- zy-acs-flow/src/i18n/en.js | 5 +++++ zy-acs-flow/src/page/components/ListEmptyTip.jsx | 32 ++++++++++++++++++++++++++++++++ zy-acs-flow/src/i18n/zh.js | 5 +++++ zy-acs-flow/src/page/agv/show/AgvShowDetail.jsx | 11 +++++++---- zy-acs-flow/src/page/agv/show/AgvShowTask.jsx | 7 ++----- 5 files changed, 51 insertions(+), 9 deletions(-) diff --git a/zy-acs-flow/src/i18n/en.js b/zy-acs-flow/src/i18n/en.js index 31cfced..f3cbf64 100644 --- a/zy-acs-flow/src/i18n/en.js +++ b/zy-acs-flow/src/i18n/en.js @@ -22,6 +22,11 @@ memo: 'memo', opt: 'operate', }, + list: { + empty: { + tip: 'No data to display', + } + }, edit: { title: { main: 'Main', diff --git a/zy-acs-flow/src/i18n/zh.js b/zy-acs-flow/src/i18n/zh.js index 0b3c23e..fe20894 100644 --- a/zy-acs-flow/src/i18n/zh.js +++ b/zy-acs-flow/src/i18n/zh.js @@ -22,6 +22,11 @@ memo: '澶囨敞', opt: '鎿嶄綔', }, + list: { + empty: { + tip: '娌℃湁鍙樉绀烘暟鎹�', + } + }, edit: { title: { main: '涓昏', diff --git a/zy-acs-flow/src/page/agv/show/AgvShowDetail.jsx b/zy-acs-flow/src/page/agv/show/AgvShowDetail.jsx index ad3e2a0..e507917 100644 --- a/zy-acs-flow/src/page/agv/show/AgvShowDetail.jsx +++ b/zy-acs-flow/src/page/agv/show/AgvShowDetail.jsx @@ -82,26 +82,29 @@ ) } -const DetailTitle = ({ title }) => { +const DetailTitle = ({ title, ...rest }) => { const translate = useTranslate(); return ( <Typography color="textSecondary" variant="caption" + {...rest} > {translate(title)} </Typography> ) } -const DetailValue = ({ value }) => { +const DetailValue = ({ value, fontBold = false }) => { return ( <Typography variant="body2" + color={fontBold ? 'textSecondary' : 'textPrimary'} width='80%' sx={{ wordWrap: 'break-word', whiteSpace: 'normal', + fontWeight: fontBold && 'bold', }} > {value} @@ -116,7 +119,7 @@ <Grid container spacing={1} sx={{ maxWidth: GRID_CONTAINER_MAX_WIDTH }}> <Grid item xs={ITEM_COL}> <DetailTitle title='common.field.status' /> - <DetailValue value={record.agvDetail.statusDesc} /> + <DetailValue fontBold value={record.agvDetail.statusDesc} /> </Grid> <Grid item xs={ITEM_COL}> <DetailTitle title='table.field.agvDetail.pos' /> @@ -190,7 +193,7 @@ <Grid container spacing={1} sx={{ maxWidth: GRID_CONTAINER_MAX_WIDTH }}> <Grid item xs={ITEM_COL}> <DetailTitle title='table.field.agvModel.name' /> - <DetailValue value={record.agvModelData.name} /> + <DetailValue fontBold value={record.agvModelData.name} /> </Grid> <Grid item xs={ITEM_COL}> <DetailTitle title='table.field.agvModel.length' /> diff --git a/zy-acs-flow/src/page/agv/show/AgvShowTask.jsx b/zy-acs-flow/src/page/agv/show/AgvShowTask.jsx index e4ea8c8..4c479bc 100644 --- a/zy-acs-flow/src/page/agv/show/AgvShowTask.jsx +++ b/zy-acs-flow/src/page/agv/show/AgvShowTask.jsx @@ -24,11 +24,11 @@ import request from '@/utils/request'; import { useTheme } from '@mui/material/styles'; import { getTaskStsColor } from '@/utils/common'; +import ListEmptyTip from "../../components/ListEmptyTip"; const TaskItem = ({ record, now }) => { const translate = useTranslate(); const theme = useTheme(); - console.log(record); return ( <> @@ -182,7 +182,6 @@ ) })} - {currCount < total && ( <Button onClick={() => @@ -200,9 +199,7 @@ </List> </Box> ) : ( - <Typography> - no data found - </Typography> + <ListEmptyTip /> )} </> diff --git a/zy-acs-flow/src/page/components/ListEmptyTip.jsx b/zy-acs-flow/src/page/components/ListEmptyTip.jsx new file mode 100644 index 0000000..8a58b95 --- /dev/null +++ b/zy-acs-flow/src/page/components/ListEmptyTip.jsx @@ -0,0 +1,32 @@ +import React, { useState, useRef, useEffect, useMemo } from "react"; +import { + useTranslate, +} from 'react-admin'; +import { + Box, + Button, + Card, + CardContent, + Stack, + Typography, +} from '@mui/material'; + +const ListEmptyTip = (props) => { + const { tip, ...rest } = props; + const translate = useTranslate(); + + return ( + <> + <Box mt={3} ml={2}> + <Typography + variant="subtitle1" + color="textPrimary" + > + {tip || translate('common.list.empty.tip')} + </Typography> + </Box> + </> + ) +} + +export default ListEmptyTip; \ No newline at end of file -- Gitblit v1.9.1