Просмотр исходного кода

Merge branch 'develop_yh39' of http://git.chelingzhu.com/jianguan-web/jg-ocs-html into develop_yh39

chenrui 1 год назад
Родитель
Сommit
2257d5e4df
2 измененных файлов с 62 добавлено и 53 удалено
  1. 61 52
      src/views/dealerManagement/rebateBinding/categoryList.vue
  2. 1 1
      vue.config.js

+ 61 - 52
src/views/dealerManagement/rebateBinding/categoryList.vue

@@ -123,64 +123,73 @@ export default {
         }
       }
     },
-    async searchTable (queryParam) {
-      this.dataSource = []
-      this.list = []
-      this.disabled = true
-      this.spinning = true
-      // 品类列表
-      let listData = await dealerUpsList(queryParam).then(res => res.data)
-      this.$emit('loaded', listData)
-      this.dataSource = listData
-      if (!listData) {
-        listData = []
-      }
+    // 筛选数据
+    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) {
       // 格式化数据
       let ret = []
       let no = 0
-      listData.map((item, i) => {
-        let sub = item.rebateScopeList || [{ productBrandName: null, productTypeName1: null, productTypeName2: null, productTypeName3: null }]
-        const sup = item.rebateDealerList.find(b => b.rebateParentType == 'SUPERIORS')
-        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
-        })
-        // 组织展开数据
-        sub.map((a, j) => {
+      for (let i = 0; i < listData.length; i++) {
+        const item = listData[i]
+        const rebateScopeList = item.rebateScopeList ? this.filterData(item.rebateScopeList, queryParam) : [{ productBrandName: null, productTypeName1: null, productTypeName2: null, productTypeName3: null }]
+        const supDealerList = item.rebateDealerList.find(b => b.rebateParentType == 'SUPERIORS')
+        // this.checkedDealerSn.push(rebateScopeList)
+
+        for (let j = 0; j < rebateScopeList.length; j++) {
+          rebateScopeList[j].no = no + j + 1
           if (j == 0) {
-            a.rowspan = sub.length
+            rebateScopeList[j].rowspan = rebateScopeList.length
           }
-          a.dealerUpsSn = item.dealerUpsSn
-          a.dealerSn = item.dealerSn
-          a.no = no + j + 1
-          a.sup = sup
-          a.superDealerName = sup.parentDealer.dealerName
-          a.rebateDealerList = rebateDealerList
-        })
-        no = no + sub.length
-        ret = ret.concat(sub)
+          rebateScopeList[j].dealerUpsSn = item.dealerUpsSn
+          rebateScopeList[j].dealerSn = item.dealerSn
+
+          if (supDealerList) {
+            // rebateScopeList[j].supDealerList = supDealerList
+            rebateScopeList[j].superDealerName = supDealerList.parentDealer.dealerName
+          }
+          // rebateScopeList[j].rebateDealerList = item.rebateDealerList
+        }
+
+        no = no + rebateScopeList.length
+        ret = ret.concat(rebateScopeList)
+      }
+
+      return ret
+    },
+    searchTable (queryParam) {
+      this.dataSource = []
+      this.list = []
+      this.disabled = true
+      this.spinning = true
+      // 品类列表
+      dealerUpsList(queryParam).then(res => {
+        this.$emit('loaded', res.data || [])
+        this.dataSource = res.data || []
+        // 处理数据
+        this.list = this.formatData(this.dataSource, queryParam)
+        this.showEmpty = this.list.length <= 0
+        this.tableHeight = (this.showEmpty ? 0 : this.maxHeight) + 'px'
+        this.spinning = false
+        this.disabled = false
       })
-      console.log(ret)
-      this.list = ret
-      this.showEmpty = this.list.length <= 0
-      this.tableHeight = (this.showEmpty ? 0 : this.maxHeight) + 'px'
-      this.spinning = false
-      this.disabled = false
     },
     handleEdit (record) {
       const row = this.dataSource.find(item => item.dealerUpsSn == record.dealerUpsSn && item.dealerSn == record.dealerSn)

+ 1 - 1
vue.config.js

@@ -108,7 +108,7 @@ const vueConfig = {
     // If you want to turn on the proxy, please remosve the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        // target: 'http://192.168.2.117/ocs-admin',
+        // target: 'http://192.168.2.103/ocs-admin',
         // target: 'https://t.ocs.360arrow.com/ocs-admin', //  练习
         target: 'https://p.ocs.360arrow.com/ocs-admin', //  预发布
         ws: false,