From dcd0b098fe57e1f355f5c178c21402a1d64344a5 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期五, 18 十月 2024 14:01:17 +0800
Subject: [PATCH] #
---
zy-acs-flow/src/map/insight/agv/AgvControl.jsx | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/zy-acs-flow/src/map/insight/agv/AgvControl.jsx b/zy-acs-flow/src/map/insight/agv/AgvControl.jsx
index 6b98bdd..380835c 100644
--- a/zy-acs-flow/src/map/insight/agv/AgvControl.jsx
+++ b/zy-acs-flow/src/map/insight/agv/AgvControl.jsx
@@ -1,4 +1,4 @@
-import React from 'react';
+import React, { useEffect } from 'react';
import { useTranslate } from "react-admin";
import { useForm, Controller } from 'react-hook-form';
import {
@@ -25,7 +25,7 @@
const theme = useTheme();
const translate = useTranslate();
- const { control, handleSubmit, reset, watch } = useForm({
+ const { control, handleSubmit, reset, watch, setValue } = useForm({
defaultValues: {
taskMode: 'MOVE',
startCode: '',
@@ -46,6 +46,10 @@
{ value: 'STA_TO_LOC', label: translate('page.map.insight.control.type.STA_TO_LOC') },
{ value: 'STA_TO_STA', label: translate('page.map.insight.control.type.STA_TO_STA') },
];
+
+ useEffect(() => {
+ reset();
+ }, [curAgvNo, reset]);
const onSubmit = (data) => {
if (curAgvNo) {
@@ -101,6 +105,15 @@
setInputValue: setEndStaInputValue,
} = useCoolHook('/sta/page', 'staNo');
+ useEffect(() => {
+ const fieldsToClear = ['startCode', 'endCode', 'startLocNo', 'endLocNo', 'startStaNo', 'endStaNo'];
+
+ fieldsToClear.forEach(field => {
+ if (!showField(field)) {
+ setValue(field, '');
+ }
+ });
+ }, [taskMode, setValue, showField]);
return (
<>
--
Gitblit v1.9.1