From 4a3c39d925294f9c173be18faf1d0de58455f8b1 Mon Sep 17 00:00:00 2001
From: lixuliang <lixuliang_hd@126.com>
Date: 星期六, 07 十月 2023 14:34:27 +0800
Subject: [PATCH] 查询接口统一

---
 src/api/api.js       |   16 ++++----
 src/api/request.js   |   37 ------------------
 src/assets/js/rpc.js |   56 ++++++++++++++++++++++++----
 static/mapData.js    |    2 
 4 files changed, 58 insertions(+), 53 deletions(-)

diff --git a/src/api/api.js b/src/api/api.js
index 843578f..c5ee2d1 100644
--- a/src/api/api.js
+++ b/src/api/api.js
@@ -4,28 +4,28 @@
 // export function yzAdapter_Navigation(params) {
 //     return service.get("/yzAdapter/Navigation", { params: params });
 // }
-
+//浼佷笟鍦板潃搴撴煡璇�
+export function ent_selectByName(params) {
+    return service.get(
+        "/ent/selectByName?name=" + params
+    );
+}
 //鍥尯鍦板潃搴撴煡璇�
 export function liushisijiayuanqudizhibianmafuwu(params) {
     return request.get(
         "/gisserver/rest/services/Locators/liushisijiayuanqudizhibianmafuwu/GeocodeServer/findAddressCandidates?singleLine=" + params
     );
 }
-// 鍦板潡鏌ヨ--鑾峰彇鍦板潡淇℃伅
+// 鍦板潡鏌ヨ
 export function findAddressCandidates(params) {
     return request.get(
         "/gisserver/rest/services/Locators/dikuaixinxi1005/GeocodeServer/findAddressCandidates?singleLine=" + params
     );
 }
 
-//鍦板潡鏌ヨ--鑾峰彇鍦板潡鑼冨洿
+//鑾峰彇鍦板潡鑼冨洿
 export function getDiKuanFanWei(lon, lat) {
     return request.get(
         "http://10.10.4.115:8022/geowinmap_xncs/ds?r=0.9158559377752831&serviceproviderid=map.vectorserviceprovider&serviceid=queryfeature&featcls=225%25E8%258C%2583%25E5%259B%25B4%25E5%2588%2586%25E5%258C%25BA%25E8%25A7%2584%25E5%2588%2592.geojson&lng=" + lon + "&lat=" + lat + "&geom=true&requesttype=json"
     )
 }
-export function ent_selectByName(params) {
-    return service.get(
-        "/ent/selectByName?name=" + params
-    );
-}
\ No newline at end of file
diff --git a/src/api/request.js b/src/api/request.js
index 8c7fb40..6af3879 100644
--- a/src/api/request.js
+++ b/src/api/request.js
@@ -9,28 +9,7 @@
     },
     withCredentials: true,
 });
