Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
npm
/
glsx-components
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 74f59bc6
authored
Aug 22, 2022
by
匡雅琴
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
省市组件优化
1 parent
842248aa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
src/packages/GLProvince/src/index.vue
src/packages/GLProvince/src/index.vue
View file @
74f59bc
...
...
@@ -235,7 +235,6 @@ export default {
// 打开地图弹框
hanleSelectMap
()
{
console
.
log
(
this
.
provinceForm
)
this
.
dialogMapVisible
=
true
this
.
$nextTick
(()
=>
{
if
(
this
.
provinceForm
.
fullAddress
&&
!
this
.
$refs
.
mapForm
.
address
)
{
...
...
@@ -259,12 +258,14 @@ export default {
var
mapData
=
this
.
$refs
.
mapForm
.
geocoderAddress
// 赋值省市区名称和code
const
{
city
,
citycode
,
province
,
district
,
towncode
}
=
mapData
.
addressComponent
this
.
provinceForm
.
provinceName
=
province
this
.
provinceForm
.
cityName
=
city
this
.
provinceForm
.
townName
=
district
this
.
provinceForm
.
provincecode
=
mapData
.
adcode
this
.
provinceForm
.
citycode
=
citycode
this
.
provinceForm
.
towncode
=
towncode
if
(
!
this
.
provinceForm
.
provinceName
)
{
this
.
provinceForm
.
provinceName
=
province
this
.
provinceForm
.
cityName
=
city
this
.
provinceForm
.
townName
=
district
this
.
provinceForm
.
provinceCode
=
mapData
.
adcode
this
.
provinceForm
.
cityCode
=
citycode
this
.
provinceForm
.
townCode
=
towncode
}
var
fullAddress
=
''
var
provincecode
=
''
// 为防止打开地图弹框不选择地址点确定按钮无法正确判断地址选择是否正确产生的报错,设置this.addressData.fullAddress来保存上次选择的地址
...
...
@@ -298,6 +299,7 @@ export default {
}
// 判断省市是否匹配
// 如果只展示省市
console
.
log
(
this
.
provinceForm
.
provinceName
,
provincename
,
'12121212'
)
if
(
this
.
provinceForm
.
provinceName
&&
!
this
.
provinceForm
.
townName
)
{
if
(
this
.
provinceForm
.
provinceName
!==
provincename
||
this
.
provinceForm
.
cityName
!==
cityname
)
{
this
.
$message
.
error
(
'您选择的地址错误,请重新选择'
)
...
...
@@ -312,8 +314,6 @@ export default {
}
}
this
.
dialogMapVisible
=
false
// this.subdistrict == 2 ? this.init(province, city) : this.init(province, city, town)
// console.log(this.provinceForm.lat, 'provinceForm')
// 通过地图选择省市区
this
.
$emit
(
'selectAddressByMap'
,
this
.
provinceForm
)
}
...
...
@@ -342,6 +342,10 @@ export default {
.el-form-item__content
{
width
:
474px
;
display
:
flex
;
margin-left
:
0
!important
;
}
.el-form-item
{
display
:
flex
;
}
}
</
style
>
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment