From 5fd8139767026f6ab86d8a6fcf3fe796f8555723 Mon Sep 17 00:00:00 2001 From: chenos Date: Sun, 13 Dec 2020 00:09:25 +0800 Subject: [PATCH] improve filter & sort... --- packages/app/src/api-client.ts | 5 ++- .../components/form.fields/filter/index.tsx | 24 +++++++++- .../src/components/form.fields/registry.ts | 5 ++- .../src/components/views/Form/DrawerForm.tsx | 4 +- .../app/src/components/views/SimpleTable.tsx | 17 ++++--- .../components/views/SortableTable/index.tsx | 3 +- packages/app/src/components/views/Table.tsx | 14 +++--- packages/app/src/components/views/index.tsx | 8 +++- .../src/collections/actions.ts | 11 ++--- .../src/collections/collections.ts | 3 +- .../src/collections/fields.ts | 13 +++--- .../src/collections/tabs.ts | 12 ++--- .../src/collections/views.ts | 30 +++++++++---- .../plugin-collections/src/models/base.ts | 8 +++- packages/plugin-pages/src/actions/getView.ts | 44 +++++++++++++++---- 15 files changed, 134 insertions(+), 67 deletions(-) diff --git a/packages/app/src/api-client.ts b/packages/app/src/api-client.ts index bd25be8a9..e9848e2d6 100644 --- a/packages/app/src/api-client.ts +++ b/packages/app/src/api-client.ts @@ -1,3 +1,4 @@ +import { values } from 'lodash'; import { stringify } from 'querystring'; import { request } from 'umi'; @@ -28,7 +29,7 @@ class ApiClient { const proxy: any = new Proxy({}, { get(target, method, receiver) { return (params: ActionParams = {}) => { - let { associatedKey, resourceKey, filter, sorter, sort = [], ...restParams } = params; + let { associatedKey, resourceKey, filter, sorter, sort = [], values, ...restParams } = params; let url = `/${name}`; sort = sort || []; let options: any = { @@ -39,7 +40,7 @@ class ApiClient { options.params = restParams; } else { options.method = 'post'; - options.data = restParams; + options.data = values; } if (associatedKey) { url = `/${name.split('.').join(`/${associatedKey}/`)}`; diff --git a/packages/app/src/components/form.fields/filter/index.tsx b/packages/app/src/components/form.fields/filter/index.tsx index 2780e5b99..4c25213d4 100644 --- a/packages/app/src/components/form.fields/filter/index.tsx +++ b/packages/app/src/components/form.fields/filter/index.tsx @@ -30,7 +30,7 @@ export function FilterGroup(props: any) { 满足组内 {' '}