hookehuyr

fix(PersonPickerField): 移除前端额外过滤避免误筛有效人员数据

移除不再使用的 filterPersonListByType 过滤函数,调整搜索结果处理逻辑,直接使用接口返回数据不再进行二次过滤,解决有效人员数据被误筛的问题。
......@@ -291,30 +291,6 @@ const getSearchType = () => {
};
/**
* 将结果列表限制在字段允许的类型范围内,同时叠加当前顶部筛选值。
*
* @param {Array} personList 人员结果列表
* @returns {Array}
*/
const filterPersonListByType = (personList) => {
const searchType = getSearchType();
return personList.filter((person) => {
const allowedTypeValues = allowedPersonTypes.value.map((item) => item.value);
if (allowedTypeValues.length && !allowedTypeValues.includes(person.type)) {
return false;
}
if (searchType && person.type !== searchType) {
return false;
}
return true;
});
};
/**
* 根据当前草稿已选项回填搜索结果勾选状态,保证翻页后勾选表现一致。
*/
const syncSearchChecked = () => {
......@@ -420,7 +396,6 @@ const onSelectSearchType = async (action) => {
* 组装人员搜索接口参数。
*
* @param {number} page 页码,从 0 开始
* @param {string} searchType 本次请求对应的人员类型
* @returns {{ form_code: string, field_name: string, keyword: string, page: number, limit: number, type?: string, force_back?: string }}
*/
const buildSearchParams = (page) => {
......@@ -455,7 +430,8 @@ const fetchSearchPage = async (page) => {
};
}
const remoteResults = filterPersonListByType(result.data.map(mapPersonRecord));
// 搜索结果以接口返回为准,前端不再额外按 person_types 二次过滤,避免把有效数据误筛掉。
const remoteResults = result.data.map(mapPersonRecord);
return {
count: Number(result.count) || remoteResults.length,
......