Browse Source

获取区位状况数据修改

wucl 7 months ago
parent
commit
bd36b1385c

+ 4 - 0
src/api/houseGuarantyArea.js

@@ -9,6 +9,10 @@ const houseTargetArea = {
     getByLngLat(param){
         return request.get(`/houseGuarantyArea/lngLat?lngLat=${param}`)
     },
+
+    getByDocIdTidTNo(param1,param2,param3){
+        return request.get(`/houseGuarantyArea/ids?docId=${param1}&tid=${param2}&tno=${param3}`)
+    }
    
   
 

+ 3 - 3
src/components/MapContainer/index.vue

@@ -122,7 +122,7 @@ export default {
         //道路信息
         collectRoad(redius, lnglat) {
             if (lnglat) {
-                const types = ["190300|190301|190302|190303|190304|190305|190306|190307|190308|190309|190310|190311"];
+                const types = ["190301"];
                 amap.getAroundPOI(redius, lnglat, types).then(res => {
                     if (res.status == "1") {
                         res.infoType = "ROAD"
@@ -147,7 +147,7 @@ export default {
         //停车场
         colletPark(redius, lnglat) {
             if (lnglat) {
-                const types = ["150900|150903|150904|150905|150906|150907|150908|150909"];
+                const types = ["150900|150903|150904|150905|150906"];
                 amap.getAroundPOI(redius, lnglat, types).then(res => {
                     if (res.status == "1") {
                         res.infoType = "PARK"
@@ -183,7 +183,7 @@ export default {
         //教育机构
         collectEducation(redius, lnglat) {
             if (lnglat) {
-                const types = ["141200|141201|141202|141203|141204|141205|141206|141207"];
+                const types = ["141200|141201|141202|141203|141204"];
                 amap.getAroundPOI(redius, lnglat, types).then(res => {
                     if (res.status == "1") {
                         res.infoType = "EDUCATION"

+ 199 - 65
src/views/house/workbench/guarantyResult.vue

@@ -35,7 +35,7 @@
                         <el-table-column label="操作" width="160" align="center">
                             <template v-slot="scope">
                                 <el-button type="text" @click="addEntityInfo(scope.row.tid, scope.row.tno)">实物信息</el-button>
-                                <el-button type="text" @click="getAreaInfoByLngLat(scope.row.lngLat)">区位信息</el-button>
+                                <el-button type="text" @click="getAreaInfoByLngLat(scope.row.lngLat,scope.row.docId,scope.row.tid, scope.row.tno,scope.row.location)">区位信息</el-button>
                             </template>
                         </el-table-column>
                     </el-table>
@@ -520,6 +520,7 @@
         </el-dialog>
 
         <el-dialog v-model="areaInfoDialog" width="85%" align-center @closed="cleanLngLat">
+            <h2>估价对象{{ tId }}序号{{ tNo }}</h2>
             <div class="infoType">
                 <el-divider content-position="left">
                     <span  class="infoTitle">道路</span>
@@ -533,8 +534,8 @@
                 </el-tooltip>
                 </el-divider>
                 <div style="padding-left: 100px;">
-                    <span class="infoItem" closable type="primary" v-for="(r ,index) in road">
-                    {{ r.name }}
+                    <span class="infoItem" closable type="primary" v-for="(r ,index) in areaInfo.road" @click="removeRoad(r)">
+                    {{(index+1) +'、'+ r }}
                     </span>
                 </div>
             </div>
@@ -551,8 +552,8 @@
                 </el-tooltip>
                 </el-divider>
                 <div style="padding-left: 100px;">
-                    <span class="infoItem" closable type="primary" v-for="(r ,index) in publicTransport">
-                    {{ r.name }}
+                    <span class="infoItem" closable type="primary" v-for="(r ,index) in areaInfo.publicTransport" @click="removePublicTransport(r)">
+                        {{(index+1) +'、'+ r }}
                     </span>
                 </div>
             </div>
@@ -569,8 +570,8 @@
                 </el-tooltip>
                 </el-divider>
                 <div style="padding-left: 100px;">
-                    <span class="infoItem" closable type="primary" v-for="(r ,index) in park">
-                    {{ r.name }}
+                    <span class="infoItem" closable type="primary" v-for="(r ,index) in areaInfo.park" @click="removePark(r)">
+                        {{(index+1) +'、'+ r }}
                     </span>
                 </div>
             </div>
@@ -587,8 +588,8 @@
                 </el-tooltip>
                 </el-divider>
                 <div style="padding-left: 100px;">
-                    <span class="infoItem" closable type="primary" v-for="(r ,index) in business">
-                    {{ r.name }}
+                    <span class="infoItem" closable type="primary" v-for="(r ,index) in areaInfo.business" @click="removeBusiness(r)">
+                        {{(index+1) +'、'+ r}}
                     </span>
                 </div>
             </div>
@@ -605,8 +606,8 @@
                 </el-tooltip>
                 </el-divider>
                 <div style="padding-left: 100px;">
-                    <span class="infoItem" closable type="primary" v-for="(r ,index) in community">
-                    {{ r.name }}
+                    <span class="infoItem" closable type="primary" v-for="(r ,index) in areaInfo.community" @click="removeCommunity(r)">
+                        {{(index+1) +'、'+ r }}
                     </span>
                 </div>
             </div>
@@ -623,8 +624,8 @@
                 </el-tooltip>
                 </el-divider>
                 <div style="padding-left: 100px;">
-                    <span class="infoItem" closable type="primary" v-for="(r ,index) in education">
-                    {{ r.name }}
+                    <span class="infoItem" closable type="primary" v-for="(r ,index) in areaInfo.education" @click="removeEducation(r)">
+                        {{(index+1) +'、'+ r }}
                     </span>
                 </div>
             </div>
@@ -641,8 +642,8 @@
                 </el-tooltip>
                 </el-divider>
                 <div style="padding-left: 100px;">
-                    <span class="infoItem" closable type="primary" v-for="(r ,index) in hospital">
-                    {{ r.name }}
+                    <span class="infoItem" closable type="primary" v-for="(r ,index) in areaInfo.hospital" @click="removeHospital(r)">
+                        {{(index+1) +'、'+ r }}
                     </span>
                 </div>
             </div>
@@ -659,8 +660,8 @@
                 </el-tooltip>
                 </el-divider>
                 <div style="padding-left: 100px;">
-                    <span class="infoItem" closable type="primary" v-for="(r ,index) in bank">
-                    {{ r.name }}
+                    <span class="infoItem" closable type="primary" v-for="(r ,index) in areaInfo.bank" @click="removeBank(r)">
+                        {{(index+1) +'、'+ r }}
                     </span>
                 </div>
             </div>
@@ -677,8 +678,8 @@
                     </el-tooltip>
                 </el-divider>
                 <div style="padding-left: 100px;">
-                    <span class="infoItem" closable type="primary" v-for="(r ,index) in hotel">
-                    {{ r.name }}
+                    <span class="infoItem" closable type="primary" v-for="(r ,index) in areaInfo.hotel" @click="removeHotel(r)">
+                        {{(index+1) +'、'+ r }}
                     </span>
                 </div>
             </div>
@@ -695,11 +696,19 @@
                     </el-tooltip>
                 </el-divider>
                 <div style="padding-left: 100px;">
-                    <span class="infoItem" closable type="primary" v-for="(r ,index) in spot">
-                    {{ r.name }}
+                    <span class="infoItem" closable type="primary" v-for="(r ,index) in areaInfo.spot" @click="removeSpot(r)">
+                        {{(index+1) +'、'+ r.name }}
                     </span>
                 </div>
             </div>
+            <template #footer>
+                <div class="dialog-footer">
+                    <el-button @click="entityInfoDialog = false">取消</el-button>
+                    <el-button type="primary" @click="saveAreaInfo()">
+                        保存
+                    </el-button>
+                </div>
+            </template>
         </el-dialog>
 
     </div>
@@ -786,22 +795,31 @@ export default {
             },
             tId: null,
             tNo: null,
-            
+            location:null,
             targetPoint:[],
             mapDialog:false,
             areaInfoDialog:false,
-            road:[],
-            publicTransport:[],
-            park:[],
-            business:[],
-            community:[],
-            education:[],
-            hospital:[],
-            bank:[],
-            hotel:[],
-            spot:[],
+            areaInfo:{
+                docId:null,
+                tid:null,
+                tno:null,
+                lng:null,
+                lat:null,
+                road:[],
+                publicTransport:[],
+                park:[],
+                business:[],
+                community:[],
+                education:[],
+                hospital:[],
+                bank:[],
+                hotel:[],
+                spot:[],
+            },
             redius:'1000',
-            curLngLat:null
+            curLngLat:null,
+            lng:null,
+            lat:null
 
         }
     },
@@ -928,61 +946,107 @@ export default {
         },
         getPOIData(data){
             if (data.infoType=='ROAD'){
-                this.road = data.pois
+                this.areaInfo.road = data.pois.map(item=>item.name)
             }
             if (data.infoType=='PUBLIC-TRANSPORT'){
-                this.publicTransport = data.pois
+                this.areaInfo.publicTransport = data.pois.map(item=>item.name)
             }
             if (data.infoType=='PARK'){
-                this.park = data.pois
+                this.areaInfo.park = data.pois.map(item=>item.name)
             }
             if (data.infoType=='BUSINESS'){
-                this.business = data.pois
+                this.areaInfo.business = data.pois.map(item=>item.name)
             }
             if (data.infoType=='COMMUNITY'){
-                this.community = data.pois
+                this.areaInfo.community = data.pois.map(item=>item.name)
             }
             if (data.infoType=='EDUCATION'){
-                this.education = data.pois
+                this.areaInfo.education = data.pois.map(item=>item.name)
             }
             if (data.infoType=='HOSPITAL'){
-                this.hospital = data.pois
+                this.areaInfo.hospital = data.pois.map(item=>item.name)
             }
             if (data.infoType=='BANK'){
-                this.bank = data.pois
+                this.areaInfo.bank = data.pois.map(item=>item.name)
             }
             if (data.infoType=='HOTEL'){
-                this.hotel = data.pois
+                this.areaInfo.hotel = data.pois.map(item=>item.name)
             }
             if (data.infoType=='SPOT'){
-                this.spot = data.pois
+                this.areaInfo.spot = data.pois
             }
            
         },
 
-        getAreaInfoByLngLat(lngLat){
-            houseTargetArea.getByLngLat(lngLat).then(res=>{
+        getAreaInfoByLngLat(lngLat,docId,tid,tno,location){
+            this.tId = tid;
+            this.tNo = tno;
+            this.docId = docId;
+            this.location = location;
+            let lngLats = lngLat.split(",");
+            this.lng = lngLats[0];
+            this.lat = lngLats[1];
+            this.areaInfoDialog = true;
+            //先查询保存的区位信息
+            houseTargetArea.getByDocIdTidTNo(docId,tid,tno).then(res=>{
                 if (res.code===200 && res.data!=null){
-                    
-                }else{
-                    this.getAMapInfo();
+                    this.areaInfo.id = res.data.id;
+                    this.areaInfo.tid = res.data.id;
+                    this.areaInfo.tno = res.data.id;
+                    this.areaInfo.lat = res.data.id;
+                    this.areaInfo.lng = res.data.id;
+                    this.areaInfo.road = JSON.parse(res.data.road);
+                    this.areaInfo.publicTransport = JSON.parse(res.data.publicTransport);
+                    this.areaInfo.park = JSON.parse(res.data.park);
+                    this.areaInfo.business = JSON.parse(res.data.business);
+                    this.areaInfo.community = JSON.parse(res.data.community);
+                    this.areaInfo.education = JSON.parse(res.data.education);
+                    this.areaInfo.hospital = JSON.parse(res.data.hospital);
+                    this.areaInfo.bank = JSON.parse(res.data.bank);
+                    this.areaInfo.hotel = JSON.parse(res.data.hotel);
+                    this.areaInfo.spot = JSON.parse(res.data.spot);
+                }else {
+                     //再根据经纬度范围查询
+                    houseTargetArea.getByLngLat(lngLat).then(res=>{
+                        if (res.code===200 && res.data!=null){
+                            this.areaInfo.road = JSON.parse(res.data.road);
+                            this.areaInfo.publicTransport = JSON.parse(res.data.publicTransport);
+                            this.areaInfo.park = JSON.parse(res.data.park);
+                            this.areaInfo.business = JSON.parse(res.data.business);
+                            this.areaInfo.community = JSON.parse(res.data.community);
+                            this.areaInfo.education = JSON.parse(res.data.education);
+                            this.areaInfo.hospital = JSON.parse(res.data.hospital);
+                            this.areaInfo.bank = JSON.parse(res.data.bank);
+                            this.areaInfo.hotel = JSON.parse(res.data.hotel);
+                            this.areaInfo.spot = JSON.parse(res.data.spot);
+                        }else{
+                            //调用高德API接口获取
+                            this.getAMapInfo(lngLat)
+                        }
+                        
+                    })
                 }
-                this.areaInfoDialog = true;
             })
         },
 
-        getAMapInfo(lngLat){
+        async getAMapInfo(lngLat){
             this.curLngLat = lngLat;
             this.$refs.map.collectRoad(this.redius,lngLat);
             this.$refs.map.collectPublicTransport(this.redius,lngLat);
             this.$refs.map.colletPark(this.redius,lngLat);
+            // 规避高德接口QPS限制
+            await this.sleep(1000);
             this.$refs.map.collectBusiness(this.redius,lngLat);
             this.$refs.map.collectCommunity(this.redius,lngLat);
-            // this.$refs.map.collectEducation(this.redius,lngLat);
-            // this.$refs.map.collectHospital(this.redius,lngLat);
-            // this.$refs.map.collectBank(this.redius,lngLat);
-            // this.$refs.map.collectHotal(this.redius,lngLat);
-            // this.$refs.map.collectSpot(this.redius,lngLat);
+            this.$refs.map.collectEducation(this.redius,lngLat);
+            // 规避高德接口QPS限制
+            await this.sleep(1000);
+            this.$refs.map.collectHospital(this.redius,lngLat);
+            this.$refs.map.collectBank(this.redius,lngLat);
+            this.$refs.map.collectHotal(this.redius,lngLat);
+            // 规避高德接口QPS限制
+            await this.sleep(1000);
+            this.$refs.map.collectSpot(this.redius,lngLat);
             
         },
         refreshRoad(){
@@ -1018,16 +1082,86 @@ export default {
         },
         cleanLngLat(){
             this.curLngLat=null;
-            this.road=[];
-            this.publicTransport=[];
-            this.park=[];
-            this.business=[];
-            this.community=[];
-            this.education=[];
-            this.hospital=[];
-            this.bank=[];
-            this.hotel=[];
-            this.spot=[];
+            this.location = null;
+            this.lng = null,
+            this.lat = null,
+            this.areaInfo.id=null,
+            this.areaInfo.tid=null,
+            this.areaInfo.tno=null,
+            this.areaInfo.lng = null,
+            this.areaInfo.lat = null,
+            this.areaInfo.road=[];
+            this.areaInfo.publicTransport=[];
+            this.areaInfo.park=[];
+            this.areaInfo.business=[];
+            this.areaInfo.community=[];
+            this.areaInfo.education=[];
+            this.areaInfo.hospital=[];
+            this.areaInfo.bank=[];
+            this.areaInfo.hotel=[];
+            this.areaInfo.spot=[];
+        },
+        removeRoad(i){
+           this.areaInfo.road = this.areaInfo.road.filter(item=>item!=i);
+        },
+        removePublicTransport(i){
+           this.areaInfo.publicTransport = this.areaInfo.publicTransport.filter(item=>item!=i);
+        },
+        removeBusiness(i){
+           this.areaInfo.business = this.areaInfo.business.filter(item=>item!=i);
+        },
+        removeCommunity(i){
+           this.areaInfo.community = this.areaInfo.community.filter(item=>item!=i);
+        },
+        removeEducation(i){
+           this.areaInfo.education = this.areaInfo.education.filter(item=>item!=i);
+        },
+        removeHospital(i){
+           this.areaInfo.hospital = this.areaInfo.hospital.filter(item=>item!=i);
+        },
+        removePark(i){
+           this.areaInfo.park = this.areaInfo.park.filter(item=>item!=i);
+        },
+        removeHotel(i){
+           this.areaInfo.hotel = this.areaInfo.hotel.filter(item=>item!=i);
+        },
+        removeBank(i){
+           this.areaInfo.bank = this.areaInfo.bank.filter(item=>item!=i);
+        },
+        removeSpot(i){
+           this.areaInfo.spot = this.areaInfo.spot.filter(item=>item.name!=i.name);
+        },
+        saveAreaInfo(){
+            this.areaInfoDialog = false;
+            this.areaInfo.docId = this.docId;
+            this.areaInfo.tid = this.tId;
+            this.areaInfo.tno = this.tNo;
+            this.areaInfo.lng = this.lng;
+            this.areaInfo.lat = this.lat;
+            this.areaInfo.location = this.location;
+            this.areaInfo.road = JSON.stringify(this.areaInfo.road);
+            this.areaInfo.publicTransport = JSON.stringify(this.areaInfo.publicTransport);
+            this.areaInfo.park = JSON.stringify(this.areaInfo.park);
+            this.areaInfo.business = JSON.stringify(this.areaInfo.business);
+            this.areaInfo.community = JSON.stringify(this.areaInfo.community);
+            this.areaInfo.education = JSON.stringify(this.areaInfo.education);
+            this.areaInfo.hospital = JSON.stringify(this.areaInfo.hospital);
+            this.areaInfo.bank = JSON.stringify(this.areaInfo.bank);
+            this.areaInfo.hotel = JSON.stringify(this.areaInfo.hotel);
+            this.areaInfo.spot = JSON.stringify(this.areaInfo.spot);
+            houseTargetArea.save(this.areaInfo).then(res=>{
+                if (res.code ===200 && res.data){
+                    ElMessage({
+                        message: '区位状况保存成功',
+                        type: 'success',
+                        plain: true
+                    })
+                }
+            })
+        },
+
+        sleep(delay){
+            return new Promise((resolve) => setTimeout(resolve,delay))
         }
 
     }