From 052ee1f9c0b9e2bc8bbd4cf135ae45fed7422023 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期一, 28 十月 2024 10:36:28 +0800 Subject: [PATCH] # --- zy-acs-flow/src/page/funcSta/FuncStaList.jsx | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 deletions(-) diff --git a/zy-acs-flow/src/page/funcSta/FuncStaList.jsx b/zy-acs-flow/src/page/funcSta/FuncStaList.jsx index f41b3e9..d8ad3db 100644 --- a/zy-acs-flow/src/page/funcSta/FuncStaList.jsx +++ b/zy-acs-flow/src/page/funcSta/FuncStaList.jsx @@ -30,6 +30,7 @@ ReferenceArrayInput, AutocompleteInput, DeleteButton, + FunctionField, } from 'react-admin'; import { Box, Typography, Card, Stack } from '@mui/material'; import { styled } from '@mui/material/styles'; @@ -40,7 +41,7 @@ import MyExportButton from '../components/MyExportButton'; import PageDrawer from "../components/PageDrawer"; import MyField from "../components/MyField"; -import { PAGE_DRAWER_WIDTH, OPERATE_MODE } from '@/config/setting'; +import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; import * as Common from '@/utils/common'; const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ @@ -56,6 +57,16 @@ width: 200 }, })); + +const typeMap = { + CHARGE: 'page.funcSta.enums.type.charge', + STANDBY: 'page.funcSta.enums.type.standby', +}; + +const stateMap = { + IDLE: 'page.funcSta.enums.state.idle', + OCCUPIED: 'page.funcSta.enums.state.occupied', +}; const filters = [ <SearchInput source="condition" alwaysOn />, @@ -78,6 +89,7 @@ { id: 'STANDBY', name: 'page.funcSta.enums.type.standby' }, ]} alwaysOn + resettable />, <SelectInput source="state" @@ -87,6 +99,7 @@ { id: 'OCCUPIED', name: 'page.funcSta.enums.state.occupied' }, ]} alwaysOn + resettable />, <ReferenceInput source="code" label="table.field.funcSta.code" reference="code"> <AutocompleteInput label="table.field.funcSta.code" optionText="data" filterToQuery={(val) => ({ data: val })} /> @@ -132,7 +145,7 @@ <MyExportButton /> </TopToolbar> )} - perPage={25} + perPage={DEFAULT_PAGE_SIZE} > <StyledDatagrid preferenceKey='funcSta' @@ -151,8 +164,8 @@ <ReferenceField source="agvId" label="table.field.funcSta.agvId" reference="agv" link={false} sortable={false}> <TextField source="uuid" /> </ReferenceField> - <TextField source="type" label="table.field.funcSta.type" /> - <TextField source="state" label="table.field.funcSta.state" /> + <FunctionField source="type" label="table.field.funcSta.type" render={record => translate(typeMap[record.type]) || record.type} /> + <FunctionField source="state" label="table.field.funcSta.state" render={record => translate(stateMap[record.state]) || record.state} /> <ReferenceField source="code" label="table.field.funcSta.code" reference="code" link={false} sortable={false}> <TextField source="data" /> </ReferenceField> -- Gitblit v1.9.1