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

搜索页目的地搜索优化

parent fac1fce5
...@@ -456,6 +456,7 @@ export default { ...@@ -456,6 +456,7 @@ export default {
} }
}); });
this.areaList = jObj.AreaList; this.areaList = jObj.AreaList;
this.areaListJSON = JSON.parse(JSON.stringify(this.areaList))
}); });
console.log("this.areaList", this.areaList, this.msg) console.log("this.areaList", this.areaList, this.msg)
...@@ -603,17 +604,51 @@ export default { ...@@ -603,17 +604,51 @@ export default {
} }
}, },
changeAddrSearchHandler(v) { changeAddrSearchHandler(v) {
this.areaList.forEach(x => { this.areaListJSONTMP = JSON.parse(JSON.stringify(this.areaListJSON));
x.isShow = x.Name.indexOf(v) != -1; this.filterAddress(this.areaListJSON, v);
x.isShowChild = false; this.filterAddress2(this.areaListJSON, 1);
x.SubList.forEach(y => { this.areaList = this.areaListJSON.filter(item => item.canFilter || item.children.length)
y.isShow = y.Name.indexOf(v) != -1; console.log('areaList >>>', this.areaList)
if (y.isShow) { // this.areaList.forEach(x => {
x.isShow = true; // x.isShow = x.Name.indexOf(v) != -1;
x.isShowChild = true; // 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() { goSearchHandler() {
this.msg.webSiteCategoryIds = this.ticked.join(',') 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