From a0a30a103b30a972942eb5cf4b4c0b45a1c2e562 Mon Sep 17 00:00:00 2001
From: vincentlu <t1341870251@gmail.com>
Date: 星期四, 26 二月 2026 13:04:10 +0800
Subject: [PATCH] #

---
 zy-acs-flow/src/page/guarantee/GuaranteeEdit.jsx     |  139 +++++++++++++++-------------------
 zy-acs-flow/src/page/guarantee/ScopeField.jsx        |    1 
 zy-acs-flow/src/page/guarantee/GuaranteeCreate.jsx   |   11 --
 zy-acs-flow/src/page/guarantee/GuaranteeList.jsx     |   55 ++-----------
 zy-acs-flow/src/page/guarantee/guaranteeConstants.js |   27 ------
 5 files changed, 73 insertions(+), 160 deletions(-)

diff --git a/zy-acs-flow/src/page/guarantee/GuaranteeCreate.jsx b/zy-acs-flow/src/page/guarantee/GuaranteeCreate.jsx
index 16239fa..4ba7c79 100644
--- a/zy-acs-flow/src/page/guarantee/GuaranteeCreate.jsx
+++ b/zy-acs-flow/src/page/guarantee/GuaranteeCreate.jsx
@@ -93,21 +93,14 @@
                         </DialogTitle>
                         <DialogContent>
                             <Grid container rowSpacing={2} columnSpacing={2}>
-                                <Grid item xs={6} display="flex" gap={1}>
-                                    <TextInput
-                                        label="table.field.guarantee.uuid"
-                                        source="uuid"
-                                        parse={v => v}
-                                        autoFocus
-                                    />
-                                </Grid>
-                                <Grid item xs={6} display="flex" gap={1}>
+                                <Grid item xs={12} display="flex" gap={1}>
                                     <TextInput
                                         label="table.field.guarantee.name"
                                         source="name"
                                         parse={v => v}
                                         validate={[required()]}
                                         fullWidth
+                                        autoFocus
                                     />
                                 </Grid>
                                 <Grid item xs={12}>
diff --git a/zy-acs-flow/src/page/guarantee/GuaranteeEdit.jsx b/zy-acs-flow/src/page/guarantee/GuaranteeEdit.jsx
index aae03b9..f763ff9 100644
--- a/zy-acs-flow/src/page/guarantee/GuaranteeEdit.jsx
+++ b/zy-acs-flow/src/page/guarantee/GuaranteeEdit.jsx
@@ -1,4 +1,4 @@
-import React, { useState, useRef, useEffect, useMemo } from "react";
+import React from "react";
 import {
     Edit,
     SimpleForm,
@@ -29,87 +29,72 @@
     )
 }
 
-const GuaranteeEdit = () => {
+const GuaranteeEditForm = () => {
     const translate = useTranslate();
 
     return (
-        <Edit
-            redirect="list"
-            mutationMode={EDIT_MODE}
-            actions={<CustomerTopToolBar />}
-            aside={<EditBaseAside />}
+        <SimpleForm
+            shouldUnregister
+            warnWhenUnsavedChanges
+            toolbar={<FormToolbar />}
+            mode="onTouched"
+            defaultValues={{}}
         >
-            <SimpleForm
-                shouldUnregister
-                warnWhenUnsavedChanges
-                toolbar={<FormToolbar />}
-                mode="onTouched"
-                defaultValues={{}}
-            // validate={(values) => { }}
-            >
-                <Grid container width={{ xs: '100%', xl: '80%' }} rowSpacing={3} columnSpacing={3}>
-                    <Grid item xs={12} md={8}>
-                        <Typography variant="h6" gutterBottom>
-                            {translate('common.edit.title.main')}
-                        </Typography>
-                        <Stack direction='row' gap={2}>
-                            <TextInput
-                                label="table.field.guarantee.uuid"
-                                source="uuid"
-                                parse={v => v}
-                                autoFocus
-                            />
-                        </Stack>
-                        <Stack direction='row' gap={2}>
-                            <TextInput
-                                label="table.field.guarantee.name"
-                                source="name"
-                                parse={v => v}
-                                validate={[required()]}
-                            />
-                        </Stack>
-                        <ScopeField />
-                        <Box mt={2}>
-                            <CronField />
-                        </Box>
-                        <Stack direction='row' gap={2}>
-                            <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"
-                                validate={[required()]}
-                                min={1}
-                                max={100}
-                            />
-                        </Stack>
-                        <Stack direction='row' gap={2}>
-                            <NumberInput
-                                label="table.field.guarantee.leadTime"
-                                source="leadTime"
-                                validate={[required()]}
-                                min={1}
-                            />
-                        </Stack>
+            <Grid container width={{ xs: '100%', xl: '80%' }} rowSpacing={3} columnSpacing={3}>
+                <Grid item xs={12} md={8}>
+                    <Typography variant="h6" gutterBottom>
+                        {translate('common.edit.title.main')}
+                    </Typography>
+                    <Stack direction='row' gap={2}>
+                        <TextInput
+                            label="table.field.guarantee.name"
+                            source="name"
+                            parse={v => v}
+                            validate={[required()]}
+                            autoFocus
+                        />
+                    </Stack>
+                    <ScopeField />
+                    <Box mt={2}>
+                        <CronField />
+                    </Box>
+                    <Stack direction='row' gap={2}>
+                        <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"
+                            validate={[required()]}
+                            min={1}
+                            max={100}
+                        />
+                    </Stack>
+                    <Stack direction='row' gap={2}>
+                        <NumberInput
+                            label="table.field.guarantee.leadTime"
+                            source="leadTime"
+                            validate={[required()]}
+                            min={1}
+                        />
+                    </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>
-        </Edit >
+                <Grid item xs={12} md={4}>
+                    <Typography variant="h6" gutterBottom>
+                        {translate('common.edit.title.common')}
+                    </Typography>
+                    <StatusSelectInput />
+                    <Box mt="2em" />
+                    <MemoInput />
+                </Grid>
+            </Grid>
+        </SimpleForm>
     )
 }
 
@@ -125,7 +110,7 @@
             scopeValue: data.scopeType === DEFAULT_SCOPE_TYPE ? null : data.scopeValue,
         })}
     >
