fix(PersonPickerField): 移除前端额外过滤避免误筛有效人员数据
移除不再使用的 filterPersonListByType 过滤函数,调整搜索结果处理逻辑,直接使用接口返回数据不再进行二次过滤,解决有效人员数据被误筛的问题。
Showing
1 changed file
with
2 additions
and
26 deletions
| ... | @@ -291,30 +291,6 @@ const getSearchType = () => { | ... | @@ -291,30 +291,6 @@ const getSearchType = () => { |
| 291 | }; | 291 | }; |
| 292 | 292 | ||
| 293 | /** | 293 | /** |
| 294 | - * 将结果列表限制在字段允许的类型范围内,同时叠加当前顶部筛选值。 | ||
| 295 | - * | ||
| 296 | - * @param {Array} personList 人员结果列表 | ||
| 297 | - * @returns {Array} | ||
| 298 | - */ | ||
| 299 | -const filterPersonListByType = (personList) => { | ||
| 300 | - const searchType = getSearchType(); | ||
| 301 | - | ||
| 302 | - return personList.filter((person) => { | ||
| 303 | - const allowedTypeValues = allowedPersonTypes.value.map((item) => item.value); | ||
| 304 | - | ||
| 305 | - if (allowedTypeValues.length && !allowedTypeValues.includes(person.type)) { | ||
| 306 | - return false; | ||
| 307 | - } | ||
| 308 | - | ||
| 309 | - if (searchType && person.type !== searchType) { | ||
| 310 | - return false; | ||
| 311 | - } | ||
| 312 | - | ||
| 313 | - return true; | ||
| 314 | - }); | ||
| 315 | -}; | ||
| 316 | - | ||
| 317 | -/** | ||
| 318 | * 根据当前草稿已选项回填搜索结果勾选状态,保证翻页后勾选表现一致。 | 294 | * 根据当前草稿已选项回填搜索结果勾选状态,保证翻页后勾选表现一致。 |
| 319 | */ | 295 | */ |
| 320 | const syncSearchChecked = () => { | 296 | const syncSearchChecked = () => { |
| ... | @@ -420,7 +396,6 @@ const onSelectSearchType = async (action) => { | ... | @@ -420,7 +396,6 @@ const onSelectSearchType = async (action) => { |
| 420 | * 组装人员搜索接口参数。 | 396 | * 组装人员搜索接口参数。 |
| 421 | * | 397 | * |
| 422 | * @param {number} page 页码,从 0 开始 | 398 | * @param {number} page 页码,从 0 开始 |
| 423 | - * @param {string} searchType 本次请求对应的人员类型 | ||
| 424 | * @returns {{ form_code: string, field_name: string, keyword: string, page: number, limit: number, type?: string, force_back?: string }} | 399 | * @returns {{ form_code: string, field_name: string, keyword: string, page: number, limit: number, type?: string, force_back?: string }} |
| 425 | */ | 400 | */ |
| 426 | const buildSearchParams = (page) => { | 401 | const buildSearchParams = (page) => { |
| ... | @@ -455,7 +430,8 @@ const fetchSearchPage = async (page) => { | ... | @@ -455,7 +430,8 @@ const fetchSearchPage = async (page) => { |
| 455 | }; | 430 | }; |
| 456 | } | 431 | } |
| 457 | 432 | ||
| 458 | - const remoteResults = filterPersonListByType(result.data.map(mapPersonRecord)); | 433 | + // 搜索结果以接口返回为准,前端不再额外按 person_types 二次过滤,避免把有效数据误筛掉。 |
| 434 | + const remoteResults = result.data.map(mapPersonRecord); | ||
| 459 | 435 | ||
| 460 | return { | 436 | return { |
| 461 | count: Number(result.count) || remoteResults.length, | 437 | count: Number(result.count) || remoteResults.length, | ... | ... |
-
Please register or login to post a comment