diff --git a/packages/client/src/collection-manager/action-hooks.ts b/packages/client/src/collection-manager/action-hooks.ts index b214a8a8d..08686cfc4 100644 --- a/packages/client/src/collection-manager/action-hooks.ts +++ b/packages/client/src/collection-manager/action-hooks.ts @@ -39,12 +39,12 @@ export const useCollectionFilterOptions = (collectionName: string) => { operators: fieldInterface.operators || [], }; return option; - } - fields.forEach(field => { + }; + fields.forEach((field) => { options.push(field2option(field)); }); return options; -} +}; export const useFilterDataSource = (options) => { const { name } = useCollection(); @@ -56,17 +56,20 @@ export const useFilterDataSource = (options) => { }), options, ); -} +}; export const useFilterAction = () => { + const { run, params } = useResourceActionContext(); const form = useForm(); const ctx = useActionContext(); + const [first, ...others] = params; return { async run() { + run({ ...first, filter: form.values.filter }, ...others); ctx.setVisible(false); }, }; -} +}; export const useCreateAction = () => { const form = useForm(); diff --git a/packages/client/src/collection-manager/interfaces/chinaRegion.ts b/packages/client/src/collection-manager/interfaces/chinaRegion.ts index ee03f8d1a..d270d6bc2 100644 --- a/packages/client/src/collection-manager/interfaces/chinaRegion.ts +++ b/packages/client/src/collection-manager/interfaces/chinaRegion.ts @@ -14,6 +14,7 @@ export const chinaRegion: IField = { type: 'belongsToMany', target: 'chinaRegions', targetKey: 'code', + sortBy: 'level', // name, uiSchema: { type: 'array', diff --git a/packages/client/src/collection-manager/interfaces/linkTo.ts b/packages/client/src/collection-manager/interfaces/linkTo.ts index 88b1c48e2..ff95b28e8 100644 --- a/packages/client/src/collection-manager/interfaces/linkTo.ts +++ b/packages/client/src/collection-manager/interfaces/linkTo.ts @@ -13,10 +13,16 @@ export const linkTo: IField = { type: 'belongsToMany', // name, uiSchema: { - type: 'array', // title, 'x-component': 'RecordPicker', - 'x-component-props': {}, + 'x-component-props': { + // mode: 'tags', + multiple: true, + fieldNames: { + label: 'id', + value: 'id', + }, + }, }, }, initialize: (values: any) => { diff --git a/packages/client/src/locale/zh_CN.json b/packages/client/src/locale/zh_CN.json index 51f5f6c69..3f2a24fd8 100644 --- a/packages/client/src/locale/zh_CN.json +++ b/packages/client/src/locale/zh_CN.json @@ -24,6 +24,7 @@ "Icon": "图标", "Group": "分组", "Link": "链接", + "Save conditions": "保存筛选条件", "Edit menu item": "编辑菜单项", "Move to": "移动到", "Insert left": "在左边插入", diff --git a/packages/client/src/schema-component/antd/filter/SaveDefaultValue.tsx b/packages/client/src/schema-component/antd/filter/SaveDefaultValue.tsx index f9c2337b7..c2c7f9482 100644 --- a/packages/client/src/schema-component/antd/filter/SaveDefaultValue.tsx +++ b/packages/client/src/schema-component/antd/filter/SaveDefaultValue.tsx @@ -7,9 +7,12 @@ import { useDesignable } from '../../hooks'; export const SaveDefaultValue = (props) => { const { t } = useTranslation(); - const { dn, refresh } = useDesignable(); + const { designable, dn, refresh } = useDesignable(); const fieldSchema = useFieldSchema(); const form = useForm(); + if (!designable) { + return null; + } return (