From f0bcc3aaa31f9658cbed0ef4bcc5b6de486fd903 Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期三, 26 三月 2025 12:32:19 +0800 Subject: [PATCH] 物料上级分组不显示问题修复 --- rsf-admin/src/page/components/TreeSelectInput.jsx | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/rsf-admin/src/page/components/TreeSelectInput.jsx b/rsf-admin/src/page/components/TreeSelectInput.jsx index 4140b94..2c51cc5 100644 --- a/rsf-admin/src/page/components/TreeSelectInput.jsx +++ b/rsf-admin/src/page/components/TreeSelectInput.jsx @@ -5,7 +5,7 @@ import * as Common from '@/utils/common'; import { useFormContext } from 'react-hook-form'; -const TreeSelectInput = ({ resource, 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 [filter, setFilter] = React.useState(""); @@ -14,7 +14,7 @@ const [proxyVal, setProxyVal] = React.useState(''); const record = useRecordContext() - const val = value || record[source]; + const val = value || record?.[source]; useEffect(() => { const http = async (resource) => { @@ -38,10 +38,11 @@ shouldValidate: true, shouldDirty: true, }); + onChange(event) }; return ( - <FormControl fullWidth> + <FormControl fullWidth required={required}> <InputLabel>{translate(label)}</InputLabel> <Select value={proxyVal || ''} -- Gitblit v1.9.1