Skip to content

Commit

Permalink
解决lookup字段弹出列表搜索时,使用表头排序、刷新按钮等还是有机率出现crud接口使用上次设置的过滤条件请求接口的异常情况
Browse files Browse the repository at this point in the history
  • Loading branch information
yinlianghui committed Jan 13, 2025
1 parent 6ce49e0 commit dc6f500
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,20 @@ export async function lookupToAmisPicker(field, readonly, ctx){
});
payload.data.rows = updatedResult;
}
let __changedFilterFormValuesKey = "__changedFilterFormValues";
let __lookupField = api.data.$self.__lookupField;
if(__lookupField){
let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
if(__lookupField.reference_to_field){
lookupTag += "__" + __lookupField.reference_to_field;
}
__changedFilterFormValuesKey += lookupTag;
}
let __changedFilterFormValues = api.context[__changedFilterFormValuesKey] || {};
let __changedSearchBoxValues = api.context.__changedSearchBoxValues || {};
// 列表搜索和快速搜索,有时在某些操作情况下还是会造成crud接口请求使用的过滤条件是上次的,这里强制把正确的过滤条件返回到crud,详细规则见:https://github.com/steedos/steedos-platform/issues/7112
payload.data[__changedFilterFormValuesKey] = __changedFilterFormValues;
payload.data.__changedSearchBoxValues = __changedSearchBoxValues;
return payload;
`;
if(field.optionsFunction || field._optionsFunction){
Expand Down

0 comments on commit dc6f500

Please sign in to comment.