Ver código fonte

Merge branch 'dev/v1.0.53_yf' of jianyu/web into feature/v1.0.53

yangfeng 1 ano atrás
pai
commit
ab7e3fdfde

+ 7 - 4
apps/bigmember_pc/src/components/filter-items/CascadeContent.vue

@@ -269,10 +269,12 @@ export default {
       this.firstList.forEach(item => {
         for (const key in levelMap) {
           if (key === item.name) {
+            // 一级分类下无二级分类的情况
             if (levelMap[key].length === 0) {
-              item.children.filter(n => !n.all).forEach(v => {
-                levelArray.push(`${key}_${v}`)
-              })
+              // item.children.filter(n => !n.all).forEach(v => {
+              //   levelArray.push(`${key}_${v}`)
+              // })
+              levelArray.push(key)
             } else {
               levelMap[key].forEach(v => {
                 levelArray.push(`${key}_${v}`)
@@ -355,7 +357,8 @@ export default {
           })
           const allChild = item.children.filter(child => !child.all)
           const checkedChild = item.children.filter(child => !child.all && child.checked)
-          item.checked = allChild.length === checkedChild.length
+          const onlyAllChild = item.children.filter(child => child.all && child.checked)
+          item.checked = onlyAllChild.length === 1 || allChild.length > 0 && allChild.length === checkedChild.length
           item.indeterminate = checkedChild.length > 0 && allChild.length !== checkedChild.length
         })
         this.checkFirstAllStatus()

+ 17 - 4
apps/bigmember_pc/src/utils/format/search-bid-filter.js

@@ -214,7 +214,15 @@ export class FilterHistoryAjaxModel2ViewModel {
       if (industry[key].length === calcChildrenCount[key]) {
         industryText.push(key)
       } else {
-        industryText = [...industryText, ...industry[key]]
+        // P510延申需求:因数据源二级分类都加上的“其他”,为了做区分,如果二级分类中有“其他” 显示的时候要拼上一级分类, 没有“其他”的还按原来需求只显示二级分类
+        const industryArr = industry[key].map((item) => {
+          if (item === '其他') {
+            return `${key}_${item}`
+          } else {
+            return item
+          }
+        })
+        industryText = [...industryText, ...industryArr]
       }
     }
     if (industryText.length) {
@@ -572,9 +580,14 @@ export class FilterHistoryViewModel2AjaxModel {
 
     for (const key in val) {
       if (Array.isArray(val[key])) {
-        val[key].forEach((item) => {
-          industryArr.push(`${key}_${item}`)
-        })
+        if (val[key].length) {
+          val[key].forEach((item) => {
+            industryArr.push(`${key}_${item}`)
+          })
+        } else {
+          // 因数据源中增加了一级分类“其他”  因此一级分类下无二级分类的情况 需要把一级分类添加进去
+          industryArr.push(`${key}`)
+        }
       }
     }