Showing
1 changed file
with
18 additions
and
2 deletions
@@ -128,7 +128,11 @@ export default { | @@ -128,7 +128,11 @@ export default { | ||
128 | 128 | ||
129 | /* 处理编辑时父组件传递的省市区 */ | 129 | /* 处理编辑时父组件传递的省市区 */ |
130 | async parentHandleclick({ areaCode }) { | 130 | async parentHandleclick({ areaCode }) { |
131 | - if (areaCode === "" || areaCode === undefined || areaCode.length < 8) { | 131 | + if (areaCode === "" || areaCode === undefined) { |
132 | + return; | ||
133 | + } | ||
134 | + | ||
135 | + if (areaCode.length < 2) { | ||
132 | return; | 136 | return; |
133 | } | 137 | } |
134 | 138 | ||
@@ -146,6 +150,10 @@ export default { | @@ -146,6 +150,10 @@ export default { | ||
146 | this.province.allTitle = provincesCaption; | 150 | this.province.allTitle = provincesCaption; |
147 | this.province.title = this.titleHandle(provincesCaption); | 151 | this.province.title = this.titleHandle(provincesCaption); |
148 | 152 | ||
153 | + if (areaCode.length < 4) { | ||
154 | + return; | ||
155 | + } | ||
156 | + | ||
149 | //市 | 157 | //市 |
150 | let citysCaption = ""; | 158 | let citysCaption = ""; |
151 | this.city.id = areaCode.substring(0, 4); | 159 | this.city.id = areaCode.substring(0, 4); |
@@ -162,6 +170,10 @@ export default { | @@ -162,6 +170,10 @@ export default { | ||
162 | this.city.allTitle = citysCaption; | 170 | this.city.allTitle = citysCaption; |
163 | this.city.title = this.titleHandle(citysCaption); | 171 | this.city.title = this.titleHandle(citysCaption); |
164 | 172 | ||
173 | + if (areaCode.length < 6) { | ||
174 | + return; | ||
175 | + } | ||
176 | + | ||
165 | //县 | 177 | //县 |
166 | let areasCaption = ""; | 178 | let areasCaption = ""; |
167 | this.area.id = areaCode.substring(0, 6); | 179 | this.area.id = areaCode.substring(0, 6); |
@@ -179,9 +191,13 @@ export default { | @@ -179,9 +191,13 @@ export default { | ||
179 | this.area.allTitle = areasCaption; | 191 | this.area.allTitle = areasCaption; |
180 | this.area.title = this.titleHandle(areasCaption); | 192 | this.area.title = this.titleHandle(areasCaption); |
181 | 193 | ||
194 | + if (areaCode.length < 9) { | ||
195 | + return; | ||
196 | + } | ||
197 | + | ||
182 | //街道 | 198 | //街道 |
183 | let streetsCaption = ""; | 199 | let streetsCaption = ""; |
184 | - this.street.id = areaCode; | 200 | + this.street.id = areaCode.substring(0, 9); |
185 | const result = await this.fetchAddressProvinces(areaCode.substring(0, 6)); | 201 | const result = await this.fetchAddressProvinces(areaCode.substring(0, 6)); |
186 | this.streets = result.data; | 202 | this.streets = result.data; |
187 | this.streets.map(info => { | 203 | this.streets.map(info => { |
-
Please register or login to post a comment