Commit 0ff2cb5a by 陈超

T

parent 889a4d9b
......@@ -175,8 +175,11 @@
let that = this
that.showPicker = true
if(that.selected.length == 0) {
that.loading = true
that.getCity(that.columns[0].id)
let p = that.columns[0]
if(p.children.length == 0) {
that.loading = true
that.getCity(p.id)
}
}
},
onAreaConfirm: function(r, values) {
......@@ -194,15 +197,44 @@
//Helper
getCity: function(id) {
let that = this
$.ajax({
type:'POST',
url:"{:U('home/User/getAreaList')}",
data: { id: id },
dataType:'json',
success:function(res){
console.log(res)
that.loading = false
if(res.status == 1) {
let found = that.columns.filter(r => { return r.id == id })
if(found.length > 0) {
let province = found[0]
province.children = res.data.map( r => { text: r.title, id: r.area_id, children: [] })
if(province.children.length > 0) {
that.getArea(province, province.children[0].id)
}
}
}
}
});
})
},
getArea: function(p, id) {
let that = this
$.ajax({
type:'POST',
url:"{:U('home/User/getAreaList')}",
data:{ id: id },
dataType:'json',
success:function(res){
if(res.status == 1) {
let found = p.children.filter( r => { return r.id == id })
if(found.length > 0) {
let city = found[0]
city.children = res.data.map( r => { text: r.title, id: r.area_id })
}
}
}
})
}
}
})
......
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