소스 검색

fix: 过滤异常数据返回

lixuan 2 달 전
부모
커밋
433be1fe05
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      src/views/production-safety/risk-identification-and-control/labor-products-purchase-apply-manage/list.vue

+ 2 - 1
src/views/production-safety/risk-identification-and-control/labor-products-purchase-apply-manage/list.vue

@@ -170,7 +170,8 @@
         total?: number
       });
       if (resWithExtra) {
-        tableData.value = (resWithExtra?.records ?? resWithExtra?.list ?? []) as PpePurchaseApply[];
+        const rawList = (resWithExtra?.records ?? resWithExtra?.list ?? []) as (PpePurchaseApply | null)[];
+        tableData.value = rawList.filter((item): item is PpePurchaseApply => item !== null);
         pagination.total = resWithExtra?.totalRow ?? resWithExtra?.total ?? 0;
       }
     } catch (e) {