#
luxiaotao1123
2024-10-18 dcd0b098fe57e1f355f5c178c21402a1d64344a5
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 (
        <>