QuKatie 3 роки тому
батько
коміт
e15d344dec

+ 24 - 14
src/views/basicData/customerInformation/detailsPageEdit.vue

@@ -934,20 +934,27 @@ export default {
               if (item1.children.length > 0) {
                 item1.children.forEach(item2 => {
                   if (item2.cityName == e[1]) {
-                    if (item2.children.length > 0) {
-                      item2.children.forEach(item3 => {
-                        if (item3.districtName == e[2]) {
-                          this.addressLatLng.push({
-                            name:
-                              (item3.provinceName != item3.cityName
-                                ? item3.cityName
-                                : "") + item3.districtName,
-                            value: this.addressLatLng.length + 1,
-                            lng: item3.lng,
-                            lat: item3.lat,
-                            zoom: 1
-                          });
-                        }
+                    if (e[0] == e[1]) {
+                      if (item2.children.length > 0) {
+                        item2.children.forEach(item3 => {
+                          if (item3.districtName == e[2]) {
+                            this.addressLatLng.push({
+                              name: item3.districtName,
+                              value: this.addressLatLng.length + 1,
+                              lng: item3.lng,
+                              lat: item3.lat,
+                              zoom: 1
+                            });
+                          }
+                        });
+                      }
+                    } else if (e[0] != e[1]) {
+                      this.addressLatLng.push({
+                        name: item2.cityName,
+                        value: this.addressLatLng.length + 1,
+                        lng: item2.lng,
+                        lat: item2.lat,
+                        zoom: 1
                       });
                     }
                   }
@@ -957,6 +964,9 @@ export default {
           });
         }
       });
+      this.addressLatLng= this.addressLatLng.filter((currentValue, currentIndex, selfArr) => {
+        return selfArr.findIndex(x=>x.name === currentValue.name) === currentIndex
+      });
     },
     //确认创建用户
     confirmSynchronizationTwo() {