| | |
| | | </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> |
| | |
| | | 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"; |
| | |
| | | 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" |
| | |
| | | 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" |
| | |
| | | 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> |
| | |
| | | import React, { useState, useCallback } from "react"; |
| | | import React, { useState, useCallback, useMemo } from "react"; |
| | | import { |
| | | List, |
| | | DatagridConfigurable, |
| | |
| | | TopToolbar, |
| | | SelectColumnsButton, |
| | | FilterButton, |
| | | BulkDeleteButton, |
| | | WrapperField, |
| | | useTranslate, |
| | | FunctionField, |
| | |
| | | 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"; |
| | | |
| | |
| | | |
| | | 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 ''; |
| | |
| | | ? 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) { |
| | |
| | | > |
| | | <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" /> |