Commit 425b7917 by 李伟康

feat(dailyNewspaper): 添加子表单品牌和场景代码过滤功能

- 在filter方法中新增对subform类型的处理逻辑
- 为子表单的第一层children添加品牌ID过滤条件
- 为子表单的第一层children添加基础场景代码过滤条件
- 保持原有分组类型的品牌和场景代码过滤功能
- 统一使用链式调用优化过滤器的可读性
1 parent 8f02d8e6
...@@ -221,20 +221,25 @@ export default { ...@@ -221,20 +221,25 @@ export default {
} }
}) })
.filter(item => { .filter(item => {
if (item.type == 'subform' && item.children.length) {
item.children[0] = item.children[0].filter(child => {
return child.brandId?.length ? hasCommonElement(child.brandId, CAR_BRAND_ID) : true
}).filter(child => {
return child.baseSceneCode?.length ? hasCommonElement(child.baseSceneCode, BASE_SCENE_CODE) : true
})
}
if (item.type == 'group' && item.children.length) { if (item.type == 'group' && item.children.length) {
item.children = item.children item.children = item.children.filter(child => {
.filter(child => { // 品牌过滤
// 品牌过滤 if (child.filterBrandId && child.filterBrandId.length) {
if (child.filterBrandId && child.filterBrandId.length) { return !isSubset(child.filterBrandId, CAR_BRAND_ID)
return !isSubset(child.filterBrandId, CAR_BRAND_ID) } else {
} else { return child.brandId?.length ? hasCommonElement(child.brandId, CAR_BRAND_ID) : true
return child.brandId?.length ? hasCommonElement(child.brandId, CAR_BRAND_ID) : true }
} }).filter(child => {
}) // 基础场景代码过滤
.filter(child => { return child.baseSceneCode.length ? hasCommonElement(child.baseSceneCode, BASE_SCENE_CODE) : true
// 基础场景代码过滤 })
return child.baseSceneCode.length ? hasCommonElement(child.baseSceneCode, BASE_SCENE_CODE) : true
})
} }
// 基础场景代码过滤 // 基础场景代码过滤
if (item.type == 'divider') { if (item.type == 'divider') {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!