-const GISSERVER = axios.create({
-    baseURL: 'http://10.10.4.116:8070/gisserver/', // api鐨刡ase_url
-    timeout: -1, // 璇锋眰瓒呮椂鏃堕棿
-});
-// gisserver 鍚嶅瓧鏌ヨ
-// export function queryPOI(servername, layer, name) {
-//     return GISSERVER.get("wfsserver/" + servername + "?version=1.3.0&request=GetFeature&format=json&typename=" + layer + "&propertyname=*&filter=%3CFilter%3E%3CPropertyIsLike+wildCard%3D%22*%22%3E%3CPropertyName%3E%E4%BA%95%E7%BC%96%E5%8F%B7%3C%2FPropertyName%3E%3CLiteral%3E" + name + "%3C%2FLiteral%3E%3C%2FPropertyIsLike%3E%3C%2FFilter%3E");
-// }
-// // gisserver 鑼冨洿鏌ヨ
-export function queryBySquare(url, layer, area) {
-    return GISSERVER.get(url, {
-        params: {
-            version: '1.3.0',
-            request: 'GetFeature',
-            typename: layer,
-            propertyname: '*',
-            format: "json",
-            filter: `<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"><ogc:Intersects><ogc:PropertyName /><gml:Polygon xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326"><gml:exterior><gml:LinearRing><gml:posList>${area}</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></ogc:Intersects></ogc:Filter>`,
-        }
-    });
-}
-// request interceptor
+
 request.interceptors.request.use(
     (config) => {
         // 璇锋眰鎼哄甫token
@@ -46,20 +25,6 @@
 );
 request.interceptors.response.use(
     (response) => {
-        //鐧诲綍涔嬪悗鏈塼oken
-        if (window.localStorage.getItem('TokenKey') != null) {
-            if (response.data.code !== 200) {
-                router.push('/login');
-                localStorage.removeItem("TokenKey");
-                localStorage.removeItem("TokenTime");
-            }
-            // //token杩囨湡杩斿洖鐧诲綍椤�
-            // if (response.data.code == 500104) {
-            //     router.push('/login')
-            //     localStorage.removeItem("TokenKey");
-            //     localStorage.removeItem("TokenTime");
-            // }
-        }
         return response.data;
     },
     (error) => {
diff --git a/src/assets/js/rpc.js b/src/assets/js/rpc.js
index e9b9cf8..163c5fc 100644
--- a/src/assets/js/rpc.js
+++ b/src/assets/js/rpc.js
@@ -83,15 +83,55 @@
             liushisijiayuanqudizhibianmafuwu(res),//鍥尯
             findAddressCandidates(res),//鍦板潡
         ]).then(result => {
-            var valdata = result[0];
-            var valdata1 = result[1];
-            if (valdata.length > 0) {
+            let objArr = []
+            //浼佷笟
+            var EntArr = result[0].result.filter((item) => {
+                return item.entName.includes(res);
+            })
+            EntArr.forEach((val) => {
+                let itemObj = {
+                    type: "浼佷笟",
+                    name: val.entName,
+                    address: val.address,
+                    lon: val.x,
+                    lat: val.y,
+                };
+                objArr.push(itemObj);
+            });
+            //鍥尯
+            var YQArr = result[1].candidates.filter((item) => {
+                return item.attributes.YQmingchen.includes(res);
+            });
+            YQArr.forEach((val) => {
+                let itemObj = {
+                    type: "鍥尯",
+                    name: val.attributes.YQmingchen,
+                    address: val.attributes.YQdizhi,
+                    lon: val.location.x,
+                    lat: val.location.y,
+                };
+                objArr.push(itemObj);
+            });
+            //鍦板潡
+            var LandArr = result[2].candidates.filter((item) => {
+                return item.attributes.QYMC.includes(res);
+            })
 
-            }
-            if (valdata1.length > 0) {
-
-            }
-
+            LandArr.forEach((val) => {
+                let itemObj = {
+                    type: "鍦板潡",
+                    name: val.attributes.QYMC,
+                    area: val.attributes.area,
+                    lon: val.location.x,
+                    lat: val.location.y,
+                };
+                objArr.push(itemObj);
+            });
+            console.log(EntArr);
+            console.log(YQArr);
+            console.log(LandArr);
+            console.log(objArr);
+            debugger
         })
 
 
diff --git a/static/mapData.js b/static/mapData.js
index 59d470c..741f227 100644
--- a/static/mapData.js
+++ b/static/mapData.js
@@ -1,7 +1,7 @@
 const mapData = {
 
     apiUrl: 'http://10.10.4.121:8070/',    //鎺ュ彛璋冪敤鍦板潃
-    apiUrl1: 'http://10.10.4.116:8088/',    //鎺ュ彛璋冪敤鍦板潃
+    apiUrl1: 'http://10.10.4.121:8070/PoiExcel',    //鎺ュ彛璋冪敤鍦板潃
     mapRest: {
         lng: -2189208.281391369, //缁忓害0
         lat: 4391302.729127172, //绾害

--
Gitblit v1.9.3