Commit 51d6b1da authored by 沈良进's avatar 沈良进

搜索页目的地搜索优化

parent fac1fce5
......@@ -456,6 +456,7 @@ export default {
}
});
this.areaList = jObj.AreaList;
this.areaListJSON = JSON.parse(JSON.stringify(this.areaList))
});
console.log("this.areaList", this.areaList, this.msg)
......@@ -603,17 +604,51 @@ export default {
}
},
changeAddrSearchHandler(v) {
this.areaList.forEach(x => {
x.isShow = x.Name.indexOf(v) != -1;
x.isShowChild = false;
x.SubList.forEach(y => {
y.isShow = y.Name.indexOf(v) != -1;
if (y.isShow) {
x.isShow = true;
x.isShowChild = true;
}
});
});
this.areaListJSONTMP = JSON.parse(JSON.stringify(this.areaListJSON));
this.filterAddress(this.areaListJSON, v);
this.filterAddress2(this.areaListJSON, 1);
this.areaList = this.areaListJSON.filter(item => item.canFilter || item.children.length)
console.log('areaList >>>', this.areaList)
// this.areaList.forEach(x => {
// x.isShow = x.Name.indexOf(v) != -1;
// x.isShowChild = false;
// x.SubList.forEach(y => {
// y.isShow = y.Name.indexOf(v) != -1;
// if (y.isShow) {
// x.isShow = true;
// x.isShowChild = true;
// }
// });
// });
},
filterAddress(addressList, v) {
addressList.forEach(item => {
if(item.Name.indexOf(v) != -1) {
item.canFilter = true
} else {
item.canFilter = false
}
if(item.children && item.children.length) {
this.filterAddress(item.children, v)
}
})
console.log('filterAddress',this.areaListJSON, addressList)
},
filterAddress2(addressList, index) {
if(index === 2) {
addressList.forEach(item => {
if(item.children && item.children.length) {
item.children = item.children.filter(i => i.canFilter)
}
})
}
addressList.forEach(item => {
if(item.children && item.children.length) {
this.filterAddress2(item.children, 2)
}
})
console.log('filterAddress2',this.areaListJSON, addressList)
},
goSearchHandler() {
this.msg.webSiteCategoryIds = this.ticked.join(',')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment