#
luxiaotao1123
2024-10-11 46f3a1367b818ab115e9dcaf87d78bef3d3e5790
#
1个文件已修改
26 ■■■■ 已修改文件
zy-acs-flow/src/map/settings/CopyDrawer.jsx 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/src/map/settings/CopyDrawer.jsx
@@ -62,7 +62,7 @@
    const deviceType = sprite?.data?.type;
    const incrementOptions = incrementOptionsMap[deviceType]
    const { control, handleSubmit, reset, watch, setValue } = useForm({
    const { control, handleSubmit, reset, watch, setValue, formState: { errors } } = useForm({
        defaultValues: getDefaultFormValues(value),
    });
@@ -89,13 +89,21 @@
        onCancel();
    }
    const validateIncrement = (value) => {
        if (!value) {
            return true;
        }
        if (deviceType === DEVICE_TYPE.SHELF) {
            if (!sprite?.data?.row || !sprite?.data?.bay) {
                return 'Row or Bay value is required for SHELF device type.';
            }
        }
        return true;
    };
    const onFormSubmit = (data) => {
        if (data) {
            console.log(data);
        }
        if (handleOnCopy) {
            handleOnCopy(data);
        }
        handleOnCopy?.(data);
        notify.info(translate('common.response.success'));
    };
@@ -184,6 +192,7 @@
                                        <Controller
                                            name="autoIncrement"
                                            control={control}
                                            rules={{ validate: validateIncrement }}
                                            render={({ field }) => (
                                                <FormControlLabel
                                                    control={
@@ -197,6 +206,11 @@
                                                />
                                            )}
                                        />
                                        {errors.autoIncrement && (
                                            <Typography color="error">
                                                {errors.autoIncrement.message}
                                            </Typography>
                                        )}
                                    </Grid>
                                    {(!!incrementOptions?.length && autoIncrement) && (