diff --git a/packages/core/client/src/filter-provider/utils.ts b/packages/core/client/src/filter-provider/utils.ts index 848ef9a6f..e53bf308e 100644 --- a/packages/core/client/src/filter-provider/utils.ts +++ b/packages/core/client/src/filter-provider/utils.ts @@ -83,8 +83,8 @@ export const transformToFilter = ( values = flatten(values, { breakOn({ value, path }) { - // 日期字段的 `$dateBetween` 操作符的值是一个数组,需要特殊处理 - if (operators[path] === '$dateBetween') { + // 下面操作符的值是一个数组,需要特殊处理 + if (['$dateBetween', '$in'].includes(operators[path])) { return true; } diff --git a/packages/core/client/src/schema-component/antd/form-item/SchemaSettingOptions.tsx b/packages/core/client/src/schema-component/antd/form-item/SchemaSettingOptions.tsx index 868f92561..401c8d762 100644 --- a/packages/core/client/src/schema-component/antd/form-item/SchemaSettingOptions.tsx +++ b/packages/core/client/src/schema-component/antd/form-item/SchemaSettingOptions.tsx @@ -525,34 +525,40 @@ export const EditOperator = () => { ['x-uid']: uid, ['x-filter-operators']: storedOperators, }; + let componentProps = {}; // 根据操作符的配置,设置组件的属性 if (operator?.schema?.['x-component']) { _.set(fieldSchema, 'x-component-props.component', operator.schema['x-component']); _.set(field, 'componentProps.component', operator.schema['x-component']); field.reset(); + componentProps = { + component: operator.schema['x-component'], + ...operator.schema['x-component-props'], + }; dn.emit('patch', { schema: { ['x-uid']: fieldSchema['x-uid'], - ['x-component-props']: { - component: operator.schema['x-component'], - }, + ['x-component-props']: componentProps, }, }); } else if (fieldSchema['x-component-props']?.component) { _.set(fieldSchema, 'x-component-props.component', null); _.set(field, 'componentProps.component', null); field.reset(); + componentProps = { + component: null, + ...operator.schema['x-component-props'], + }; dn.emit('patch', { schema: { ['x-uid']: fieldSchema['x-uid'], - ['x-component-props']: { - component: null, - }, + ['x-component-props']: componentProps, }, }); } + field.componentProps = componentProps; dn.emit('patch', { schema, }); diff --git a/packages/core/client/src/schema-component/antd/form-v2/Templates.tsx b/packages/core/client/src/schema-component/antd/form-v2/Templates.tsx index 2380760fb..f76171a02 100644 --- a/packages/core/client/src/schema-component/antd/form-v2/Templates.tsx +++ b/packages/core/client/src/schema-component/antd/form-v2/Templates.tsx @@ -6,11 +6,11 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useAPIClient } from '../../../api-client'; import { findFormBlock } from '../../../block-provider'; +import { useFormBlockContext } from '../../../block-provider/FormBlockProvider'; import { useCollectionManager } from '../../../collection-manager'; import { compatibleDataId } from '../../../schema-settings/DataTemplates/FormDataTemplates'; import { useToken } from '../__builtins__'; import { RemoteSelect } from '../remote-select'; -import { useFormBlockContext } from '../../../block-provider/FormBlockProvider'; export interface ITemplate { config?: { @@ -40,7 +40,6 @@ const useDataTemplates = () => { const { t } = useTranslation(); const { duplicateData } = useFormBlockContext(); const { getCollectionJoinField } = useCollectionManager(); - console.log(useFormBlockContext()); if (duplicateData) { return duplicateData; }