From 652a7305f0d991e59b9592c0519897c5383c0130 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期五, 18 十月 2024 13:09:24 +0800
Subject: [PATCH] #
---
zy-acs-flow/src/map/insight/agv/AgvControl.jsx | 170 ++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 128 insertions(+), 42 deletions(-)
diff --git a/zy-acs-flow/src/map/insight/agv/AgvControl.jsx b/zy-acs-flow/src/map/insight/agv/AgvControl.jsx
index 09aec4c..c90adf0 100644
--- a/zy-acs-flow/src/map/insight/agv/AgvControl.jsx
+++ b/zy-acs-flow/src/map/insight/agv/AgvControl.jsx
@@ -19,7 +19,7 @@
import RestartAltIcon from '@mui/icons-material/RestartAlt';
import useCoolHook from './useCoolHook';
-function AgvControl({ open, onClose }) {
+function AgvControl(props) {
const theme = useTheme();
const translate = useTranslate();
@@ -72,9 +72,30 @@
};
const {
- options: codeOptions,
- setInputValue: setCodeInputValue,
+ options: endCodeOptions,
+ setInputValue: setEndCodeInputValue,
} = useCoolHook('/code/page', 'data');
+
+ const {
+ options: startLocOptions,
+ setInputValue: setStartLocInputValue,
+ } = useCoolHook('/loc/page', 'locNo');
+
+ const {
+ options: endLocOptions,
+ setInputValue: setEndLocInputValue,
+ } = useCoolHook('/loc/page', 'locNo');
+
+ const {
+ options: startStaOptions,
+ setInputValue: setStartStaInputValue,
+ } = useCoolHook('/sta/page', 'staNo');
+
+ const {
+ options: endStaOptions,
+ setInputValue: setEndStaInputValue,
+ } = useCoolHook('/sta/page', 'staNo');
+
return (
<>
@@ -143,16 +164,17 @@
<Controller
name="endCode"
control={control}
+ rules={{ required: '鐩爣鍦伴潰鐮佷笉鑳戒负绌�' }}
render={({ field, fieldState }) => {
- const selectedOption = codeOptions.find(option => option.id === field.value) || null;
+ const selectedOption = endCodeOptions.find(option => option.id === field.value) || null;
return (
<Autocomplete
- options={codeOptions}
+ options={endCodeOptions}
getOptionLabel={(option) => option.label}
isOptionEqualToValue={(option, value) => option.id === value.id}
value={selectedOption}
onInputChange={(event, value) => {
- setCodeInputValue(value);
+ setEndCodeInputValue(value);
}}
onChange={(event, value) => {
field.onChange(value ? value.id : null);
@@ -178,15 +200,31 @@
name="startLocNo"
control={control}
rules={{ required: '璧峰搴撲綅涓嶈兘涓虹┖' }}
- render={({ field, fieldState }) => (
- <TextField
- {...field}
- fullWidth
- label="璧峰搴撲綅"
- error={!!fieldState.error}
- helperText={fieldState.error?.message}
- />
- )}
+ render={({ field, fieldState }) => {
+ const selectedOption = startLocOptions.find(option => option.id === field.value) || null;
+ return (
+ <Autocomplete
+ options={startLocOptions}
+ getOptionLabel={(option) => option.label}
+ isOptionEqualToValue={(option, value) => option.id === value.id}
+ value={selectedOption}
+ onInputChange={(event, value) => {
+ setStartLocInputValue(value);
+ }}
+ onChange={(event, value) => {
+ field.onChange(value ? value.id : null);
+ }}
+ renderInput={(params) => (
+ <TextField
+ {...params}
+ label="璧峰搴撲綅"
+ error={!!fieldState.error}
+ helperText={fieldState.error?.message}
+ />
+ )}
+ />
+ );
+ }}
/>
</Grid>
)}
@@ -197,15 +235,31 @@
name="endLocNo"
control={control}
rules={{ required: '鐩爣搴撲綅涓嶈兘涓虹┖' }}
- render={({ field, fieldState }) => (
- <TextField
- {...field}
- fullWidth
- label="鐩爣搴撲綅"
- error={!!fieldState.error}
- helperText={fieldState.error?.message}
- />
- )}
+ render={({ field, fieldState }) => {
+ const selectedOption = endLocOptions.find(option => option.id === field.value) || null;
+ return (
+ <Autocomplete
+ options={endLocOptions}
+ getOptionLabel={(option) => option.label}
+ isOptionEqualToValue={(option, value) => option.id === value.id}
+ value={selectedOption}
+ onInputChange={(event, value) => {
+ setEndLocInputValue(value);
+ }}
+ onChange={(event, value) => {
+ field.onChange(value ? value.id : null);
+ }}
+ renderInput={(params) => (
+ <TextField
+ {...params}
+ label="鐩爣搴撲綅"
+ error={!!fieldState.error}
+ helperText={fieldState.error?.message}
+ />
+ )}
+ />
+ );
+ }}
/>
</Grid>
)}
@@ -216,15 +270,31 @@
name="startStaNo"
control={control}
rules={{ required: '璧峰绔欑偣涓嶈兘涓虹┖' }}
- render={({ field, fieldState }) => (
- <TextField
- {...field}
- fullWidth
- label="璧峰绔欑偣"
- error={!!fieldState.error}
- helperText={fieldState.error?.message}
- />
- )}
+ render={({ field, fieldState }) => {
+ const selectedOption = startStaOptions.find(option => option.id === field.value) || null;
+ return (
+ <Autocomplete
+ options={startStaOptions}
+ getOptionLabel={(option) => option.label}
+ isOptionEqualToValue={(option, value) => option.id === value.id}
+ value={selectedOption}
+ onInputChange={(event, value) => {
+ setStartStaInputValue(value);
+ }}
+ onChange={(event, value) => {
+ field.onChange(value ? value.id : null);
+ }}
+ renderInput={(params) => (
+ <TextField
+ {...params}
+ label="璧峰绔欑偣"
+ error={!!fieldState.error}
+ helperText={fieldState.error?.message}
+ />
+ )}
+ />
+ );
+ }}
/>
</Grid>
)}
@@ -235,15 +305,31 @@
name="endStaNo"
control={control}
rules={{ required: '鐩爣绔欑偣涓嶈兘涓虹┖' }}
- render={({ field, fieldState }) => (
- <TextField
- {...field}
- fullWidth
- label="鐩爣绔欑偣"
- error={!!fieldState.error}
- helperText={fieldState.error?.message}
- />
- )}
+ render={({ field, fieldState }) => {
+ const selectedOption = endStaOptions.find(option => option.id === field.value) || null;
+ return (
+ <Autocomplete
+ options={endStaOptions}
+ getOptionLabel={(option) => option.label}
+ isOptionEqualToValue={(option, value) => option.id === value.id}
+ value={selectedOption}
+ onInputChange={(event, value) => {
+ setEndStaInputValue(value);
+ }}
+ onChange={(event, value) => {
+ field.onChange(value ? value.id : null);
+ }}
+ renderInput={(params) => (
+ <TextField
+ {...params}
+ label="鐩爣绔欑偣"
+ error={!!fieldState.error}
+ helperText={fieldState.error?.message}
+ />
+ )}
+ />
+ );
+ }}
/>
</Grid>
)}
--
Gitblit v1.9.1