From 7f856cffb0b9f1ea2c6dadf609ace9e8ecc53779 Mon Sep 17 00:00:00 2001 From: wjh Date: Fri, 15 Mar 2024 20:15:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E8=A1=A5=E5=85=A8=E7=AD=9B=E9=80=89=E5=A4=B1=E6=95=88=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/schema-components/AutoComplete/AutoComplete.tsx | 5 ++--- .../src/client/schema-components/select/Select.tsx | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/plugins/@hera/plugin-core/src/client/schema-components/AutoComplete/AutoComplete.tsx b/packages/plugins/@hera/plugin-core/src/client/schema-components/AutoComplete/AutoComplete.tsx index d3cab0e46..9956c56cd 100644 --- a/packages/plugins/@hera/plugin-core/src/client/schema-components/AutoComplete/AutoComplete.tsx +++ b/packages/plugins/@hera/plugin-core/src/client/schema-components/AutoComplete/AutoComplete.tsx @@ -8,7 +8,6 @@ export const AutoComplete = (props) => { const fieldSchema = useFieldSchema(); const { fieldNames } = fieldSchema['x-component-props']; const fieldFilter = fieldSchema['x-component-props']['params']; - const filter = fieldFilter ? JSON.stringify(fieldFilter.filter) : {}; const [defultValue, setDefultValue] = useState([]); const api = useAPIClient(); const [options, setOptions] = useState([]); @@ -24,7 +23,7 @@ export const AutoComplete = (props) => { }, }); changLable(defultOptions?.data?.data); - }, [filter]); + }, [fieldFilter?.filter]); useEffect(() => { changLable(defultValue); @@ -45,7 +44,7 @@ export const AutoComplete = (props) => { } const onSearch = (data) => { if (data) { - const searchValue = defultValue.filter((item) => item[fieldNames.label].includes(data)); + const searchValue = defultValue.filter((item) => item.label.includes(data)); if (searchValue.length) { setOptions(searchValue); } else { diff --git a/packages/plugins/@hera/plugin-core/src/client/schema-components/select/Select.tsx b/packages/plugins/@hera/plugin-core/src/client/schema-components/select/Select.tsx index 10afa87b8..86cf80953 100644 --- a/packages/plugins/@hera/plugin-core/src/client/schema-components/select/Select.tsx +++ b/packages/plugins/@hera/plugin-core/src/client/schema-components/select/Select.tsx @@ -26,7 +26,6 @@ const ObjectSelect = (props: Props) => { const fieldSchema = useFieldSchema(); const collectionName = fieldSchema['collectionName']; const filterField = fieldSchema['x-component-props']['params']; - const filter = filterField ? JSON.stringify(filterField.filter) : {}; const api = useAPIClient(); useAsyncEffect(async () => { if (collectionName) { @@ -39,7 +38,7 @@ const ObjectSelect = (props: Props) => { }); setDefOptions(defValue?.data?.data); } - }, [filter]); + }, [filterField?.filter]); const toValue = (v: any) => { if (isEmptyObject(v)) { return;