瀏覽代碼

省市区bug修复

chenrui 3 年之前
父節點
當前提交
9b35a572b9

+ 23 - 20
src/views/customerManagement/customerInfo/edit.vue

@@ -46,22 +46,22 @@
                   <!-- 客户地址 -->
                   <a-col span="8">
                     <a-form-model-item prop="provinceSn">
-                      <a-select id="customerManagementEdit-provinceSn" @change="getCityList" v-model="form.provinceSn" placeholder="请选择省">
-                        <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
+                      <a-select id="customerManagementEdit-provinceSn" allowClear @change="getCityList" v-model="form.provinceSn" placeholder="请选择省">
+                        <a-select-option v-for="item in addrProvinceList" :value="item.areaSn" :key="item.areaSn + 'a'">{{ item.name }}</a-select-option>
                       </a-select>
                     </a-form-model-item>
                   </a-col>
                   <a-col span="8">
                     <a-form-model-item prop="citySn">
-                      <a-select id="customerManagementEdit-citySn" @change="getAreaList" v-model="form.citySn" placeholder="请选择市">
-                        <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
+                      <a-select id="customerManagementEdit-citySn" allowClear @change="getAreaList" v-model="form.citySn" placeholder="请选择市">
+                        <a-select-option v-for="item in addrCityList" :value="item.areaSn" :key="item.areaSn + 'b'">{{ item.name }}</a-select-option>
                       </a-select>
                     </a-form-model-item>
                   </a-col>
                   <a-col span="8">
                     <a-form-model-item prop="countySn">
-                      <a-select id="customerManagementEdit-countySn" @change="areaCharged" v-model="form.countySn" placeholder="请选择区/县">
-                        <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
+                      <a-select id="customerManagementEdit-countySn" allowClear @change="areaCharged" v-model="form.countySn" placeholder="请选择区/县">
+                        <a-select-option v-for="item in addrDistrictList" :value="item.areaSn" :key="item.areaSn + 'c'">{{ item.name }}</a-select-option>
                       </a-select>
                     </a-form-model-item>
                   </a-col>
@@ -260,35 +260,38 @@ export default {
     },
     // 获取城市列表
     getCityList (val) {
-      const index = this.addrProvinceList.findIndex(item => item.id == val)
-      if (index >= 0) {
-        this.form.provinceName = this.addrProvinceList[index].name
-      }
       this.addrCityList = []
       this.addrDistrictList = []
       this.form.citySn = undefined
       this.form.countySn = undefined
       this.form.customerAddr = ''
-      this.getArea('city', val)
+      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.id == val)
-      if (index >= 0) {
-        this.form.cityName = this.addrCityList[index].name
-      }
       this.addrDistrictList = []
       this.form.countySn = undefined
       this.form.customerAddr = ''
-      this.getArea('district', val)
+      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.id == val)
-      if (index >= 0) {
-        this.form.countyName = this.addrDistrictList[index].name
-      }
       this.form.customerAddr = ''
