From 2d635f52d7d0d3c28a81419ae668912af1c23f9c Mon Sep 17 00:00:00 2001
From: vincentlu <t1341870251@gmail.com>
Date: 星期四, 26 二月 2026 13:57:22 +0800
Subject: [PATCH] #
---
zy-acs-flow/src/page/guarantee/GuaranteeEdit.jsx | 35 ++++-------
zy-acs-flow/src/page/guarantee/GuaranteeCreate.jsx | 81 +++++++++++---------------
zy-acs-flow/src/page/guarantee/GuaranteeList.jsx | 32 +++++++---
3 files changed, 72 insertions(+), 76 deletions(-)
diff --git a/zy-acs-flow/src/page/guarantee/GuaranteeCreate.jsx b/zy-acs-flow/src/page/guarantee/GuaranteeCreate.jsx
index 4ba7c79..5db5ba4 100644
--- a/zy-acs-flow/src/page/guarantee/GuaranteeCreate.jsx
+++ b/zy-acs-flow/src/page/guarantee/GuaranteeCreate.jsx
@@ -93,53 +93,42 @@
</DialogTitle>
<DialogContent>
<Grid container rowSpacing={2} columnSpacing={2}>
- <Grid item xs={12} display="flex" gap={1}>
- <TextInput
- label="table.field.guarantee.name"
- source="name"
- parse={v => v}
- validate={[required()]}
- fullWidth
- autoFocus
- />
+ <Grid item xs={12} md={6}>
+ <Stack spacing={2}>
+ <TextInput
+ label="table.field.guarantee.name"
+ source="name"
+ parse={v => v}
+ validate={[required()]}
+ fullWidth
+ autoFocus
+ />
+ <ScopeField />
+ <CronField />
+ </Stack>
</Grid>
- <Grid item xs={12}>
- <ScopeField />
- </Grid>
- <Grid item xs={12}>
- <CronField />
- </Grid>
- <Grid item xs={4} display="flex" gap={1}>
- <NumberInput
- label="table.field.guarantee.requiredCount"
- source="requiredCount"
- validate={[required()]}
- min={1}
- />
- </Grid>
- <Grid item xs={4} display="flex" gap={1}>
- <NumberInput
- label="table.field.guarantee.minSoc"
- source="minSoc"
- validate={[required()]}
- min={1}
- max={100}
- />
- </Grid>
- <Grid item xs={4} display="flex" gap={1}>
- <NumberInput
- label="table.field.guarantee.leadTime"
- source="leadTime"
- validate={[required()]}
- min={1}
- />
- </Grid>
-
- <Grid item xs={6} display="flex" gap={1}>
- <StatusSelectInput />
- </Grid>
- <Grid item xs={12} display="flex" gap={1}>
- <Stack direction="column" spacing={1} width={'100%'}>
+ <Grid item xs={12} md={6}>
+ <Stack spacing={2}>
+ <NumberInput
+ label="table.field.guarantee.requiredCount"
+ source="requiredCount"
+ validate={[required()]}
+ min={1}
+ />
+ <NumberInput
+ label="table.field.guarantee.minSoc"
+ source="minSoc"
+ validate={[required()]}
+ min={1}
+ max={100}
+ />
+ <NumberInput
+ label="table.field.guarantee.leadTime"
+ source="leadTime"
+ validate={[required()]}
+ min={1}
+ />
+ <StatusSelectInput />
<MemoInput />
</Stack>
</Grid>
diff --git a/zy-acs-flow/src/page/guarantee/GuaranteeEdit.jsx b/zy-acs-flow/src/page/guarantee/GuaranteeEdit.jsx
index f763ff9..de91d66 100644
--- a/zy-acs-flow/src/page/guarantee/GuaranteeEdit.jsx
+++ b/zy-acs-flow/src/page/guarantee/GuaranteeEdit.jsx
@@ -10,7 +10,7 @@
required,
DeleteButton,
} from 'react-admin';
-import { Stack, Grid, Box, Typography } from '@mui/material';
+import { Stack, Grid, Box, Typography, Divider } from '@mui/material';
import { EDIT_MODE } from '@/config/setting';
import EditBaseAside from "../components/EditBaseAside";
import CustomerTopToolBar from "../components/EditTopToolBar";
@@ -41,11 +41,11 @@
defaultValues={{}}
>
<Grid container width={{ xs: '100%', xl: '80%' }} rowSpacing={3} columnSpacing={3}>
- <Grid item xs={12} md={8}>
+ <Grid item xs={12} md={7}>
<Typography variant="h6" gutterBottom>
{translate('common.edit.title.main')}
</Typography>
- <Stack direction='row' gap={2}>
+ <Stack spacing={2}>
<TextInput
label="table.field.guarantee.name"
source="name"
@@ -53,20 +53,22 @@
validate={[required()]}
autoFocus
/>
- </Stack>
- <ScopeField />
- <Box mt={2}>
+ <ScopeField />
<CronField />
- </Box>
- <Stack direction='row' gap={2}>
+ </Stack>
+ </Grid>
+ <Grid item xs={12} md={5}>
+ <Typography variant="h6" gutterBottom>
+ {translate('common.edit.title.common')}
+ </Typography>
+ <Stack spacing={2}>
+ <StatusSelectInput />
<NumberInput
label="table.field.guarantee.requiredCount"
source="requiredCount"
validate={[required()]}
min={1}
/>
- </Stack>
- <Stack direction='row' gap={2}>
<NumberInput
label="table.field.guarantee.minSoc"
source="minSoc"
@@ -74,24 +76,15 @@
min={1}
max={100}
/>
- </Stack>
- <Stack direction='row' gap={2}>
<NumberInput
label="table.field.guarantee.leadTime"
source="leadTime"
validate={[required()]}
min={1}
/>
+ <Divider />
+ <MemoInput />
</Stack>
-
- </Grid>
- <Grid item xs={12} md={4}>
- <Typography variant="h6" gutterBottom>
- {translate('common.edit.title.common')}
- </Typography>
- <StatusSelectInput />
- <Box mt="2em" />
- <MemoInput />
</Grid>
</Grid>
</SimpleForm>
diff --git a/zy-acs-flow/src/page/guarantee/GuaranteeList.jsx b/zy-acs-flow/src/page/guarantee/GuaranteeList.jsx
index 5d0c744..4119633 100644
--- a/zy-acs-flow/src/page/guarantee/GuaranteeList.jsx
+++ b/zy-acs-flow/src/page/guarantee/GuaranteeList.jsx
@@ -1,4 +1,4 @@
-import React, { useState, useCallback } from "react";
+import React, { useState, useCallback, useMemo } from "react";
import {
List,
DatagridConfigurable,
@@ -6,7 +6,6 @@
TopToolbar,
SelectColumnsButton,
FilterButton,
- BulkDeleteButton,
WrapperField,
useTranslate,
FunctionField,
@@ -17,15 +16,15 @@
SelectInput,
DeleteButton,
EditButton,
+ useGetList,
} from 'react-admin';
import { Box } from '@mui/material';
import { styled } from '@mui/material/styles';
import GuaranteeCreate from "./GuaranteeCreate";
-import GuaranteePanel from "./GuaranteePanel";
import EmptyData from "../components/EmptyData";
import MyCreateButton from "../components/MyCreateButton";
import MyExportButton from '../components/MyExportButton';
-import { OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting';
+import { DEFAULT_PAGE_SIZE, OPERATE_MODE } from '@/config/setting';
import { describeCronExpression } from "./cronUtils";
import { DEFAULT_SCOPE_TYPE, SCOPE_FILTER_CHOICES, getScopeLabel } from "./guaranteeConstants";
@@ -69,6 +68,19 @@
const [createDialog, setCreateDialog] = useState(false);
+ const { data: agvModels = [] } = useGetList('agvModel', {
+ pagination: { page: 1, perPage: 200 },
+ sort: { field: 'id', order: 'ASC' },
+ filter: {},
+ });
+
+ const modelNameMap = useMemo(() => {
+ return agvModels.reduce((acc, model) => {
+ acc[model.id] = model.name;
+ return acc;
+ }, {});
+ }, [agvModels]);
+
const renderScopeType = useCallback((record) => {
if (!record) {
return '';
@@ -85,8 +97,11 @@
? translate('page.guarantee.scope.globalHelper')
: translate('common.enums.na');
}
+ if (record.scopeType === 'MODEL') {
+ return modelNameMap[record.scopeValue] || record.scopeValue;
+ }
return record.scopeValue;
- }, [translate]);
+ }, [translate, modelNameMap]);
const renderCron = useCallback((record) => {
if (!record || !record.cronExpr) {
@@ -122,10 +137,9 @@
>
<StyledDatagrid
preferenceKey='guarantee'
- bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />}
- rowClick={(id, resource, record) => false}
- expand={() => <GuaranteePanel />}
- expandSingle={true}
+ bulkActionButtons={false}
+ rowSelection="none"
+ rowClick={false}
omit={['createBy', 'memo']}
>
<TextField source="name" label="table.field.guarantee.name" />
--
Gitblit v1.9.1