zjj
2025-05-23 48ad97c8a8afa2c9333bd00545dbc54bb4f0870a
rsf-admin/src/page/components/TreeSelectInput.jsx
@@ -5,9 +5,9 @@
import * as Common from '@/utils/common';
import { useFormContext } from 'react-hook-form';
const TreeSelectInput = ({ resource, onChange, label, source = 'parentId', value, isTranslate = false, ...rest }) => {
const TreeSelectInput = ({ resource, required, onChange, label, source = 'parentId', value, isTranslate = false, ...rest }) => {
    const translate = useTranslate();
    const { setValue } = useFormContext();
    const form = useFormContext();
    const [filter, setFilter] = React.useState("");
    const [treeData, setTreeData] = React.useState([]);
@@ -34,7 +34,7 @@
    const handleChange = (event) => {
        const val = event.target.value;
        setProxyVal(val);
        setValue(source, val, {
        form?.setValue(source, val, {
            shouldValidate: true,
            shouldDirty: true,
        });
@@ -42,7 +42,7 @@
    };
    return (
        <FormControl fullWidth>
        <FormControl fullWidth required={required}>
            <InputLabel>{translate(label)}</InputLabel>
            <Select
                value={proxyVal || ''}