|
|
@ -80,7 +80,7 @@ |
|
|
|
if(region.join('')!==oldRegion.join('')){ |
|
|
|
if(region.join('')!==oldRegion.join('')){ |
|
|
|
this.handleDefaultRegion(region) |
|
|
|
this.handleDefaultRegion(region) |
|
|
|
} |
|
|
|
} |
|
|
|
}else if(region&®ion.length == 6){ |
|
|
|
}else if(region){ //&®ion.length == 6 |
|
|
|
this.handleDefaultRegion(region) |
|
|
|
this.handleDefaultRegion(region) |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
console.log(region) |
|
|
|
console.log(region) |
|
|
@ -108,7 +108,7 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
handleColumnChange(e){ |
|
|
|
handleColumnChange(e){ |
|
|
|
// console.log(e); |
|
|
|
console.log(e,"change"); |
|
|
|
this.isInitMultiArray = false; |
|
|
|
this.isInitMultiArray = false; |
|
|
|
const that = this; |
|
|
|
const that = this; |
|
|
|
let col = e.detail.column; |
|
|
|
let col = e.detail.column; |
|
|
@ -117,14 +117,18 @@ |
|
|
|
try{ |
|
|
|
try{ |
|
|
|
switch(col){ |
|
|
|
switch(col){ |
|
|
|
case 0: |
|
|
|
case 0: |
|
|
|
|
|
|
|
that.multiIndex[1]=0; |
|
|
|
|
|
|
|
that.multiIndex[2]=0; |
|
|
|
if(this.CHINA_REGIONS[that.multiIndex[0]].childs.length==0){ |
|
|
|
if(this.CHINA_REGIONS[that.multiIndex[0]].childs.length==0){ |
|
|
|
that.cityArr = that.districtArr = [this.CHINA_REGIONS[that.multiIndex[0]]] |
|
|
|
that.cityArr = that.districtArr = [this.CHINA_REGIONS[that.multiIndex[0]]] |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
that.cityArr = this.CHINA_REGIONS[that.multiIndex[0]].childs |
|
|
|
that.cityArr = this.CHINA_REGIONS[that.multiIndex[0]].childs |
|
|
|
that.districtArr = this.CHINA_REGIONS[that.multiIndex[0]].childs[that.multiIndex[1]].childs |
|
|
|
that.districtArr = this.CHINA_REGIONS[that.multiIndex[0]].childs[that.multiIndex[1]].childs |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 1: |
|
|
|
case 1: |
|
|
|
|
|
|
|
that.multiIndex[2]=0; |
|
|
|
that.districtArr = this.CHINA_REGIONS[that.multiIndex[0]].childs[that.multiIndex[1]].childs |
|
|
|
that.districtArr = this.CHINA_REGIONS[that.multiIndex[0]].childs[that.multiIndex[1]].childs |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
case 2: |
|
|
@ -145,17 +149,29 @@ |
|
|
|
this.$emit('getRegion',address) |
|
|
|
this.$emit('getRegion',address) |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleDefaultRegion(region){ |
|
|
|
handleDefaultRegion(region){ |
|
|
|
|
|
|
|
// console.log(region) |
|
|
|
const isCode = !Array.isArray(region) |
|
|
|
const isCode = !Array.isArray(region) |
|
|
|
this.isInitMultiArray = false; |
|
|
|
this.isInitMultiArray = false; |
|
|
|
let children = this.CHINA_REGIONS |
|
|
|
let children = this.CHINA_REGIONS |
|
|
|
for(let i=0;i<3;i++){ |
|
|
|
for(let i=0;i<3;i++){ |
|
|
|
for(let j=0;j<children.length;j++){ |
|
|
|
for(let j=0;j<children.length;j++){ |
|
|
|
let condition = isCode?String(children[j].code).slice(0,(i+1)*2)==region.slice(0,(i+1)*2):children[j].name.includes(region[i]); |
|
|
|
let condition; |
|
|
|
// console.log(String(children[j].code).slice(0,(i+1)*2),region.slice(0,(i+1)*2)) |
|
|
|
if(i==2){ |
|
|
|
|
|
|
|
condition = isCode?String(children[j].code).slice(0)==region.slice(0):children[j].name.includes(region[i]); |
|
|
|
|
|
|
|
// console.log(String(children[j].code).slice(0),region.slice(0)) |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
condition = isCode?String(children[j].code).slice(0,(i+1)*2)==region.slice(0,(i+1)*2):children[j].name.includes(region[i]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(condition){ |
|
|
|
if(condition){ |
|
|
|
// 匹配成功进行赋值 |
|
|
|
// 匹配成功进行赋值 |
|
|
|
// console.log(i,j,children.length-1); |
|
|
|
// console.log(i,j,children.length-1); |
|
|
|
|
|
|
|
// children = children[j].childs; |
|
|
|
|
|
|
|
if(children[j].childs&&children[j].childs.length>0){ |
|
|
|
children = children[j].childs; |
|
|
|
children = children[j].childs; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
console.log(children,"children") |
|
|
|
if(i==0){ |
|
|
|
if(i==0){ |
|
|
|
this.cityArr = children |
|
|
|
this.cityArr = children |
|
|
|
}else if(i==1){ |
|
|
|
}else if(i==1){ |
|
|
|