|
@@ -38,21 +38,21 @@
|
|
|
<a-col span="8">
|
|
|
<a-form-model-item prop="provinceSn">
|
|
|
<a-select id="editAddress-provinceSn" @change="getCityList" v-model="form.provinceSn" placeholder="请选择省">
|
|
|
- <a-select-option v-for="item in addrProvinceList" :value="item.sn" :key="item.sn + 'a'">{{ item.name }}</a-select-option>
|
|
|
+ <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col span="8">
|
|
|
<a-form-model-item prop="citySn">
|
|
|
<a-select id="editAddress-citySn" @change="getAreaList" v-model="form.citySn" placeholder="请选择市">
|
|
|
- <a-select-option v-for="item in addrCityList" :value="item.sn" :key="item.sn + 'b'">{{ item.name }}</a-select-option>
|
|
|
+ <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col span="8">
|
|
|
<a-form-model-item prop="countySn">
|
|
|
<a-select id="editAddress-countySn" @change="areaCharged" v-model="form.countySn" placeholder="请选择区/县">
|
|
|
- <a-select-option v-for="item in addrDistrictList" :value="item.sn" :key="item.sn + 'c'">{{ item.name }}</a-select-option>
|
|
|
+ <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
@@ -156,43 +156,43 @@ export default {
|
|
|
this.addrDistrictList = []
|
|
|
this.form.citySn = undefined
|
|
|
this.form.countySn = undefined
|
|
|
- this.form.provinceName = this.addrProvinceList.find(item => item.sn == val).name
|
|
|
+ this.form.provinceName = this.addrProvinceList.find(item => item.id == val).name
|
|
|
this.getArea('city', val)
|
|
|
},
|
|
|
// 获取区县列表
|
|
|
getAreaList (val) {
|
|
|
this.addrDistrictList = []
|
|
|
this.form.countySn = undefined
|
|
|
- this.form.cityName = this.addrCityList.find(item => item.sn == val).name
|
|
|
+ this.form.cityName = this.addrCityList.find(item => item.id == val).name
|
|
|
this.getArea('district', val)
|
|
|
},
|
|
|
// 区县变更
|
|
|
areaCharged (val) {
|
|
|
- this.form.countyName = this.addrDistrictList.find(item => item.sn == val).name
|
|
|
+ this.form.countyName = this.addrDistrictList.find(item => item.id == val).name
|
|
|
},
|
|
|
// 省/市/区
|
|
|
- getArea (type, sn) {
|
|
|
+ getArea (leve, sn) {
|
|
|
let params
|
|
|
- if (type == 'province') {
|
|
|
- params = { level: '1' }
|
|
|
+ if (leve == 'province') {
|
|
|
+ params = { type: '2' }
|
|
|
} else {
|
|
|
- params = { psn: sn }
|
|
|
+ params = { parentId: sn, type: leve == 'city' ? '3' : '4' }
|
|
|
}
|
|
|
getArea(params).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
- if (type == 'province') {
|
|
|
+ if (leve == 'province') {
|
|
|
this.addrProvinceList = res.data || []
|
|
|
- } else if (type == 'city') {
|
|
|
+ } else if (leve == 'city') {
|
|
|
this.addrCityList = res.data || []
|
|
|
- } else if (type == 'district') {
|
|
|
+ } else if (leve == 'district') {
|
|
|
this.addrDistrictList = res.data || []
|
|
|
}
|
|
|
} else {
|
|
|
- if (type == 'province') {
|
|
|
+ if (leve == 'province') {
|
|
|
this.addrProvinceList = []
|
|
|
- } else if (type == 'city') {
|
|
|
+ } else if (leve == 'city') {
|
|
|
this.addrCityList = []
|
|
|
- } else if (type == 'district') {
|
|
|
+ } else if (leve == 'district') {
|
|
|
this.addrDistrictList = []
|
|
|
}
|
|
|
}
|
|
@@ -201,14 +201,14 @@ export default {
|
|
|
// 编辑数据
|
|
|
setData (data) {
|
|
|
this.isEdit = true
|
|
|
- Promise.all([getArea({ level: '1' }), getArea({ psn: data.provinceSn }), getArea({ psn: data.citySn })]).then(res => {
|
|
|
+ Promise.all([getArea({ type: '2' }), getArea({ parentId: data.provinceSn, type: '3' }), getArea({ parentId: data.citySn, type: '4' })]).then(res => {
|
|
|
console.log(res)
|
|
|
this.addrProvinceList = res[0].data
|
|
|
- this.form.provinceName = this.addrProvinceList.find(item => item.sn == data.provinceSn).name
|
|
|
+ this.form.provinceName = this.addrProvinceList.find(item => item.id == data.provinceSn).name
|
|
|
this.addrCityList = res[1].data
|
|
|
- this.form.cityName = this.addrCityList.find(item => item.sn == data.citySn).name
|
|
|
+ this.form.cityName = this.addrCityList.find(item => item.id == data.citySn).name
|
|
|
this.addrDistrictList = res[2].data
|
|
|
- this.form.countyName = this.addrDistrictList.find(item => item.sn == data.countySn).name
|
|
|
+ this.form.countyName = this.addrDistrictList.find(item => item.id == data.countySn).name
|
|
|
this.form = Object.assign({}, this.form, data)
|
|
|
})
|
|
|
}
|