fix(app): filter merge
This commit is contained in:
parent
89650750b1
commit
97136c62ba
@ -32,6 +32,7 @@ export function SimpleTable(props: SimpleTableProps) {
|
||||
selectedRowKeys: srk,
|
||||
} = props;
|
||||
const { rowKey = 'id', name: viewName, actionDefaultParams = {}, fields = [], rowViewName, actions = [], paginated = true, defaultPerPage = 10 } = schema;
|
||||
const { filter: defaultFilter = {} } = actionDefaultParams;
|
||||
const { sourceKey = 'id' } = activeTab.field||{};
|
||||
const drawerRef = useRef<any>();
|
||||
const [filterCount, setFilterCount] = useState(0);
|
||||
@ -43,9 +44,15 @@ export function SimpleTable(props: SimpleTableProps) {
|
||||
page: paginated ? current : 1,
|
||||
perPage: paginated ? pageSize : -1,
|
||||
sorter,
|
||||
filter,
|
||||
// filter,
|
||||
viewName,
|
||||
...actionDefaultParams,
|
||||
filter: {
|
||||
and: [
|
||||
defaultFilter,
|
||||
filter,
|
||||
].filter(obj => obj && Object.keys(obj).length)
|
||||
}
|
||||
})
|
||||
.then(({data = [], meta = {}}) => {
|
||||
return {
|
||||
|
@ -34,6 +34,8 @@ export function Table(props: TableProps) {
|
||||
// const { data, mutate } = useRequest(() => api.resource(name).list({
|
||||
// associatedKey,
|
||||
// }));
|
||||
const { filter: defaultFilter = {} } = actionDefaultParams;
|
||||
|
||||
const [filterCount, setFilterCount] = useState(0);
|
||||
const name = associatedName ? `${associatedName}.${resourceName}` : resourceName;
|
||||
const { data, loading, pagination, mutate, refresh, run, params } = useRequest((params = {}, ...args) => {
|
||||
@ -44,9 +46,15 @@ export function Table(props: TableProps) {
|
||||
page: paginated ? current : 1,
|
||||
perPage: paginated ? pageSize : -1,
|
||||
sorter,
|
||||
filter,
|
||||
// filter,
|
||||
viewName,
|
||||
...actionDefaultParams,
|
||||
filter: {
|
||||
and: [
|
||||
defaultFilter,
|
||||
filter,
|
||||
].filter(obj => obj && Object.keys(obj).length)
|
||||
}
|
||||
// ...args2,
|
||||
})
|
||||
.then(({data = [], meta = {}}) => {
|
||||
|
Loading…
Reference in New Issue
Block a user