Commit 493a80d0 by 匡雅琴

直辖市回显修改

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