-        <GuaranteeEdit />
+        <GuaranteeEditForm />
     </Edit>
 );
 
diff --git a/zy-acs-flow/src/page/guarantee/GuaranteeList.jsx b/zy-acs-flow/src/page/guarantee/GuaranteeList.jsx
index cd953e2..5d0c744 100644
--- a/zy-acs-flow/src/page/guarantee/GuaranteeList.jsx
+++ b/zy-acs-flow/src/page/guarantee/GuaranteeList.jsx
@@ -14,25 +14,18 @@
     NumberField,
     DateField,
     BooleanField,
-    ReferenceField,
-    TextInput,
-    DateTimeInput,
-    DateInput,
     SelectInput,
-    NumberInput,
     DeleteButton,
     EditButton,
 } from 'react-admin';
-import { Box, Typography, Card, Stack } from '@mui/material';
+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 PageDrawer from "../components/PageDrawer";
-import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting';
-import * as Common from '@/utils/common';
+import { OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting';
 import { describeCronExpression } from "./cronUtils";
 import { DEFAULT_SCOPE_TYPE, SCOPE_FILTER_CHOICES, getScopeLabel } from "./guaranteeConstants";
 
@@ -52,26 +45,13 @@
 
 const filters = [
     <SearchInput source="condition" alwaysOn />,
-    <DateInput label='common.time.after' source="timeStart" alwaysOn />,
-    <DateInput label='common.time.before' source="timeEnd" alwaysOn />,
-
-    <TextInput source="uuid" label="table.field.guarantee.uuid" />,
-    <TextInput source="name" label="table.field.guarantee.name" />,
     <SelectInput
         source="scopeType"
         label="table.field.guarantee.scopeType"
         choices={SCOPE_FILTER_CHOICES}
         translateChoice
-        allowEmpty
         resettable
     />,
-    <TextInput source="scopeValue" label="table.field.guarantee.scopeValue" />,
-    <TextInput source="cronExpr" label="table.field.guarantee.cronExpr" />,
-    <NumberInput source="requiredCount" label="table.field.guarantee.requiredCount" />,
-    <NumberInput source="minSoc" label="table.field.guarantee.minSoc" />,
-    <NumberInput source="leadTime" label="table.field.guarantee.leadTime" />,
-
-    <TextInput label="common.field.memo" source="memo" />,
     <SelectInput
         label="common.field.status"
         source="status"
@@ -79,15 +59,15 @@
             { id: '1', name: 'common.enums.statusTrue' },
             { id: '0', name: 'common.enums.statusFalse' },
         ]}
+        alwaysOn
         resettable
     />,
