我使用过滤器的后端工作是这样的(例如):
filters = {
"groupOp": "AND",
"rules": [
{
"field": "id",
"op": "equal",
"data": 6
},
{
"field": "partnerId",
"op": "equal",
"data": 446
}
],
"groups": [
{
"groupOp": "AND",
"rules": [
{
"field": "username",
"op": "startswith",
"data": "Alex"
}
],
"groups": []
}
]
}
它适用于持久性过滤器,但不适用于传递给列表组件的用户过滤器。例如:
export const OrdersFilter = (props) => (
<Filter {...props}>
<TextInput label="username" source="username" />
<TextInput label="partnerId" source="partnerId" />
</Filter>
);
因为它是一个键值过滤器,我不明白如何向用户过滤器字段添加其他字段。
或者我如何在@@redux-form/CHANGE 操作后包装 url 更改('@@router/LOCATION_CHANGE')以修改传递给带有过滤字段名称的 url 的原始过滤器:
filter=%7B%22partnerId%22%3A%226%22%7D&order=DESC&page=1&perPage=10'
to
filter={"field": "partnerId","op": "equal","data": 6}&order=DESC&page=1&perPage=10