From 1c00a6204f96c1de50ec961470ecc6bbbf5bb433 Mon Sep 17 00:00:00 2001
From: vincentlu <t1341870251@gmail.com>
Date: 星期一, 02 二月 2026 13:59:53 +0800
Subject: [PATCH] #
---
zy-acs-flow/src/page/sta/StaCreate.jsx | 108 ++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 81 insertions(+), 27 deletions(-)
diff --git a/zy-acs-flow/src/page/sta/StaCreate.jsx b/zy-acs-flow/src/page/sta/StaCreate.jsx
index e0fca1f..848b816 100644
--- a/zy-acs-flow/src/page/sta/StaCreate.jsx
+++ b/zy-acs-flow/src/page/sta/StaCreate.jsx
@@ -1,4 +1,4 @@
-import React, { useState, useRef, useEffect, useMemo } from "react";
+import React, { useMemo } from "react";
import {
CreateBase,
useTranslate,
@@ -36,6 +36,12 @@
const translate = useTranslate();
const notify = useNotify();
+ const greaterThanZero = useMemo(() => (value) => {
+ if (value === undefined || value === null || value === '') {
+ return undefined;
+ }
+ return Number(value) >= 0 ? undefined : translate('validate.gtZero');
+ }, [translate]);
const handleClose = (event, reason) => {
if (reason !== "backdropClick") {
@@ -48,8 +54,8 @@
notify('common.response.success');
};
- const handleError = async (data) => {
- notify('common.response.fail');
+ const handleError = async (error) => {
+ notify(error.message || 'common.response.fail', { type: 'error', messageArgs: { _: error.message } });
};
return (
@@ -85,14 +91,6 @@
<DialogContent>
<Grid container rowSpacing={2} columnSpacing={2}>
<Grid item xs={6} display="flex" gap={1}>
- <TextInput
- label="table.field.sta.uuid"
- source="uuid"
- parse={v => v}
- autoFocus
- />
- </Grid>
- <Grid item xs={6} display="flex" gap={1}>
<ReferenceInput
source="zoneId"
reference="zone"
@@ -101,23 +99,33 @@
label="table.field.sta.zoneId"
optionText="name"
filterToQuery={(val) => ({ name: val })}
+ validate={required()}
/>
</ReferenceInput>
</Grid>
+ {/* <Grid item xs={6} display="flex" gap={1}>
+ <TextInput
+ label="table.field.sta.uuid"
+ source="uuid"
+ parse={v => v}
+ autoFocus
+ />
+ </Grid> */}
<Grid item xs={6} display="flex" gap={1}>
<TextInput
label="table.field.sta.staNo"
source="staNo"
parse={v => v}
+ validate={required()}
/>
</Grid>
- <Grid item xs={6} display="flex" gap={1}>
+ {/* <Grid item xs={6} display="flex" gap={1}>
<TextInput
label="table.field.sta.name"
source="name"
parse={v => v}
/>
- </Grid>
+ </Grid> */}
<Grid item xs={6} display="flex" gap={1}>
<ReferenceInput
source="staType"
@@ -140,51 +148,96 @@
label="table.field.sta.code"
optionText="data"
filterToQuery={(val) => ({ data: val })}
+ validate={required()}
/>
</ReferenceInput>
</Grid>
- <Grid item xs={6} display="flex" gap={1}>
+ <Grid item xs={4} display="flex" gap={1}>
+ <NumberInput
+ label="table.field.sta.capacity"
+ source="capacity"
+ validate={[required(), greaterThanZero]}
+ />
+ </Grid>
+ {/* <Grid item xs={6} display="flex" gap={1}>
<NumberInput
label="table.field.sta.offset"
source="offset"
+ validate={required()}
+ />
+ </Grid> */}
+ <Grid item xs={4} display="flex" gap={1}>
+ <NumberInput
+ label="table.field.sta.height"
+ source="height"
+ validate={[required(), greaterThanZero]}
+ />
+ </Grid>
+ {/* <Grid item xs={6} display="flex" gap={1}>
+ <NumberInput
+ label="table.field.sta.depth"
+ source="depth"
+ helperText={translate('page.sta.depthHint')}
+ validate={[required(), greaterThanZero]}
+ />
+ </Grid> */}
+ <Grid item xs={4} display="flex" gap={1}>
+ <NumberInput
+ label="table.field.sta.angle"
+ source="angle"
+ validate={[required(), greaterThanZero]}
/>
</Grid>
<Grid item xs={6} display="flex" gap={1}>
+ <NumberInput
+ label="table.field.sta.inboundWait"
+ source="inboundWait"
+ validate={greaterThanZero}
+ />
+ </Grid>
+ <Grid item xs={6} display="flex" gap={1}>
+ <NumberInput
+ label="table.field.sta.outboundWait"
+ source="outboundWait"
+ validate={greaterThanZero}
+ />
+ </Grid>
+ {/* <Grid item xs={6} display="flex" gap={1}>
<TextInput
label="table.field.sta.autoing"
source="autoing"
parse={v => v}
/>
- </Grid>
- <Grid item xs={6} display="flex" gap={1}>
+ </Grid> */}
+ {/* <Grid item xs={6} display="flex" gap={1}>
<TextInput
label="table.field.sta.loading"
source="loading"
parse={v => v}
/>
- </Grid>
- <Grid item xs={6} display="flex" gap={1}>
+ </Grid> */}
+ {/* <Grid item xs={6} display="flex" gap={1}>
<TextInput
label="table.field.sta.inEnable"
source="inEnable"
parse={v => v}
/>
- </Grid>
- <Grid item xs={6} display="flex" gap={1}>
+ </Grid> */}
+ {/* <Grid item xs={6} display="flex" gap={1}>
<TextInput
label="table.field.sta.outEnable"
source="outEnable"
parse={v => v}
/>
- </Grid>
- <Grid item xs={6} display="flex" gap={1}>
+ </Grid> */}
+ {/* <Grid item xs={6} display="flex" gap={1}>
<TextInput
label="table.field.sta.zpallet"
source="zpallet"
parse={v => v}
/>
- </Grid>
- <Grid item xs={6} display="flex" gap={1}>
+ </Grid> */}
+ {/* <Grid item xs={6} display="flex" gap={1}>
<ReferenceInput
source="staSts"
reference="staSts"
@@ -193,13 +246,14 @@
label="table.field.sta.staSts"
optionText="name"
filterToQuery={(val) => ({ name: val })}
+ validate={required()}
/>
</ReferenceInput>
- </Grid>
+ </Grid> */}
- <Grid item xs={6} display="flex" gap={1}>
+ {/* <Grid item xs={6} display="flex" gap={1}>
<StatusSelectInput />
- </Grid>
+ </Grid> */}
<Grid item xs={12} display="flex" gap={1}>
<Stack direction="column" spacing={1} width={'100%'}>
<MemoInput />
--
Gitblit v1.9.1