-]
+];
 
 const GuaranteeList = () => {
     const translate = useTranslate();
 
     const [createDialog, setCreateDialog] = useState(false);
-    const [drawerVal, setDrawerVal] = useState(false);
 
     const renderScopeType = useCallback((record) => {
         if (!record) {
@@ -124,7 +104,7 @@
                         theme.transitions.create(['all'], {
                             duration: theme.transitions.duration.enteringScreen,
                         }),
-                    marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0,
+                    marginRight: 0,
                 }}
                 title={"menu.guarantee"}
                 empty={<EmptyData onClick={() => { setCreateDialog(true) }} />}
@@ -146,10 +126,8 @@
                     rowClick={(id, resource, record) => false}
                     expand={() => <GuaranteePanel />}
                     expandSingle={true}
-                    omit={['id', 'createTime', 'createBy', 'memo']}
+                    omit={['createBy', 'memo']}
                 >
-                    <NumberField source="id" />
-                    <TextField source="uuid" label="table.field.guarantee.uuid" />
                     <TextField source="name" label="table.field.guarantee.name" />
                     <FunctionField label="table.field.guarantee.scopeType" render={renderScopeType} />
                     <FunctionField label="table.field.guarantee.scopeValue" render={renderScopeValue} />
@@ -158,32 +136,15 @@
                     <NumberField source="minSoc" label="table.field.guarantee.minSoc" />
                     <NumberField source="leadTime" label="table.field.guarantee.leadTime" />
 
-                    <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}>
-                        <TextField source="nickname" />
-                    </ReferenceField>
-                    <DateField source="updateTime" label="common.field.updateTime" showTime />
-                    <ReferenceField source="createBy" label="common.field.createBy" reference="user" link={false} sortable={false}>
-                        <TextField source="nickname" />
-                    </ReferenceField>
-                    <DateField source="createTime" label="common.field.createTime" showTime />
                     <BooleanField source="statusBool" label="common.field.status" sortable={false} />
-                    <TextField source="memo" label="common.field.memo" sortable={false} />
+                    <DateField source="updateTime" label="common.field.updateTime" showTime />
                     <WrapperField cellClassName="opt" label="common.field.opt">
                         <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} />
                         <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} />
                     </WrapperField>
                 </StyledDatagrid>
             </List>
-            <GuaranteeCreate
-                open={createDialog}
-                setOpen={setCreateDialog}
-            />
-            <PageDrawer
-                title='Guarantee Detail'
-                drawerVal={drawerVal}
-                setDrawerVal={setDrawerVal}
-            >
-            </PageDrawer>
+            <GuaranteeCreate open={createDialog} setOpen={setCreateDialog} />
         </Box>
     )
 }
diff --git a/zy-acs-flow/src/page/guarantee/ScopeField.jsx b/zy-acs-flow/src/page/guarantee/ScopeField.jsx
index 0b89c90..09ee6d2 100644
--- a/zy-acs-flow/src/page/guarantee/ScopeField.jsx
+++ b/zy-acs-flow/src/page/guarantee/ScopeField.jsx
@@ -25,6 +25,7 @@
                 translateChoice={false}
                 defaultValue={DEFAULT_SCOPE_TYPE}
                 helperText={translate('page.guarantee.scope.helper')}
+                validate={[required()]}
             />
             <FormDataConsumer>
                 {({ formData, ...rest }) => {
diff --git a/zy-acs-flow/src/page/guarantee/guaranteeConstants.js b/zy-acs-flow/src/page/guarantee/guaranteeConstants.js
index fbc0aba..4251245 100644
--- a/zy-acs-flow/src/page/guarantee/guaranteeConstants.js
+++ b/zy-acs-flow/src/page/guarantee/guaranteeConstants.js
@@ -15,33 +15,6 @@
         optionValue: 'id',
         filterToQuery: buildFilter('name'),
     },
-    AREA: {
-        id: 'AREA',
-        labelKey: 'page.guarantee.scope.area',
-        valueType: 'reference',
-        reference: 'area',
-        optionText: 'name',
-        optionValue: 'id',
-        filterToQuery: buildFilter('name'),
-    },
-    BIZ: {
-        id: 'BIZ',
-        labelKey: 'page.guarantee.scope.biz',
-        valueType: 'reference',
-        reference: 'taskType',
-        optionText: 'name',
-        optionValue: 'id',
-        filterToQuery: buildFilter('name'),
-    },
-    AGV: {
-        id: 'AGV',
-        labelKey: 'page.guarantee.scope.agv',
-        valueType: 'reference',
-        reference: 'agv',
-        optionText: 'uuid',
-        optionValue: 'id',
-        filterToQuery: buildFilter('uuid'),
-    },
 };
 
 export const DEFAULT_SCOPE_TYPE = SCOPE_CONFIGS.GLOBAL.id;

--
Gitblit v1.9.1