+      if (val) {
+        this.form.countyName = this.addrDistrictList.find(item => item.areaSn == val).name
+      } else {
+        this.form.countyName = ''
+      }
     },
     //  省/市/区
     getArea (leve, sn) {

+ 12 - 8
src/views/customerManagement/customerInfo/list.vue

@@ -32,22 +32,22 @@
                   <a-form-item label="客户地址">
                     <a-col span="7">
                       <a-form-item prop="provinceSn" style="margin: 0;">
-                        <a-select v-model="queryParam.provinceSn" @change="getCityList" placeholder="请选择省">
-                          <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
+                        <a-select v-model="queryParam.provinceSn" allowClear @change="getCityList" placeholder="请选择省">
+                          <a-select-option v-for="item in addrProvinceList" :value="item.areaSn" :key="item.areaSn + 'a'">{{ item.name }}</a-select-option>
                         </a-select>
                       </a-form-item>
                     </a-col>
                     <a-col span="7" offset="1">
                       <a-form-item prop="citySn" style="margin: 0;">
-                        <a-select v-model="queryParam.citySn" @change="getAreaList" placeholder="请选择市">
-                          <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
+                        <a-select v-model="queryParam.citySn" allowClear @change="getAreaList" placeholder="请选择市">
+                          <a-select-option v-for="item in addrCityList" :value="item.areaSn" :key="item.areaSn + 'b'">{{ item.name }}</a-select-option>
                         </a-select>
                       </a-form-item>
                     </a-col>
                     <a-col span="7" offset="1">
                       <a-form-item prop="countySn" style="margin: 0;">
-                        <a-select v-model="queryParam.countySn" placeholder="请选择区/县">
-                          <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
+                        <a-select v-model="queryParam.countySn" allowClear placeholder="请选择区/县">
+                          <a-select-option v-for="item in addrDistrictList" :value="item.areaSn" :key="item.areaSn + 'c'">{{ item.name }}</a-select-option>
                         </a-select>
                       </a-form-item>
                     </a-col>
@@ -299,13 +299,17 @@ export default {
       this.addrDistrictList = []
       this.queryParam.citySn = undefined
       this.queryParam.countySn = undefined
-      this.getArea('city', val)
+      if (val) {
+        this.getArea('city', val)
+      }
     },
     // 获取区县列表
     getAreaList (val) {
       this.addrDistrictList = []
       this.queryParam.countySn = undefined
-      this.getArea('district', val)
+      if (val) {
+        this.getArea('district', val)
+      }
     },
     //  省/市/区
     getArea (leve, sn) {

+ 3 - 3
src/views/productManagement/productInfo/detailModal.vue

@@ -42,9 +42,9 @@ export default {
   },
   computed: {
     productTypeName () {
-      const productTypeName1 = this.detailsData.productTypeName1 ? this.detailsData.productTypeName1 : ''
-      const productTypeName2 = this.detailsData.productTypeName2 ? ' > ' + this.detailsData.productTypeName2 : ''
-      const productTypeName3 = this.detailsData.productTypeName3 ? ' > ' + this.detailsData.productTypeName3 : ''
+      const productTypeName1 = this.detailsData&&this.detailsData.productTypeName1 ? this.detailsData.productTypeName1 : ''
+      const productTypeName2 = this.detailsData&&this.detailsData.productTypeName2 ? ' > ' + this.detailsData.productTypeName2 : ''
+      const productTypeName3 = this.detailsData&&this.detailsData.productTypeName3 ? ' > ' + this.detailsData.productTypeName3 : ''
       return productTypeName1 + productTypeName2 + productTypeName3
     }
   },

+ 23 - 11
src/views/purchasingManagement/purchaseOrder/receivingAddress/editAddressModal.vue

@@ -38,22 +38,22 @@
             <!-- 所在地区 -->
             <a-col span="8">
               <a-form-model-item prop="provinceSn">
-                <a-select id="editAddress-provinceSn" @change="getCityList" v-model="form.provinceSn" placeholder="请选择省">
-                  <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
+                <a-select id="editAddress-provinceSn" allowClear @change="getCityList" v-model="form.provinceSn" placeholder="请选择省">
+                  <a-select-option v-for="item in addrProvinceList" :value="item.areaSn" :key="item.areaSn + 'a'">{{ item.name }}</a-select-option>
                 </a-select>
               </a-form-model-item>
             </a-col>
             <a-col span="8">
               <a-form-model-item prop="citySn">
-                <a-select id="editAddress-citySn" @change="getAreaList" v-model="form.citySn" placeholder="请选择市">
-                  <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
+                <a-select id="editAddress-citySn" allowClear @change="getAreaList" v-model="form.citySn" placeholder="请选择市">
+                  <a-select-option v-for="item in addrCityList" :value="item.areaSn" :key="item.areaSn + 'b'">{{ item.name }}</a-select-option>
                 </a-select>
               </a-form-model-item>
             </a-col>
             <a-col span="8">
               <a-form-model-item prop="countySn">
-                <a-select id="editAddress-countySn" @change="areaCharged" v-model="form.countySn" placeholder="请选择区/县">
-                  <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
+                <a-select id="editAddress-countySn" allowClear @change="areaCharged" v-model="form.countySn" placeholder="请选择区/县">
+                  <a-select-option v-for="item in addrDistrictList" :value="item.areaSn" :key="item.areaSn + 'c'">{{ item.name }}</a-select-option>
                 </a-select>
               </a-form-model-item>
             </a-col>
@@ -161,19 +161,31 @@ export default {
       this.addrDistrictList = []
       this.form.citySn = undefined
       this.form.countySn = undefined
-      this.form.provinceName = this.addrProvinceList.find(item => item.id == val).name
-      this.getArea('city', val)
+      if (val) {
+        this.getArea('city', val)
+        this.form.provinceName = this.addrProvinceList.find(item => item.areaSn == val).name
+      } else {
+        this.form.provinceName = ''
+      }
     },
     // 获取区县列表
     getAreaList (val) {
       this.addrDistrictList = []
       this.form.countySn = undefined
-      this.form.cityName = this.addrCityList.find(item => item.id == val).name
-      this.getArea('district', val)
+      if (val) {
+        this.getArea('district', val)
+        this.form.cityName = this.addrCityList.find(item => item.areaSn == val).name
+      } else {
+        this.form.cityName = ''
+      }
     },
     // 区县变更
     areaCharged (val) {
-      this.form.countyName = this.addrDistrictList.find(item => item.id == val).name
+      if (val) {
+        this.form.countyName = this.addrDistrictList.find(item => item.areaSn == val).name
+      } else {
+        this.form.countyName = ''
+      }
     },
     //  省/市/区
     getArea (leve, sn) {

+ 10 - 5
src/views/reportData/chainSalesDetailReport/list.vue

@@ -51,21 +51,21 @@
                     <a-col span="7">
                       <a-form-model-item prop="provinceSn" style="margin: 0;">
                         <a-select v-model="queryParam.provinceSn" @change="getCityList" placeholder="请选择省" allowClear>
-                          <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
+                          <a-select-option v-for="item in addrProvinceList" :value="item.areaSn" :key="item.areaSn + 'a'">{{ item.name }}</a-select-option>
                         </a-select>
                       </a-form-model-item>
                     </a-col>
                     <a-col span="7" offset="1">
                       <a-form-model-item prop="citySn" style="margin: 0;">
                         <a-select v-model="queryParam.citySn" @change="getAreaList" placeholder="请选择市" allowClear>
-                          <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
+                          <a-select-option v-for="item in addrCityList" :value="item.areaSn" :key="item.areaSn + 'b'">{{ item.name }}</a-select-option>
                         </a-select>
                       </a-form-model-item>
                     </a-col>
                     <a-col span="7" offset="1">
                       <a-form-model-item prop="countySn" style="margin: 0;">
                         <a-select v-model="queryParam.countySn" placeholder="请选择区/县" allowClear>
-                          <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
+                          <a-select-option v-for="item in addrDistrictList" :value="item.areaSn" :key="item.areaSn + 'c'">{{ item.name }}</a-select-option>
                         </a-select>
                       </a-form-model-item>
                     </a-col>
@@ -127,6 +127,7 @@
                     id="chainSalesDetailReportList-warehouseCascade"
                     placeholder="请选择仓库仓位"
                     @change="warehouseCascadeChange"
+                    allowClear
                     style="width: 100%;" />
                 </a-form-model-item>
               </a-col>
@@ -433,13 +434,17 @@ export default {
       this.addrDistrictList = []
       this.queryParam.citySn = undefined
       this.queryParam.countySn = undefined
-      this.getArea('city', val)
+      if (val) {
+        this.getArea('city', val)
+      }
     },
     // 获取区县列表
     getAreaList (val) {
       this.addrDistrictList = []
       this.queryParam.countySn = undefined
-      this.getArea('district', val)
+      if (val) {
+        this.getArea('district', val)
+      }
     },
     //  省/市/区
     getArea (leve, sn) {

+ 12 - 8
src/views/reportData/chainSalesReport/list.vue

@@ -50,22 +50,22 @@
                   <a-form-model-item label="客户所在区" :labelCol="{span: 4}" :wrapperCol="{ span: 20 }">
                     <a-col span="7">
                       <a-form-model-item prop="provinceSn" style="margin: 0;">
-                        <a-select v-model="queryParam.provinceSn" @change="getCityList" placeholder="请选择省">
-                          <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
+                        <a-select v-model="queryParam.provinceSn" allowClear @change="getCityList" placeholder="请选择省">
+                          <a-select-option v-for="item in addrProvinceList" :value="item.areaSn" :key="item.areaSn + 'a'">{{ item.name }}</a-select-option>
                         </a-select>
                       </a-form-model-item>
                     </a-col>
                     <a-col span="7" offset="1">
                       <a-form-model-item prop="citySn" style="margin: 0;">
-                        <a-select v-model="queryParam.citySn" @change="getAreaList" placeholder="请选择市">
-                          <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
+                        <a-select v-model="queryParam.citySn" allowClear @change="getAreaList" placeholder="请选择市">
+                          <a-select-option v-for="item in addrCityList" :value="item.areaSn" :key="item.areaSn + 'b'">{{ item.name }}</a-select-option>
                         </a-select>
                       </a-form-model-item>
                     </a-col>
                     <a-col span="7" offset="1">
                       <a-form-model-item prop="countySn" style="margin: 0;">
-                        <a-select v-model="queryParam.countySn" placeholder="请选择区/县">
-                          <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
+                        <a-select v-model="queryParam.countySn" allowClear placeholder="请选择区/县">
+                          <a-select-option v-for="item in addrDistrictList" :value="item.areaSn" :key="item.areaSn + 'c'">{{ item.name }}</a-select-option>
                         </a-select>
                       </a-form-model-item>
                     </a-col>
@@ -299,13 +299,17 @@ export default {
       this.addrDistrictList = []
       this.queryParam.citySn = undefined
       this.queryParam.countySn = undefined
-      this.getArea('city', val)
+      if (val) {
+        this.getArea('city', val)
+      }
     },
     // 获取区县列表
     getAreaList (val) {
       this.addrDistrictList = []
       this.queryParam.countySn = undefined
-      this.getArea('district', val)
+      if (val) {
+        this.getArea('district', val)
+      }
     },
     //  省/市/区
     getArea (leve, sn) {

+ 12 - 8
src/views/reportData/customerReport/list.vue

@@ -37,22 +37,22 @@
                   <a-form-model-item label="客户所在区" :labelCol="{span: 4}" :wrapperCol="{ span: 20 }">
                     <a-col span="7">
                       <a-form-model-item prop="provinceSn" style="margin: 0;">
-                        <a-select v-model="queryParam.provinceSn" @change="getCityList" placeholder="请选择省">
-                          <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
+                        <a-select v-model="queryParam.provinceSn" allowClear @change="getCityList" placeholder="请选择省">
+                          <a-select-option v-for="item in addrProvinceList" :value="item.areaSn" :key="item.areaSn + 'a'">{{ item.name }}</a-select-option>
                         </a-select>
                       </a-form-model-item>
                     </a-col>
                     <a-col span="7" offset="1">
                       <a-form-model-item prop="citySn" style="margin: 0;">
-                        <a-select v-model="queryParam.citySn" @change="getAreaList" placeholder="请选择市">
-                          <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
+                        <a-select v-model="queryParam.citySn" allowClear @change="getAreaList" placeholder="请选择市">
+                          <a-select-option v-for="item in addrCityList" :value="item.areaSn" :key="item.areaSn + 'b'">{{ item.name }}</a-select-option>
                         </a-select>
                       </a-form-model-item>
                     </a-col>
                     <a-col span="7" offset="1">
                       <a-form-model-item prop="countySn" style="margin: 0;">
-                        <a-select v-model="queryParam.countySn" placeholder="请选择区/县">
-                          <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
+                        <a-select v-model="queryParam.countySn" allowClear placeholder="请选择区/县">
+                          <a-select-option v-for="item in addrDistrictList" :value="item.areaSn" :key="item.areaSn + 'c'">{{ item.name }}</a-select-option>
                         </a-select>
                       </a-form-model-item>
                     </a-col>
@@ -245,13 +245,17 @@ export default {
       this.addrDistrictList = []
       this.queryParam.citySn = undefined
       this.queryParam.countySn = undefined
-      this.getArea('city', val)
+      if (val) {
+        this.getArea('city', val)
+      }
     },
     // 获取区县列表
     getAreaList (val) {
       this.addrDistrictList = []
       this.queryParam.countySn = undefined
-      this.getArea('district', val)
+      if (val) {
+        this.getArea('district', val)
+      }
     },
     //  省/市/区
     getArea (leve, sn) {

+ 30 - 14
src/views/salesManagement/salesQuery/chooseCustomModal.vue

@@ -38,22 +38,22 @@
                 <!-- 客户地址 -->
                 <a-col span="8">
                   <a-form-model-item prop="shippingAddressProvinceSn">
-                    <a-select id="chooseCustom-provinceSn" @change="getCityList" v-model="form.shippingAddressProvinceSn" placeholder="请选择省">
-                      <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
+                    <a-select id="chooseCustom-provinceSn" allowClear @change="getCityList" v-model="form.shippingAddressProvinceSn" placeholder="请选择省">
+                      <a-select-option v-for="item in addrProvinceList" :value="item.areaSn" :key="item.areaSn + 'a'">{{ item.name }}</a-select-option>
                     </a-select>
                   </a-form-model-item>
                 </a-col>
                 <a-col span="8">
                   <a-form-model-item prop="shippingAddressCitySn">
-                    <a-select id="chooseCustom-citySn" @change="getAreaList" v-model="form.shippingAddressCitySn" placeholder="请选择市">
-                      <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
+                    <a-select id="chooseCustom-citySn" allowClear @change="getAreaList" v-model="form.shippingAddressCitySn" placeholder="请选择市">
+                      <a-select-option v-for="item in addrCityList" :value="item.areaSn" :key="item.areaSn + 'b'">{{ item.name }}</a-select-option>
                     </a-select>
                   </a-form-model-item>
                 </a-col>
                 <a-col span="8">
                   <a-form-model-item prop="shippingAddressCountySn">
-                    <a-select id="chooseCustom-countySn" @change="areaCharged" v-model="form.shippingAddressCountySn" placeholder="请选择区/县">
-                      <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
+                    <a-select id="chooseCustom-countySn" allowClear @change="areaCharged" v-model="form.shippingAddressCountySn" placeholder="请选择区/县">
+                      <a-select-option v-for="item in addrDistrictList" :value="item.areaSn" :key="item.areaSn + 'c'">{{ item.name }}</a-select-option>
                     </a-select>
                   </a-form-model-item>
                 </a-col>
@@ -122,7 +122,7 @@
           </a-col> -->
           <a-col :span="8">
             <a-form-model-item label="收款方式" prop="settleStyleSn">
-              <a-select placeholder="请选择收款方式" v-model="form.settleStyleSn">
+              <a-select placeholder="请选择收款方式" allowClear v-model="form.settleStyleSn">
                 <a-select-option v-for="item in settleStyleList" :key="item.settleStyleSn" :value="item.settleStyleSn">
                   {{ item.name }}
                 </a-select-option>
@@ -138,7 +138,7 @@
         <a-row :gutter="15">
           <a-col :span="8">
             <a-form-model-item label="业务员" prop="salesManSn">
-              <a-select id="chooseCustom-salesManSn" @change="salesManChange" v-model="form.salesManSn" placeholder="请选择业务员">
+              <a-select id="chooseCustom-salesManSn" allowClear @change="salesManChange" v-model="form.salesManSn" placeholder="请选择业务员">
                 <a-select-option v-for="item in userList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
               </a-select>
             </a-form-model-item>
@@ -296,7 +296,11 @@ export default {
     },
     // 业务员
     salesManChange (id) {
-      this.form.salesManName = this.userList.find(item => item.id == id).name
+      if (id) {
+        this.form.salesManName = this.userList.find(item => item.id == id).name
+      } else {
+        this.form.salesManName = ''
+      }
     },
     // 客户 change
     custChange (obj) {
@@ -475,8 +479,12 @@ export default {
       this.form.shippingAddressCountySn = undefined
       this.form.shippingAddressCountyName = ''
       this.form.shippingAddress = ''
-      this.form.shippingAddressProvinceName = this.addrProvinceList.find(item => item.id == val).name
-      this.getArea('city', val)
+      if (val) {
+        this.getArea('city', val)
+        this.form.shippingAddressProvinceName = this.addrProvinceList.find(item => item.areaSn == val).name
+      } else {
+        this.form.shippingAddressProvinceName = ''
+      }
     },
     // 获取区县列表
     getAreaList (val) {
@@ -484,13 +492,21 @@ export default {
       this.form.shippingAddressCountySn = undefined
       this.form.shippingAddressCountyName = ''
       this.form.shippingAddress = ''
-      this.form.shippingAddressCityName = this.addrCityList.find(item => item.id == val).name
-      this.getArea('district', val)
+      if (val) {
+        this.getArea('district', val)
+        this.form.shippingAddressCityName = this.addrCityList.find(item => item.areaSn == val).name
+      } else {
+        this.form.shippingAddressCityName = ''
+      }
     },
     // 区县变更
     areaCharged (val) {
       this.form.shippingAddress = ''
-      this.form.shippingAddressCountyName = this.addrDistrictList.find(item => item.id == val).name
+      if (val) {
+        this.form.shippingAddressCountyName = this.addrDistrictList.find(item => item.areaSn == val).name
+      } else {
+        this.form.shippingAddressCountyName = ''
+      }
     },
     //  省/市/区
     getArea (leve, sn) {

+ 23 - 11
src/views/salesManagement/salesReturn/chooseCustomModal.vue

@@ -38,22 +38,22 @@
                 <!-- 客户地址 -->
                 <a-col span="8">
                   <a-form-model-item prop="provinceSn">
-                    <a-select id="chooseCustom-provinceSn" @change="getCityList" v-model="form.provinceSn" placeholder="请选择省">
-                      <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
+                    <a-select id="chooseCustom-provinceSn" allowClear @change="getCityList" v-model="form.provinceSn" placeholder="请选择省">
+                      <a-select-option v-for="item in addrProvinceList" :value="item.areaSn" :key="item.areaSn + 'a'">{{ item.name }}</a-select-option>
                     </a-select>
                   </a-form-model-item>
                 </a-col>
                 <a-col span="8">
                   <a-form-model-item prop="citySn">
-                    <a-select id="chooseCustom-citySn" @change="getAreaList" v-model="form.citySn" placeholder="请选择市">
-                      <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
+                    <a-select id="chooseCustom-citySn" allowClear @change="getAreaList" v-model="form.citySn" placeholder="请选择市">
+                      <a-select-option v-for="item in addrCityList" :value="item.areaSn" :key="item.areaSn + 'b'">{{ item.name }}</a-select-option>
                     </a-select>
                   </a-form-model-item>
                 </a-col>
                 <a-col span="8">
                   <a-form-model-item prop="countySn">
-                    <a-select id="chooseCustom-countySn" @change="areaCharged" v-model="form.countySn" placeholder="请选择区/县">
-                      <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
+                    <a-select id="chooseCustom-countySn" allowClear @change="areaCharged" v-model="form.countySn" placeholder="请选择区/县">
+                      <a-select-option v-for="item in addrDistrictList" :value="item.areaSn" :key="item.areaSn + 'c'">{{ item.name }}</a-select-option>
                     </a-select>
                   </a-form-model-item>
                 </a-col>
@@ -352,8 +352,12 @@ export default {
       this.form.countySn = undefined
       this.form.countyName = ''
       this.form.customerAddr = ''
-      this.form.countyName = this.addrProvinceList.find(item => item.id == val).name
-      this.getArea('city', val)
+      if (val) {
+        this.getArea('city', val)
+        this.form.provinceName = this.addrProvinceList.find(item => item.areaSn == val).name
+      } else {
+        this.form.provinceName = ''
+      }
     },
     // 获取区县列表
     getAreaList (val) {
@@ -361,13 +365,21 @@ export default {
       this.form.countySn = undefined
       this.form.countyName = ''
       this.form.customerAddr = ''
-      this.form.cityName = this.addrCityList.find(item => item.id == val).name
-      this.getArea('district', val)
+      if (val) {
+        this.getArea('district', val)
+        this.form.cityName = this.addrCityList.find(item => item.areaSn == val).name
+      } else {
+        this.form.cityName = ''
+      }
     },
     // 区县变更
     areaCharged (val) {
       this.form.customerAddr = ''
-      this.form.countyName = this.addrDistrictList.find(item => item.id == val).name
+      if (val) {
+        this.form.countyName = this.addrDistrictList.find(item => item.areaSn == val).name
+      } else {
+        this.form.countyName = ''
+      }
     },
     //  省/市/区
     getArea (leve, sn) {

+ 24 - 21
src/views/supplierManagement/supplierInfo/editModal.vue

@@ -33,22 +33,22 @@
               <!-- 所在地区 -->
               <a-col span="8">
                 <a-form-model-item prop="provinceSn">
-                  <a-select id="supplierInfoEdit-provinceSn" @change="getCityList" v-model="form.provinceSn" placeholder="请选择省">
-                    <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
+                  <a-select id="supplierInfoEdit-provinceSn" allowClear @change="getCityList" v-model="form.provinceSn" placeholder="请选择省">
+                    <a-select-option v-for="item in addrProvinceList" :value="item.areaSn" :key="item.areaSn + 'a'">{{ item.name }}</a-select-option>
                   </a-select>
                 </a-form-model-item>
               </a-col>
               <a-col span="8">
                 <a-form-model-item prop="citySn">
-                  <a-select id="supplierInfoEdit-citySn" @change="getAreaList" v-model="form.citySn" placeholder="请选择市">
-                    <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
+                  <a-select id="supplierInfoEdit-citySn" allowClear @change="getAreaList" v-model="form.citySn" placeholder="请选择市">
+                    <a-select-option v-for="item in addrCityList" :value="item.areaSn" :key="item.areaSn + 'b'">{{ item.name }}</a-select-option>
                   </a-select>
                 </a-form-model-item>
               </a-col>
               <a-col span="8">
                 <a-form-model-item prop="countySn">
-                  <a-select id="supplierInfoEdit-countySn" @change="areaCharged" v-model="form.countySn" placeholder="请选择区/县">
-                    <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
+                  <a-select id="supplierInfoEdit-countySn" allowClear @change="areaCharged" v-model="form.countySn" placeholder="请选择区/县">
+                    <a-select-option v-for="item in addrDistrictList" :value="item.areaSn" :key="item.areaSn + 'c'">{{ item.name }}</a-select-option>
                   </a-select>
                 </a-form-model-item>
               </a-col>
@@ -144,7 +144,7 @@ export default {
         citySn: undefined, // 市
         cityName: '',
         countySn: undefined, // 区
-        districtName: '',
+        countyName: '',
         supplierAddress: '', //  详细地址
         contactPerson: '', //  联系人
         contactTel: '', //  联系电话
@@ -229,35 +229,38 @@ export default {
     },
     // 获取城市列表
     getCityList (val) {
-      const index = this.addrProvinceList.findIndex(item => item.id == val)
-      if (index >= 0) {
-        this.form.provinceName = this.addrProvinceList[index].name
-      }
       this.addrCityList = []
       this.addrDistrictList = []
       this.form.citySn = undefined
       this.form.countySn = undefined
       this.form.supplierAddress = ''
-      this.getArea('city', val)
+      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.id == val)
-      if (index >= 0) {
-        this.form.cityName = this.addrCityList[index].name
-      }
       this.addrDistrictList = []
       this.form.countySn = undefined
       this.form.supplierAddress = ''
-      this.getArea('district', val)
+      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.id == val)
-      if (index >= 0) {
-        this.form.countyName = this.addrDistrictList[index].name
-      }
       this.form.supplierAddress = ''
+      if (val) {
+        this.form.countyName = this.addrDistrictList.find(item => item.areaSn == val).name
+      } else {
+        this.form.countyName = ''
+      }
     },
     //  省/市/区
     getArea (leve, sn) {