Commit 493a80d0 by 匡雅琴

直辖市回显修改

1 parent 165232c6
<template>
<div>
<el-form ref="provinceForm" :model="provinceForm" label-width="80px" inline="true" class="province">
<el-select v-model="provinceForm.provinceName" placeholder="选择省份" @change="selectProvince" class="select-padding">
<el-select v-model="provinceForm.provinceName" clearable placeholder="选择省份" @change="selectProvince" class="select-padding">
<el-option v-for="item in AllData" :key="item.adcode" :label="item.name" :value="item.name" @click.native="selectProvince(item)"></el-option>
</el-select>
<el-select v-model="provinceForm.cityName" placeholder="选择您所在的市" style="width: 250px" @change="selectCity" class="select-padding">
<el-select v-model="provinceForm.cityName" clearable placeholder="选择您所在的市" style="width: 250px" @change="selectCity" class="select-padding">
<el-option v-for="item in cityList" :key="item.adcode" :label="item.name" :value="item.name" @click.native="selectCity(item)"></el-option>
</el-select>
</el-form>
......@@ -61,30 +61,25 @@ export default {
var districtSearch = new AMap.DistrictSearch(opts)
districtSearch.search('中国', (status, result) => {
this.AllData = result.districtList[0].districtList
this.AllData.unshift({
adcode: '',
name: '全部'
})
})
})
console.log(this.AllData)
if (provinceName) {
this.AllData.map(item => {
if (item.name.indexOf(provinceName) != -1) {
this.provinceForm.provinceName = item.name
this.cityList = item.districtList
this.provinceForm.provinceCode = item.adcode
this.cityList.map(itm => {
if (itm.name.indexOf(cityName) != -1) {
this.provinceForm.cityCode = itm.adcode
this.provinceForm.cityName = itm.name
// console.log(itm.name)
// this.$set(this.provinceForm, 'cityName', itm.name)
if (provinceName) {
this.AllData.map(item => {
if (item.name.indexOf(provinceName) != -1) {
this.provinceForm.provinceName = item.name
this.cityList = item.districtList
this.provinceForm.provinceCode = item.adcode
this.cityList.map(itm => {
if (itm.name.indexOf(cityName) != -1) {
this.provinceForm.cityCode = itm.adcode
this.provinceForm.cityName = itm.name
// console.log(itm.name)
// this.$set(this.provinceForm, 'cityName', itm.name)
}
})
}
})
}
})
}
})
}
}
}
......
......@@ -85,7 +85,7 @@ export default {
mounted() {
// this.brandList()
this.getUserInfo()
this.$refs.provinceForm.mapInit()
// this.$refs.provinceForm.mapInit()
},
methods: {
async brandList() {
......@@ -132,7 +132,7 @@ export default {
this.infoForm.businessType = businessType.map(item => (item = parseInt(item)))
}
// 省市回显
this.$refs.provinceForm.init(this.infoForm.provinceName, this.infoForm.cityName)
this.$refs.provinceForm.mapInit(this.infoForm.provinceName, this.infoForm.cityName)
if (!this.infoForm.merchantBrandMain) {
this.infoForm.merchantBrandMain = []
} else {
......
......@@ -186,7 +186,7 @@ export default {
//过滤
filterNode(value, data) {
if (!value) return true
return data.name.indexOf(value) !== -1
return data.label.indexOf(value) !== -1
},
// 显示隐藏
switchBrand() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!