Browse Source

省市区bug修复

chenrui 3 years ago
parent
commit
2fd63bcc03

+ 22 - 24
src/views/dealerManagement/merchantInfoManagement/edit.vue

@@ -565,10 +565,6 @@ export default {
     },
     // 获取城市列表
     getCityList (val) {
-      const index = this.addrProvinceList.findIndex(item => item.areaSn == val)
-      if (index >= 0) {
-        this.form.provinceName = this.addrProvinceList[index].name
-      }
       this.addrCityList = []
       this.addrDistrictList = []
       this.form.citySn = undefined
@@ -576,35 +572,34 @@ export default {
       this.form.address = ''
       if (val) {
         this.getArea('city', val, 0)
+        this.form.provinceName = this.addrProvinceList.find(item => item.areaSn == val).name
+      } else {
+        this.form.provinceName = ''
       }
     },
     // 获取区县列表
     getAreaList (val) {
-      const index = this.addrCityList.findIndex(item => item.areaSn == val)
-      if (index >= 0) {
-        this.form.cityName = this.addrCityList[index].name
-      }
       this.addrDistrictList = []
       this.form.districtSn = undefined
       this.form.address = ''
       if (val) {
         this.getArea('district', val, 0)
+        this.form.cityName = this.addrCityList.find(item => item.areaSn == val).name
+      } else {
+        this.form.cityName = ''
       }
     },
     // 区县变更
     areaCharged (val) {
-      const index = this.addrDistrictList.findIndex(item => item.areaSn == val)
-      if (index >= 0) {
-        this.form.districtName = this.addrDistrictList[index].name
-      }
       this.form.address = ''
+      if (val) {
+        this.form.districtName = this.addrDistrictList.find(item => item.areaSn == val).name
+      } else {
+        this.form.districtName = ''
+      }
     },
     // 获取城市列表
     getCityList1 (val) {
-      const index = this.addrProvinceList1.findIndex(item => item.areaSn == val)
-      if (index >= 0) {
-        this.form.receiveProvinceName = this.addrProvinceList1[index].name
-      }
       this.addrCityList1 = []
       this.addrDistrictList1 = []
       this.form.receiveCitySn = undefined
@@ -612,28 +607,31 @@ export default {
       this.form.receiveAddress = ''
       if (val) {
         this.getArea('city', val, 1)
+        this.form.receiveProvinceName = this.addrProvinceList1.find(item => item.areaSn == val).name
+      } else {
+        this.form.receiveProvinceName = ''
       }
     },
     // 获取区县列表
     getAreaList1 (val) {
-      const index = this.addrCityList1.findIndex(item => item.areaSn == val)
-      if (index >= 0) {
-        this.form.receiveCityName = this.addrCityList1[index].name
-      }
       this.addrDistrictList1 = []
       this.form.receiveDistrictSn = undefined
       this.form.receiveAddress = ''
       if (val) {
         this.getArea('district', val, 1)
+        this.form.receiveCityName = this.addrCityList1.find(item => item.areaSn == val).name
+      } else {
+        this.form.receiveCityName = ''
       }
     },
     // 区县变更
     areaCharged1 (val) {
-      const index = this.addrDistrictList1.findIndex(item => item.areaSn == val)
-      if (index >= 0) {
-        this.form.receiveDistrictName = this.addrDistrictList1[index].name
-      }
       this.form.receiveAddress = ''
+      if (val) {
+        this.form.receiveDistrictName = this.addrDistrictList1.find(item => item.areaSn == val).name
+      } else {
+        this.form.receiveDistrictName = ''
+      }
     },
     //  省/市/区
     getArea (leve, sn, index) {

+ 11 - 12
src/views/reportData/priceDifferenceDetailReport/list.vue

@@ -380,10 +380,6 @@ export default {
     },
     // 获取城市列表
     getCityList (val) {
-      const index = this.addrProvinceList.findIndex(item => item.areaSn == val)
-      if (index >= 0) {
-        this.queryParam.provinceName = this.addrProvinceList[index].name
-      }
       this.addrCityList = []
       this.addrDistrictList = []
       this.queryParam.citySn = undefined
@@ -391,28 +387,31 @@ export default {
       this.queryParam.address = ''
       if (val) {
         this.getArea('city', val)
+        this.queryParam.provinceName = this.addrProvinceList.find(item => item.areaSn == val).name
+      } else {
+        this.queryParam.provinceName = ''
       }
     },
     // 获取区县列表
     getAreaList (val) {
-      const index = this.addrCityList.findIndex(item => item.areaSn == val)
-      if (index >= 0) {
-        this.queryParam.cityName = this.addrCityList[index].name
-      }
       this.addrDistrictList = []
       this.queryParam.districtSn = undefined
       this.queryParam.address = ''
       if (val) {
         this.getArea('district', val)
+        this.queryParam.cityName = this.addrCityList.find(item => item.areaSn == val).name
+      } else {
+        this.queryParam.cityName = ''
       }
     },
     // 区县变更
     areaCharged (val) {
-      const index = this.addrDistrictList.findIndex(item => item.areaSn == val)
-      if (index >= 0) {
-        this.queryParam.districtName = this.addrDistrictList[index].name
-      }
       this.queryParam.address = ''
+      if (val) {
+        this.queryParam.districtName = this.addrDistrictList.find(item => item.areaSn == val).name
+      } else {
+        this.queryParam.districtName = ''
+      }
     },
     //  省/市/区
     getArea (leve, sn) {

+ 11 - 12
src/views/supplierManagement/supplierInfo/edit.vue

@@ -383,10 +383,6 @@ export default {
     },
     // 获取城市列表
     getCityList (val) {
-      const index = this.addrProvinceList.findIndex(item => item.areaSn == val)
-      if (index >= 0) {
-        this.form.provinceName = this.addrProvinceList[index].name
-      }
       this.addrCityList = []
       this.addrDistrictList = []
       this.form.citySn = undefined
@@ -394,28 +390,31 @@ export default {
       this.form.address = ''
       if (val) {
         this.getArea('city', val)
+        this.form.provinceName = this.addrProvinceList.find(item => item.areaSn == val).name
+      } else {
+        this.form.provinceName = ''
       }
     },
     // 获取区县列表
     getAreaList (val) {
-      const index = this.addrCityList.findIndex(item => item.areaSn == val)
-      if (index >= 0) {
-        this.form.cityName = this.addrCityList[index].name
-      }
       this.addrDistrictList = []
       this.form.districtSn = undefined
       this.form.address = ''
       if (val) {
         this.getArea('district', val)
+        this.form.cityName = this.addrCityList.find(item => item.areaSn == val).name
+      } else {
+        this.form.cityName = ''
       }
     },
     // 区县变更
     areaCharged (val) {
-      const index = this.addrDistrictList.findIndex(item => item.areaSn == val)
-      if (index >= 0) {
-        this.form.districtName = this.addrDistrictList[index].name
-      }
       this.form.address = ''
+      if (val) {
+        this.form.districtName = this.addrDistrictList.find(item => item.areaSn == val).name
+      } else {
+        this.form.districtName = ''
+      }
     },
     //  省/市/区
     getArea (leve, sn) {