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,13 +61,6 @@ export default { ...@@ -61,13 +61,6 @@ 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({
adcode: '',
name: '全部'
})
})
})
console.log(this.AllData)
if (provinceName) { if (provinceName) {
this.AllData.map(item => { this.AllData.map(item => {
if (item.name.indexOf(provinceName) != -1) { if (item.name.indexOf(provinceName) != -1) {
...@@ -85,6 +78,8 @@ export default { ...@@ -85,6 +78,8 @@ export default {
} }
}) })
} }
})
})
} }
} }
} }
......
...@@ -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!