Browse Source

change: cargo船货凑期.尝试处理搜索数据为空的问题.

peter 1 tháng trước cách đây
mục cha
commit
097c2d122f
1 tập tin đã thay đổi với 8 bổ sung3 xóa
  1. 8 3
      src/pages/cargo-consolidation-request/index.vue

+ 8 - 3
src/pages/cargo-consolidation-request/index.vue

@@ -1100,13 +1100,18 @@ const search = (keyword: string) => {
   })
     .then((res: any) => {
       if (Array.isArray(res.data) && res.data.length) {
-        qcList.value = qcList.value.concat(
-          res.data.map((i: any) => {
+        qcList.value = res.data
+          .map((i: any) => {
             return {
               ...i,
               isSearch: true,
             }
-          }),
+          })
+          .concat(qcList.value)
+        // 给qcList去重
+        qcList.value = qcList.value.filter(
+          (item, index, self) =>
+            index === self.findIndex((t) => t.id === item.id),
         )
       } else {
         // qcList.value = []