chenrui 4 năm trước cách đây
mục cha
commit
eb4df625fd

+ 50 - 72
src/views/customerManagement/customerInfo/edit.vue

@@ -132,7 +132,7 @@
 
 <script>
 import { STable, VSelect } from '@/components'
-import { getProvince, getCityByPro, getDistrictByCity } from '@/api/data'
+import { getArea } from '@/api/data'
 import { custSave, custFindById } from '@/api/customer'
 import { custTypeFindAll } from '@/api/custType'
 export default {
@@ -230,80 +230,58 @@ export default {
     handleBack () {
       this.$router.push({ path: '/customerManagement/customerInfo/list' })
     },
-    // 获取省列表
-    getProvinceList () {
-      getProvince().then(res => {
-        if (res.status == 200) {
-          this.addrProvinceList = res.data || []
-        } else {
-          this.addrProvinceList = []
-        }
-      })
-    },
-    // 获取城市列表
-    getCityList (val) {
-      const _this = this
-      this.addrProvinceList.map(item => {
-        if (item.id == val) {
-          _this.form.province = item.name
-        }
-      })
-      this.addrCityList = []
-      this.addrAreaList = []
-      this.form.citySn = undefined
-      this.form.countySn = undefined
-      this.form.customerAddr = ''
-      this.getCityListRequest(val)
-    },
-    getCityListRequest (val) {
-      getCityByPro({
-        id: val
-      }).then(res => {
-        if (res.status == 200) {
-          this.addrCityList = res.data || []
-        } else {
-          this.addrCityList = []
-        }
-      })
-    },
-    // 获取区县列表
-    getAreaList (val) {
-      const _this = this
-      this.addrCityList.map(item => {
-        if (item.id == val) {
-          _this.form.city = item.name
-        }
-      })
-      this.addrAreaList = []
-      this.form.countySn = undefined
-      this.form.customerAddr = ''
-      this.getAreaListRequest(val)
-    },
-    getAreaListRequest (val) {
-      getDistrictByCity({
-        id: val
-      }).then(res => {
-        if (res.status == 200) {
-          this.addrAreaList = res.data || []
-        } else {
-          this.addrAreaList = []
-        }
-      })
-    },
-    // 区县变更
-    areaCharged (val) {
-      const _this = this
-      this.addrAreaList.map(item => {
-        if (item.id == val) {
-          _this.form.area = item.name
-        }
-      })
-      this.form.customerAddr = ''
-    }
+	// 获取城市列表
+	getCityList (val) {
+	  this.addrCityList = []
+	  this.addrDistrictList = []
+	  this.form.cityCode = undefined
+	  this.form.districtCode = undefined
+	  this.form.address = ''
+	  this.getArea('city', val)
+	},
+	// 获取区县列表
+	getAreaList (val) {
+	  this.addrDistrictList = []
+	  this.form.districtCode = undefined
+	  this.form.address = ''
+	  this.getArea('district', val)
+	},
+	// 区县变更
+	areaCharged (val) {
+	  this.form.address = ''
+	},
+	//  省/市/区
+	getArea (type, sn) {
+	  let params
+	  if (type == 'province') {
+	    params = { level: '1' }
+	  } else {
+	    params = { psn: sn }
+	  }
+	  getArea(params).then(res => {
+	    if (res.status == 200) {
+	      if (type == 'province') {
+	        this.addrProvinceList = res.data || []
+	      } else if (type == 'city') {
+	        this.addrCityList = res.data || []
+	      } else if (type == 'district') {
+	        this.addrDistrictList = res.data || []
+	      }
+	    } else {
+	      if (type == 'province') {
+	        this.addrProvinceList = []
+	      } else if (type == 'city') {
+	        this.addrCityList = []
+	      } else if (type == 'district') {
+	        this.addrDistrictList = []
+	      }
+	    }
+	  })
+	}
   },
   beforeRouteEnter (to, from, next) {
     next(vm => {
-      vm.getProvinceList() //  省市区
+      vm.getArea('province') //  省市区
       // vm.getCustTypeList() //  客户类型
       vm.$refs.ruleForm.resetFields()
       if (vm.$route.params.id) {

+ 37 - 35
src/views/customerManagement/customerInfo/list.vue

@@ -89,7 +89,7 @@
               </a-form-item>
             </a-col>
           </template>
-          <a-col :md="6" :sm="24">
+          <a-col :md="6" :sm="24" style="margin-bottom: 15px;">
             <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="customerManagementList-refresh">查询</a-button>
             <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="customerManagementList-reset">重置</a-button>
             <a @click="advanced=!advanced" style="margin-left: 8px">
@@ -131,7 +131,7 @@
 
 <script>
 import moment from 'moment'
-import { getProvince, getCityByPro, getDistrictByCity } from '@/api/data'
+import { getArea } from '@/api/data'
 import { custList, custDel } from '@/api/customer'
 import { custTypeFindAll } from '@/api/custType'
 import { STable, VSelect } from '@/components'
@@ -277,56 +277,58 @@ export default {
         }
       })
     },
-    // 获取省列表
-    getProvinceList () {
-      getProvince().then(res => {
-        if (res.status == 200) {
-          this.addrProvinceList = res.data || []
-        } else {
-          this.addrProvinceList = []
-        }
-      })
-    },
     // 获取城市列表
     getCityList (val) {
       this.addrCityList = []
       this.addrDistrictList = []
-      this.queryParam.citySn = undefined
-      this.queryParam.countySn = undefined
-      this.getCityListRequest(val)
-    },
-    getCityListRequest (val) {
-      getCityByPro({
-        id: val
-      }).then(res => {
-        if (res.status == 200) {
-          this.addrCityList = res.data || []
-        } else {
-          this.addrCityList = []
-        }
-      })
+      this.form.cityCode = undefined
+      this.form.districtCode = undefined
+      this.form.address = ''
+      this.getArea('city', val)
     },
     // 获取区县列表
     getAreaList (val) {
       this.addrDistrictList = []
-      this.queryParam.countySn = undefined
-      this.getAreaListRequest(val)
+      this.form.districtCode = undefined
+      this.form.address = ''
+      this.getArea('district', val)
     },
-    getAreaListRequest (val) {
-      getDistrictByCity({
-        id: val
-      }).then(res => {
+    // 区县变更
+    areaCharged (val) {
+      this.form.address = ''
+    },
+    //  省/市/区
+    getArea (type, sn) {
+      let params
+      if (type == 'province') {
+        params = { level: '1' }
+      } else {
+        params = { psn: sn }
+      }
+      getArea(params).then(res => {
         if (res.status == 200) {
-          this.addrDistrictList = res.data || []
+          if (type == 'province') {
+            this.addrProvinceList = res.data || []
+          } else if (type == 'city') {
+            this.addrCityList = res.data || []
+          } else if (type == 'district') {
+            this.addrDistrictList = res.data || []
+          }
         } else {
-          this.addrDistrictList = []
+          if (type == 'province') {
+            this.addrProvinceList = []
+          } else if (type == 'city') {
+            this.addrCityList = []
+          } else if (type == 'district') {
+            this.addrDistrictList = []
+          }
         }
       })
     }
   },
   beforeRouteEnter (to, from, next) {
     next(vm => {
-      vm.getProvinceList()
+      vm.getArea('province')
       // vm.getCustTypeList()
     })
   }

+ 0 - 1
src/views/salesManagement/quotation/list.vue

@@ -86,7 +86,6 @@
 </template>
 
 <script>
-// import { getProvince, getCityByPro, getDistrictByCity } from '@/api/data'
 import { STable, VSelect } from '@/components'
 import basicInfoModal from './basicInfoModal.vue'
 export default {

+ 0 - 1
src/views/supplierManagement/supplierInfo/list.vue

@@ -49,7 +49,6 @@
 </template>
 
 <script>
-// import { getProvince, getCityByPro, getDistrictByCity } from '@/api/data'
 import { STable, VSelect } from '@/components'
 export default {
   components: { STable, VSelect },

+ 1 - 1
vue.config.js

@@ -108,7 +108,7 @@ const vueConfig = {
     // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        target: 'http://192.168.16.104:8503/qpls-md',
+        target: 'http://192.168.16.194:8503/qpls-md',
         // target: 'http://it.test.zyucgj.com/zyit',
         // target: 'https://it.test.qiubcar.com/zyit',
         ws: false,