From a08b45b498798e6aed36e88c2ad1537d073ef6dd Mon Sep 17 00:00:00 2001 From: wjh Date: Tue, 16 Apr 2024 11:02:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dmobile=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E7=B1=BB=E5=9E=8B=E4=B8=8D=E8=83=BD=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E6=83=85=E5=86=B5=20fix=20#723?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://git.daoyoucloud.com/daoyoucloud/tachycode/pulls/725 Co-authored-by: wjh Co-committed-by: wjh --- .changeset/fluffy-jobs-wait.md | 5 +++++ .../components/field-item/TabSearchFieldItemProps.ts | 5 ++--- .../components/field-item/TabSerachFieldItemRelatedProps.tsx | 5 ++++- .../tab-search/settings/TabSearchItemFieldSettings.tsx | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 .changeset/fluffy-jobs-wait.md diff --git a/.changeset/fluffy-jobs-wait.md b/.changeset/fluffy-jobs-wait.md new file mode 100644 index 000000000..201660ec1 --- /dev/null +++ b/.changeset/fluffy-jobs-wait.md @@ -0,0 +1,5 @@ +--- +"@hera/plugin-mobile": patch +--- + +修复选择不能用的情况 diff --git a/packages/plugins/@hera/plugin-mobile/src/client/schma-component/tab-search/components/field-item/TabSearchFieldItemProps.ts b/packages/plugins/@hera/plugin-mobile/src/client/schma-component/tab-search/components/field-item/TabSearchFieldItemProps.ts index f66f51b10..a25029414 100644 --- a/packages/plugins/@hera/plugin-mobile/src/client/schma-component/tab-search/components/field-item/TabSearchFieldItemProps.ts +++ b/packages/plugins/@hera/plugin-mobile/src/client/schma-component/tab-search/components/field-item/TabSearchFieldItemProps.ts @@ -21,7 +21,7 @@ export const useTabSearchFieldItemProps = () => { result.labelKey = fieldSchema['x-component-props']?.fieldNames?.label || result.valueKey; const fieldInterface = fieldSchema['x-component-props'].interface; if (canBeOptionalField(fieldInterface)) { - const field = optionalFieldList.find((field) => field.fieldName === fieldSchema['fieldName']); + const field = optionalFieldList.find((field) => field.name === fieldSchema['fieldName']); const operatorMap = { select: '$in', multipleSelect: '$anyOf', @@ -33,9 +33,8 @@ export const useTabSearchFieldItemProps = () => { result.valueKey = 'value'; result.labelKey = 'label'; result.list = _list; - result.filterKey = `${field.fieldName}.${operatorMap[field.interface]}`; + result.filterKey = `${field.name}.${operatorMap[field.interface]}`; } - return { list: result.list, valueKey: result.valueKey, diff --git a/packages/plugins/@hera/plugin-mobile/src/client/schma-component/tab-search/components/field-item/TabSerachFieldItemRelatedProps.tsx b/packages/plugins/@hera/plugin-mobile/src/client/schma-component/tab-search/components/field-item/TabSerachFieldItemRelatedProps.tsx index 795854e12..d716665de 100644 --- a/packages/plugins/@hera/plugin-mobile/src/client/schma-component/tab-search/components/field-item/TabSerachFieldItemRelatedProps.tsx +++ b/packages/plugins/@hera/plugin-mobile/src/client/schma-component/tab-search/components/field-item/TabSerachFieldItemRelatedProps.tsx @@ -20,7 +20,10 @@ export const useTabSearchFieldItemRelatedProps = () => { const blockProps = { dataSource: 'main' }; const headers = useDataSourceHeaders(blockProps?.dataSource); const cm = useCollectionManager(); - const collectionField = useMemo(() => collection?.getField(fieldSchema.name as any), [collection, fieldSchema.name]); + const collectionField = useMemo( + () => collection?.getField(fieldSchema['fieldName'] as any), + [collection, fieldSchema['fieldName']], + ); const collectionFieldName = collectionField?.name; const fieldInterface = fieldSchema['x-component-props'].interface; const result = { list: null, valueKey: '', labelKey: '', filterKey: '' }; diff --git a/packages/plugins/@hera/plugin-mobile/src/client/schma-component/tab-search/settings/TabSearchItemFieldSettings.tsx b/packages/plugins/@hera/plugin-mobile/src/client/schma-component/tab-search/settings/TabSearchItemFieldSettings.tsx index 99688c8cd..e125ff329 100644 --- a/packages/plugins/@hera/plugin-mobile/src/client/schma-component/tab-search/settings/TabSearchItemFieldSettings.tsx +++ b/packages/plugins/@hera/plugin-mobile/src/client/schma-component/tab-search/settings/TabSearchItemFieldSettings.tsx @@ -75,7 +75,7 @@ export const TabSearchItemFieldSettings = new SchemaSettings({ const fieldCollection = fieldSchema['x-component-props']?.['collectionName']; const correlation = fieldSchema['x-component-props']?.['correlation']; const collectionField = - c.getField(fieldSchema['name']) || + c.getField(fieldSchema['fieldName']) || cm.getCollectionField(fieldSchema['x-collection-field']) || cm.getCollection(fieldCollection + '.' + correlation); const compile = useCompile();