#
luxiaotao1123
2024-10-11 d0628b492a779097b0569c2e29fde5ba91632b42
#
1个文件已修改
18 ■■■■ 已修改文件
zy-acs-flow/src/map/settings/CopyDrawer.jsx 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/src/map/settings/CopyDrawer.jsx
@@ -1,5 +1,5 @@
import React, { useEffect } from 'react';
import { useForm, Controller } from 'react-hook-form';
import { useForm, useWatch, Controller } from 'react-hook-form';
import {
    Box,
    Grid,
@@ -15,7 +15,6 @@
    Divider,
    Drawer,
    IconButton,
    LinearProgress,
    Switch,
    FormControlLabel,
    FormLabel,
@@ -64,16 +63,18 @@
        },
    });
    const autoIncrement = useWatch({ control, name: 'autoIncrement' });
    const incrementValue = useWatch({ control, name: 'incrementValue' });
    useEffect(() => {
        if (watch('autoIncrement') && incrementOptions && incrementOptions.length > 0) {
            const currentIncrementValue = watch('incrementValue');
            if (!currentIncrementValue) {
        if (autoIncrement && incrementOptions && incrementOptions.length > 0) {
            if (!incrementValue) {
                setValue('incrementValue', incrementOptions[0].value);
            }
        } else {
            setValue('incrementValue', undefined);
        }
    }, [watch('autoIncrement'), incrementOptions, setValue, watch]);
    }, [autoIncrement, incrementOptions, setValue]);
    useEffect(() => {
        if (sprite && value && Object.keys(value).length > 0) {
@@ -95,7 +96,6 @@
    const onFormSubmit = (data) => {
        if (data) {
            console.log(data);
        }
        if (handleOnCopy) {
            handleOnCopy(data);
@@ -203,7 +203,7 @@
                                        />
                                    </Grid>
                                    {(!!incrementOptions?.length && watch('autoIncrement')) && (
                                    {(!!incrementOptions?.length && autoIncrement) && (
                                        <Grid item xs={12}>
                                            <FormControl fullWidth>
                                                <FormLabel sx={{ mb: 1 }}>
@@ -234,7 +234,7 @@
                                        </Grid>
                                    )}
                                    {watch('autoIncrement') && (
                                    {autoIncrement && (
                                        <Grid item xs={12}>
                                            <FormControl fullWidth>
                                                <FormLabel sx={{