Browse Source

feat: 特殊城市特殊处理

Howie 1 year ago
parent
commit
bd24e80a74
1 changed files with 36 additions and 3 deletions
  1. 36 3
      src/views/commercialEngineering/components/base.vue

+ 36 - 3
src/views/commercialEngineering/components/base.vue

@@ -569,6 +569,15 @@ export default {
       region: {
         G: ['广州市', '清远市', '韶关市'],
         F: ['佛山市', '肇庆市', '云浮市']
+      },
+      // 特殊处理市区
+      specialCity:{
+        '1608754035946549250': '东莞市',
+        '1608754032574328834': '中山市',
+        '1608756901402767362': '儋州市',
+        '1608756898412228610': '三沙市',
+        '1608757977963163649': '嘉峪关市'
+
       }
     }
   },
@@ -621,8 +630,11 @@ export default {
         await this.getCallbackPosition(null, this.formData.provinceId, 'province', 'lbsId')
         await this.getCallbackPosition(this.formData.provinceId, this.formData.cityId, 'city', 'lbsId')
         await this.getCallbackPosition(this.formData.cityId, this.formData.areaId, 'area', 'lbsId')
+         const temp = this.areaList.find(k => this.formData.cityId == k.value)
+         if(temp &&!Object.keys(this.specialCity).includes(temp.parentLbsId)){
         await this.getCallbackPosition(this.formData.areaId, this.formData.streetId, 'street', 'lbsId')
       }
+      }
     }
   },
   mounted() {
@@ -673,7 +685,7 @@ export default {
             this.provinceList = res.data
           }
         } else if (level === 1) {
-          if (this.formData.province === '广东省') {
+          if (this.formData.province === '广东省' && ['frock', 'home'].includes(this.pageType)) {
             this.cityList = res.data.filter(k => {
               if (this.formData.projectArea) {
                 return this.region[this.formData.projectArea].includes(k.name)
@@ -691,7 +703,7 @@ export default {
       })
     },
     handleProjectArea(e) {
-      if (this.formData.provinceId && this.formData.province === '广东省') {
+      if (['frock', 'home'].includes(this.pageType) && this.formData.provinceId && this.formData.province === '广东省') {
         this.getAutonaviRegion(1, this.formData.provinceId)
       }
     },
@@ -758,6 +770,16 @@ export default {
       this.areaValue = value
       this.formData.streetId = ''
       this.streetList = []
+      // 特殊处理市
+      const temps =   this.areaList.filter(k=>{
+          return k.lbsId === value
+        })
+      if (value && this.areaList.length && Object.keys(this.specialCity).includes(temps[0].parentLbsId)) {
+        this.streetList = temps
+        this.formData.streetId = value
+        this.handleArea(value, 'street')
+        return
+      }
       this.getAutonaviRegion(3, value)
       this.handleArea(value, 'area')
     },
@@ -875,7 +897,10 @@ export default {
       await this.getCallbackPosition(null, province, 'province')
       await this.getCallbackPosition(this.formData.provinceId, city, 'city')
       await this.getCallbackPosition(this.formData.cityId, area, 'area')
-      await this.getCallbackPosition(this.formData.areaId, street, 'street')
+      const temp = this.areaList.find(k => this.formData.cityId == value)
+      if( temp && !Object.keys(this.specialCity).includes(temp.parentLbsId)){
+        await this.getCallbackPosition(this.formData.areaId, street, 'street')
+      }
     },
 
     /**
@@ -888,8 +913,16 @@ export default {
       const { data } = await getAutonaviRegion({ parentLbsId: id })
       this[name + 'List'] = data
       const temp = data.find(k => k[way] == value)
+        // 特殊处理市
+        if (name === 'area' && Object.keys(this.specialCity).includes(temp.parentLbsId)) {
+        this.streetList = [temp]
+        this.formData.streetId = temp.lbsId
+        this.handleArea(temp.lbsId, 'street')
+        return
+      }
       this.formData[name] = temp && temp.name
       this.formData[name + 'Id'] = temp && temp.lbsId
+
     },
     openPdf(item) {
       const link = document.createElement('a')