From c6df06bd690486739067ee1ee7124ac66da720fb Mon Sep 17 00:00:00 2001 From: 少年 <1392120328@qq.com> Date: 星期二, 27 二月 2024 14:23:32 +0800 Subject: [PATCH] youhua --- src/utils/map2.js | 343 ++++++++++++++++++++++++++++---------------------------- 1 files changed, 170 insertions(+), 173 deletions(-) diff --git a/src/utils/map2.js b/src/utils/map2.js index 02b51c5..c3571bc 100644 --- a/src/utils/map2.js +++ b/src/utils/map2.js @@ -134,7 +134,7 @@ ) // axios.get(window.gisBaseUrl + '/gisserver/wfsserver/qiyelianqiye?version=1.3.0&request=GetFeature&format=json&typename=浼佷笟閾句紒涓�') .then(dataSource => { - console.log(dataSource); + // console.log(dataSource); store.qiyeJsonInfo = dataSource }) .catch((err) => { @@ -2252,6 +2252,7 @@ .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=" + window.gisBaseUrl + "yzxncsApi/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=" + + // window.gisBaseUrl + "cs/geowinmap_xncs/ds?&lng=" + e.coordinate[0] + "&lat=" + e.coordinate[1] + @@ -2269,200 +2270,196 @@ window.tdglLine = new ol.layer.Vector({ source: new ol.source.Vector({ features: [feature] // 灏嗚绱犲璞″姞鍏ュ埌鍥惧眰婧愪腑 + }), + style: new ol.style.Style({ + stroke: new ol.style.Stroke({ + color: 'red', + width: 3 + }), }) }); window.mapapi.addLayer(window.tdglLine) - axios - .get( - // "http://10.10.4.115:8022//poisearch/guihuacon/getInfo?ydbm=" + - window.gisBaseUrl + "yzxncsApi/poisearch/guihuacon/getInfo?ydbm=" + - response.data.NO - ) - .then( - info => { - let data = info.data.data; - if (data.yongdishuju === null) { - objdata = { - POITYPE: "NOTDGL", - zwxx: "鏆傛棤淇℃伅", - lon: window.clickPOI.lon, - lat: window.clickPOI.lat, - } - } else { - qiyexinxi = info.data.data.qiyexinxi; - qysl = data.qiyexinxi.length; - if (qysl > 0) { - ydbm = data.qiyexinxi[0]["鍦板潡缂栧彿"]; - } else { - ydbm = data.churangxinxi["ydbh"]; - } - try { - ydlx = data.yongdishuju["ydlxmc"]; - } catch (e) { } - try { - cyfx = data.yongdishuju["cyfx"]; - } catch (e) { } - try { - // this.crzt = response.data["ZT"]; - switch (response.data["ZT"]) { - case 3: - crzt = "宸插嚭璁�"; - break; - case 4: - crzt = "鏈嚭璁�"; - break; - } - } catch (e) { } - try { - ydmj = parseFloat( - "" + data.yongdishuju["ydmj"] - ).toFixed(0); - } catch (e) { } - try { - crnx = data.churangxinxi["crnx"]; - } catch (e) { } - try { - crnf = data.churangxinxi["crnf"]; - } catch (e) { } - try { - rjl = data.yongdishuju["rjl"]; - } catch (e) { } - try { - jzxg = data.yongdishuju["jzxg"]; - } catch (e) { } - try { - jzmd = data.yongdishuju["jzmd"]; - } catch (e) { } - objdata = { - POITYPE: "TDGL", - ydbm, - ydlx, - cyfx, - crzt, - ydmj, - ydbm, - crnx, - crnf, - rjl, - jzxg, - jzmd, - lon: e.coordinate[0], - lat: e.coordinate[1], - } - } - - store.setTdglShow(false); - store.setTdlgInfo({}); - store.setTdglShow(true); - store.setTdlgInfo(objdata); + axios.get( + // "http://10.10.4.115:8022//poisearch/guihuacon/getInfo?ydbm=" + + window.gisBaseUrl + "yzxncsApi/poisearch/guihuacon/getInfo?ydbm=" + response.data.NO + ).then((info) => { + let data = info.data.data; + if (data.yongdishuju === null) { + objdata = { + POITYPE: "NOTDGL", + zwxx: "鏆傛棤淇℃伅", + lon: e.coordinate[0], + lat: e.coordinate[1], } - ); + } else { + qiyexinxi = info.data.data.qiyexinxi; + qysl = data.qiyexinxi.length; + if (qysl > 0) { + ydbm = data.qiyexinxi[0]["鍦板潡缂栧彿"]; + } else { + ydbm = data.churangxinxi["ydbh"]; + } + try { + ydlx = data.yongdishuju["ydlxmc"]; + } catch (e) { } + try { + cyfx = data.yongdishuju["cyfx"]; + } catch (e) { } + try { + // this.crzt = response.data["ZT"]; + switch (response.data["ZT"]) { + case 3: + crzt = "宸插嚭璁�"; + break; + case 4: + crzt = "鏈嚭璁�"; + break; + } + } catch (e) { } + try { + ydmj = parseFloat( + "" + data.yongdishuju["ydmj"] + ).toFixed(0); + } catch (e) { } + try { + crnx = data.churangxinxi["crnx"]; + } catch (e) { } + try { + crnf = data.churangxinxi["crnf"]; + } catch (e) { } + try { + rjl = data.yongdishuju["rjl"]; + } catch (e) { } + try { + jzxg = data.yongdishuju["jzxg"]; + } catch (e) { } + try { + jzmd = data.yongdishuju["jzmd"]; + } catch (e) { } + objdata = { + POITYPE: "TDGL", + ydbm, + ydlx, + cyfx, + crzt, + ydmj, + ydbm, + crnx, + crnf, + rjl, + jzxg, + jzmd, + lon: e.coordinate[0], + lat: e.coordinate[1], + } + } + + store.setTdglShow(false); + store.setTdlgInfo({}); + store.setTdglShow(true); + store.setTdlgInfo(objdata); + } + ); }) return; } window.mapapi.forEachFeatureAtPixel(e.pixel, function (feature) { - let properties = feature.getProperties().features[0].values_; - console.log(properties, 'aaa'); - console.log(properties.values_, 'bbb'); - for (const propertyNames in properties) { - if (propertyNames.indexOf("鐩戞帶鍚�") !== -1) { - // objdata = { - // POITYPE: "SPJK", - // name: properties["JK鍚嶇О"]._value, - // type: properties["JK绫诲瀷"]._value, - // function: properties["鍔熻兘"]._value, - // area: properties["鎵�鍦ㄥ尯"]._value, - // number: properties["JK缂栧彿"]._value, - // code: properties["JK鍐呯爜"]._value, - // lon: lon, - // lat: lat, - // } - Message({ - message: '杩炴帴鐘舵�佹煡璇腑', - type: 'info', - offset: 60, - center: true, - duration: 1000, - }); - layerOpen(properties["JK鍚嶇О"]._value, { - width: "100%", - height: "40%", - // offset: [offsetTop + "px", "380px"], - url: "../../static/video/video.html?code=" + properties["JK鍐呯爜"]._value, - fn: { - success: (layero, index) => { - SmartEarthPopupData.layerContainer = layero; - }, - end: () => { + console.log(feature.getProperties(), 'aaa'); - }, - cancel: () => { - - }, - }, - }); - return - } else if (propertyNames.indexOf("閮ㄤ欢鍚嶇О") !== -1) { - objdata = { - // 鐐逛綅绫诲瀷锛堜腑鑻辨枃閰嶇疆琛╬oiKeys.js) - POITYPE: "CSBJ", - // 灞曠ず瀛楁 - name: properties["閮ㄤ欢鍚嶇О"], - address: properties["瀹夎鍦板潃"], - code: properties["閮ㄤ欢缂栫爜"], - type: properties["閮ㄤ欢绫诲瀷"], - // 寮规缁忕含搴� - lon: properties["Longtitude"], - lat: properties["Latitude"], - } - } else if (propertyNames.indexOf("浜曠紪鍙�") !== -1) { - objdata = { - POITYPE: "YINJ", - name: properties["浜曞悕绉�"], - depth: properties["浜曟繁"], - type: properties["浜曠被鍨�"], - location: properties["浣嶇疆"], - code: properties["浜曠紪鍙�"], - lon: properties["Longtitude"], - lat: properties["Latitude"], - } - } else if (propertyNames.indexOf("QYMC") !== -1) { - objdata = { - POITYPE: "QY", - QYMC: properties["QYMC"], - XYDM: properties["XYDM"], - BZDZ: properties["BZDZ"], - DZ: properties["DZ"], - lon: properties["Longtitude"], - lat: properties["Latitude"], - } - } - } - - if (feature && feature.values_.desc) { - let obj = feature.values_.desc + //鎼滅储鐨勭偣浣� + if (window.pointArr.length > 0) { + let obj = feature.getProperties().desc objdata = { POITYPE: "POINT", name: obj.name, address: obj.address, } + } else { + let properties = feature.getProperties().features[0].values_; + for (const propertyNames in properties) { + if (propertyNames.indexOf("鐩戞帶鍚�") !== -1) { + // objdata = { + // POITYPE: "SPJK", + // name: properties["JK鍚嶇О"]._value, + // type: properties["JK绫诲瀷"]._value, + // function: properties["鍔熻兘"]._value, + // area: properties["鎵�鍦ㄥ尯"]._value, + // number: properties["JK缂栧彿"]._value, + // code: properties["JK鍐呯爜"]._value, + // lon: lon, + // lat: lat, + // } + Message({ + message: '杩炴帴鐘舵�佹煡璇腑', + type: 'info', + offset: 60, + center: true, + duration: 1000, + }); + layerOpen(properties["JK鍚嶇О"], { + width: "100%", + height: "40%", + // offset: [offsetTop + "px", "380px"], + url: "../../static/video/video.html?code=" + properties["JK鍐呯爜"], + fn: { + success: (layero, index) => { + SmartEarthPopupData.layerContainer = layero; + }, + end: () => { + }, + cancel: () => { - // if (window.instance) { - // window.instance.$destroy(); - // } - // window.instance = new PoiLayerConstructor({ - // data: { - // list: objdata - // } - // }); - // window.instance.$mount(); + }, + }, + }); + return + } else if (propertyNames.indexOf("閮ㄤ欢鍚嶇О") !== -1) { + objdata = { + // 鐐逛綅绫诲瀷锛堜腑鑻辨枃閰嶇疆琛╬oiKeys.js) + POITYPE: "CSBJ", + // 灞曠ず瀛楁 + name: properties["閮ㄤ欢鍚嶇О"], + address: properties["瀹夎鍦板潃"], + code: properties["閮ㄤ欢缂栫爜"], + type: properties["閮ㄤ欢绫诲瀷"], + // 寮规缁忕含搴� + lon: properties["Longtitude"], + lat: properties["Latitude"], + } + } else if (propertyNames.indexOf("浜曠紪鍙�") !== -1) { + objdata = { + POITYPE: "YINJ", + name: properties["浜曞悕绉�"], + depth: properties["浜曟繁"], + type: properties["浜曠被鍨�"], + location: properties["浣嶇疆"], + code: properties["浜曠紪鍙�"], + lon: properties["Longtitude"], + lat: properties["Latitude"], + } + } else if (propertyNames.indexOf("QYMC") !== -1) { + objdata = { + POITYPE: "QY", + QYMC: properties["QYMC"], + XYDM: properties["XYDM"], + BZDZ: properties["BZDZ"], + DZ: properties["DZ"], + lon: properties["Longtitude"], + lat: properties["Latitude"], + } + } + } } + + + + store.setTdglShow(false); store.setTdlgInfo({}); store.setdwShow(true); -- Gitblit v1.9.3