From b7897958c4f095af331c329865cbd1f715673896 Mon Sep 17 00:00:00 2001
From: vincentlu <t1341870251@gmail.com>
Date: 星期二, 27 一月 2026 09:39:33 +0800
Subject: [PATCH] #
---
zy-acs-flow/src/page/sta/StaCreate.jsx | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/zy-acs-flow/src/page/sta/StaCreate.jsx b/zy-acs-flow/src/page/sta/StaCreate.jsx
index dee5771..82fa046 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") {
@@ -150,7 +156,7 @@
<NumberInput
label="table.field.sta.capacity"
source="capacity"
- validate={required()}
+ validate={[required(), greaterThanZero]}
/>
</Grid>
{/* <Grid item xs={6} display="flex" gap={1}>
@@ -164,33 +170,35 @@
<NumberInput
label="table.field.sta.height"
source="height"
- validate={required()}
+ validate={[required(), greaterThanZero]}
/>
</Grid>
<Grid item xs={6} display="flex" gap={1}>
<NumberInput
label="table.field.sta.depth"
source="depth"
- validate={required()}
+ validate={[required(), greaterThanZero]}
/>
</Grid>
<Grid item xs={6} display="flex" gap={1}>
<NumberInput
label="table.field.sta.angle"
source="angle"
- validate={required()}
+ 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}>
--
Gitblit v1.9.1