export const addres2 = {
province_list: {
510000: "四川省",
},
city_list: {
510100: "成都市",
510300: "自贡市",
510400: "攀枝花市",
510500: "泸州市",
510600: "德阳市",
510700: "绵阳市",
510800: "广元市",
510900: "遂宁市",
511000: "内江市",
},
510104: "锦江区",
510105: "青羊区",
510106: "金牛区",
510107: "武侯区",
510108: "成华区",
510112: "龙泉驿区",
510113: "青白江区",
510114: "新都区",
510115: "温江区",
510116: "双流区",
510117: "郫都区",
510121: "金堂县",
510129: "大邑县",
510131: "蒲江县",
510132: "新津县",
510181: "都江堰市",
510182: "彭州市",
510183: "邛崃市",
510184: "崇州市",
}
function getTree(areaList) {
let province_list = Object.keys(areaList.province_list); //省数据
let city_list = Object.keys(areaList.city_list); //市数据
let county_list = Object.keys(areaList.county_list); //区县数据
const tree = province_list.map((province) => ({
text: areaList.province_list[province],
value: province,
children: city_list
.filter((city) => city.slice(0, 2) == province.slice(0, 2))
.map((city) => ({
text: areaList.city_list[city],
value: city,
children: county_list
.filter((county) => county.slice(0, 4) == city.slice(0, 4))
.map((county) => ({
text: areaList.county_list[county],
value: county,
})),
})),
}));
return tree;
}