lilei 1 год назад
Родитель
Сommit
1c71e2cfcb
1 измененных файлов с 24 добавлено и 19 удалено
  1. 24 19
      src/views/dealerManagement/rebateBinding/categoryList.vue

+ 24 - 19
src/views/dealerManagement/rebateBinding/categoryList.vue

@@ -123,6 +123,25 @@ export default {
         }
       }
     },
+    // 筛选数据
+    filterData (data, queryParam) {
+      return data.filter(s => {
+        let cs = true
+        let bs = true
+        const plen = Object.keys(queryParam).length
+        const xi = queryParam.productBrandSn ? 3 : 2
+        bs = queryParam.productBrandSn ? s.productBrandSn == queryParam.productBrandSn : true
+        if (plen == xi) {
+          cs = queryParam.productTypeSn1 == s.productTypeSn1
+        } else if (plen == xi + 1) {
+          cs = queryParam.productTypeSn1 == s.productTypeSn1 && queryParam.productTypeSn2 == s.productTypeSn2
+        } else if (plen == xi + 2) {
+          cs = queryParam.productTypeSn1 == s.productTypeSn1 && queryParam.productTypeSn2 == s.productTypeSn2 && queryParam.productTypeSn3 == s.productTypeSn3
+        }
+        console.log(queryParam, bs, cs, xi, plen)
+        return queryParam.productBrandSn ? bs && cs : cs
+      })
+    },
     // 组装数据
     formatData (listData, queryParam) {
       // 格式化数据
@@ -134,22 +153,9 @@ export default {
         this.checkedDealerSn.push(sup)
         const rebateDealerList = item.rebateDealerList
         // 筛选条件
-        sub = sub.filter(s => {
-          let cs = true
-          let bs = true
-          const plen = Object.keys(queryParam).length
-          const xi = queryParam.productBrandSn ? 3 : 2
-          bs = queryParam.productBrandSn ? s.productBrandSn == queryParam.productBrandSn : true
-          if (plen == xi) {
-            cs = queryParam.productTypeSn1 == s.productTypeSn1
-          } else if (plen == xi + 1) {
-            cs = queryParam.productTypeSn1 == s.productTypeSn1 && queryParam.productTypeSn2 == s.productTypeSn2
-          } else if (plen == xi + 2) {
-            cs = queryParam.productTypeSn1 == s.productTypeSn1 && queryParam.productTypeSn2 == s.productTypeSn2 && queryParam.productTypeSn3 == s.productTypeSn3
-          }
-          console.log(queryParam, bs, cs, xi, plen)
-          return queryParam.productBrandSn ? bs && cs : cs
-        })
+        if (item.rebateScopeList) {
+          sub = this.filterData(sub, queryParam)
+        }
         // 组织展开数据
         sub.map((a, j) => {
           if (j == 0) {
@@ -165,8 +171,7 @@ export default {
         no = no + sub.length
         ret = ret.concat(sub)
       })
-      console.log(ret)
-      this.list = ret
+      return ret
     },
     searchTable (queryParam) {
       this.dataSource = []
@@ -178,7 +183,7 @@ export default {
         this.$emit('loaded', res.data || [])
         this.dataSource = res.data || []
         // 处理数据
-        this.formatData(this.dataSource, queryParam)
+        this.list = this.formatData(this.dataSource, queryParam)
         this.showEmpty = this.dataSource.length <= 0
         this.tableHeight = (this.showEmpty ? 0 : this.maxHeight) + 'px'
         this.spinning = false