fix(table): 使用lodash 的merge来递归assign,优化在多对象嵌套情况下的结构 (#1350)
This commit is contained in:
parent
49c890ebec
commit
59b309aa7e
|
|
@ -14,7 +14,7 @@ import {
|
||||||
import { useTimeoutFn } from '/@/hooks/core/useTimeout';
|
import { useTimeoutFn } from '/@/hooks/core/useTimeout';
|
||||||
import { buildUUID } from '/@/utils/uuid';
|
import { buildUUID } from '/@/utils/uuid';
|
||||||
import { isFunction, isBoolean } from '/@/utils/is';
|
import { isFunction, isBoolean } from '/@/utils/is';
|
||||||
import { get, cloneDeep } from 'lodash-es';
|
import { get, cloneDeep, merge } from 'lodash-es';
|
||||||
import { FETCH_SETTING, ROW_KEY, PAGE_SIZE } from '../const';
|
import { FETCH_SETTING, ROW_KEY, PAGE_SIZE } from '../const';
|
||||||
|
|
||||||
interface ActionType {
|
interface ActionType {
|
||||||
|
|
@ -272,17 +272,17 @@ export function useDataSource(
|
||||||
|
|
||||||
const { sortInfo = {}, filterInfo } = searchState;
|
const { sortInfo = {}, filterInfo } = searchState;
|
||||||
|
|
||||||
let params: Recordable = {
|
let params: Recordable = merge(
|
||||||
...pageParams,
|
pageParams,
|
||||||
...(useSearchForm ? getFieldsValue() : {}),
|
useSearchForm ? getFieldsValue() : {},
|
||||||
...searchInfo,
|
searchInfo,
|
||||||
...(opt?.searchInfo ?? {}),
|
opt?.searchInfo ?? {},
|
||||||
...defSort,
|
defSort,
|
||||||
...sortInfo,
|
sortInfo,
|
||||||
...filterInfo,
|
filterInfo,
|
||||||
...(opt?.sortInfo ?? {}),
|
opt?.sortInfo ?? {},
|
||||||
...(opt?.filterInfo ?? {}),
|
opt?.filterInfo ?? {},
|
||||||
};
|
);
|
||||||
if (beforeFetch && isFunction(beforeFetch)) {
|
if (beforeFetch && isFunction(beforeFetch)) {
|
||||||
params = (await beforeFetch(params)) || params;
|
params = (await beforeFetch(params)) || params;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue