| 1 |
- webpackJsonp([55],{"0iRj":function(e,t){},"0j/3":function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={components:{},data:function(){return{canvasdisplay:!0,loading:!1,map:null,input:"",mapData:[{projectname:"开封杞县棉花地示范基地",uuid:1,latlng:[114.8461166670838,34.522288338939966],Baselocation:[[114.84656727880235,34.526177648447764],[114.85487139791252,34.524975517085004],[114.85379851430656,34.520025381600824],[114.84645999044182,34.52412694332343]],equipmentlocation:[{name:"杀虫灯",location:[114.84793086826971,34.523960624495004],type:2,device_id:"866193059738670"}],Basename:"yunfei:mianhuadi",basemap:[12784000.7946435,4099326.1330051636,12784445.839692106,4099751.466643372]},{projectname:"郑州北三环高架示范基地",uuid:2,latlng:[113.681471,34.810371],Baselocation:[[113.68044114500282,34.8116659861797],[113.68293023496864,34.811710029809625],[113.68289804846046,34.81004516422494],[113.6804196873307,34.81008920872117]],equipmentlocation:[{name:"测报灯",location:[113.68258608341216,34.811427520353476],type:1,device_id:"866193059738670"},{name:"性诱",location:[113.68186796620489,34.81136419088646],type:3,device_id:"866193059738670"}],Basename:"yunfei:beisanhuan",basemap:[12654161.262852995,4138228.39035618,12654499.539666897,4138560.780442763]},{projectname:"河南省开封市尉氏县基地",uuid:3,latlng:[114.19284,34.41223],Baselocation:[],equipmentlocation:[],Basename:"yunfei:weishi",basemap:[12720250.438352395,4077648.4271950293,12722174.052177684,4079390.7616211823]}],dialogbaseinfo:!1,device_id:"",zoom:10,deviceinfo:{},equipListactive:0,aerialmap:null,drawVector:null,isDraw:!0,source:null,drawarr:[]}},computed:{},watch:{},methods:{init:function(e){var t=this,o="http://8.136.98.49:18080/geoserver/gwc/service/wmts",i=e.Basename,a=new ol.proj.Projection({code:"EPSG:900913",units:"m",axisOrientation:"neu"}),n=[156543.03390625,78271.516953125,39135.7584765625,19567.87923828125,9783.939619140625,4891.9698095703125,2445.9849047851562,1222.9924523925781,611.4962261962891,305.74811309814453,152.87405654907226,76.43702827453613,38.218514137268066,19.109257068634033,9.554628534317017,4.777314267158508,2.388657133579254,1.194328566789627,.5971642833948135,.2985821416974068,.1492910708487034,.0746455354243517,.0373227677121758,.0186613838560879,.009330691928044,.004665345964022,.002332672982011,.0011663364910055,.0005831682455027,.0002915841227514,.0001457920613757],r=["VERSION","LAYER","STYLE","TILEMATRIX","TILEMATRIXSET","SERVICE","FORMAT"],l={VERSION:"1.0.0",LAYER:i,STYLE:"",TILEMATRIX:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30"],TILEMATRIXSET:"EPSG:900999256",SERVICE:"WMTS",FORMAT:"image/png"},c=this;function s(){var e=o+"?";for(var t in l)r.indexOf(t.toUpperCase())<0&&(e=e+t+"="+l[t]+"&");e=e.slice(0,-1);var i=new ol.source.WMTS({url:e,layer:l.LAYER,matrixSet:l.TILEMATRIXSET,format:l.FORMAT,projection:a,tileGrid:new ol.tilegrid.WMTS({tileSize:[256,256],extent:[-20037508.34,-20037508.34,20037508.34,20037508.34],origin:[-20037508.34,20037508.34],resolutions:n,matrixIds:l.TILEMATRIX}),style:l.STYLE,wrapX:!0});return i.on("tileloadend",function(){c.loading=!1}),i.on("tileloaderror",function(){return!1}),i}var d=new ol.layer.Vector({source:new ol.source.Vector,style:new ol.style.Style({fill:new ol.style.Fill({color:"rgba(0, 0, 0, 0.3)"}),stroke:new ol.style.Stroke({color:"blue",width:2}),image:new ol.style.Circle({radius:10,fill:new ol.style.Fill({color:"#ffcc33"})})})});window.setParam=function(e,t){"STYLES"==e&&(e="STYLE"),l[e]=t,h.setSource(s()),T.updateSize()};var u=e.equipmentlocation;console.log(u);for(var p,f=[],v=0;v<u.length;v++){var m=gcoord.transform(u[v].location,gcoord.GCJ02,gcoord.EPSG3857),w=new ol.Feature({geometry:new ol.geom.Point(m),name:u[v].name,population:{name:u[v].name,type:u[v].type,device_id:u[v].device_id,location:u[v].location}});w.setStyle((p=w,new ol.style.Style({image:new ol.style.Icon({anchor:[.5,60],anchorOrigin:"top-right",anchorXUnits:"fraction",anchorYUnits:"pixels",offsetOrigin:"top-right",opacity:.75,src:"../../../../static/images/jidi2.png"}),text:new ol.style.Text({textAlign:"center",textBaseline:"middle",font:"normal 14px 微软雅黑",text:p.get("name"),fill:new ol.style.Fill({color:"#aa3300"}),stroke:new ol.style.Stroke({color:"#ffcc33",width:2})})}))),f.push(w)}console.log(f);var g=new ol.source.Vector({features:f}),y=new ol.layer.Vector({source:g}),h=new ol.layer.Tile({source:s()}),_=new ol.View({center:[0,0],zoom:2,resolutions:n,projection:a,extent:[-20037508.34,-20037508.34,20037508.34,20037508.34]}),S=new ol.layer.Tile({source:new ol.source.XYZ({url:"http://t3.tianditu.com/DataServer?T=ibo_w&x={x}&y={y}&l={z}&tk=6e5cb1bfc017afcac7a21836cf81a884"})}),b=new ol.layer.Tile({source:new ol.source.XYZ({url:"http://t3.tianditu.com/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=6e5cb1bfc017afcac7a21836cf81a884"})}),E=new ol.layer.Tile({source:new ol.source.XYZ({url:"http://t3.tianditu.com/DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=6e5cb1bfc017afcac7a21836cf81a884"})});!function(){console.log(1);var e=new ol.geom.Polygon([[12784044.16788278,4099716.7547807167],[12784038.196239945,4099577.0183384023],[12784366.636595812,4099359.650539247],[12784429.936009852,4099624.791481074],[12784044.16788278,4099716.7547807167]]),t=new ol.Feature({geometry:e,name:"",population:{name:"无敌啊",type:"基地",device_id:"11111111251558",location:""}});d.getSource().addFeature(t)}();var T=new ol.Map({controls:ol.control.defaults({attribution:!1}).extend([new ol.control.MousePosition]),layers:[b,h,S,E,y],target:"map",view:_});this.aerialmap=T,T.getView().fit(e.basemap,T.getSize(21)),d.setIndex=-1,T.addLayer(d),T.on("singleclick",function(e){T.forEachFeatureAtPixel(e.pixel,function(e){console.log(e.H.population),e.H.population&&(t.deviceinfo=e.H.population,t.cityanalysis(t.deviceinfo.location),t.dialogbaseinfo=!0)},{hitTolerance:1})});var x=document.getElementsByClassName("ol-viewport"),L=document.getElementById("map");x.length>1&&L.removeChild(x[0])},getEquipList:function(){},equipLocate:function(e,t){console.log(this.equipListactive,t),this.equipListactive=t,this.init(e)},enterBase:function(){},cityanalysis:function(e){var t=this,o=e[1],i=e[0];this.$jsonp("http://api.map.baidu.com/reverse_geocoding/v3/?renderReverse&output=json&coordtype=wgs84ll",{ak:"nroAiX0Lf6ppNEGt2dBLtDkOldGCPFwF",location:o+","+i}).then(function(e){console.log(e),t.deviceinfo.city=e.result.formatted_address})},drawStart:function(e){this.drawVector=new ol.layer.Vector({source:new ol.source.Vector,style:new ol.style.Style({fill:new ol.style.Fill({color:"rgba(37,241,239,0.2)"}),stroke:new ol.style.Stroke({color:"#264df6",width:2}),image:new ol.style.Circle({radius:7,fill:new ol.style.Fill({color:"#e81818"})})})}),this.aerialmap.addLayer(this.drawVector);var t=this;this.source=new ol.source.Vector({wrapX:!1}),this.isDraw?(this.draw=new ol.interaction.Draw({source:this.drawVector.getSource(),type:e}),this.aerialmap.addInteraction(this.draw),this.draw.on("drawend",function(e){t.drawingEnd(e)})):(console.log(1),this.source.clear(),this.aerialmap.removeInteraction(this.draw),this.isDraw=!0),this.drawarr.push(this.drawVector)},drawingEnd:function(e){var t=e.feature.getGeometry().getArea(),o="";t>1e6?(t/=1e6,o="km²"):o="m²",console.log(t+o),console.log((t+t/2)/1e3+"亩");var i=(t+t/2)/1e3;console.log(2e3*i/3);var a=e.feature.getGeometry();if("Polygon"===a.getType()){var n=a.getCoordinates();console.log(a),console.warn(n,"绘制结束,点坐标"),this.source.clear(),this.aerialmap.removeInteraction(this.draw)}},clealdraw:function(){this.aerialmap.removeLayer(this.drawarr[this.drawarr.length-1]),this.drawarr.pop()}},beforeCreate:function(){},created:function(){},beforeMount:function(){},mounted:function(){this.init(this.mapData[0]);var e=gcoord.transform([113.67426470134029,34.811014906789666],gcoord.EPSG4326,gcoord.EPSG3857),t=gcoord.transform([113.67730349366221,34.81346642108534],gcoord.EPSG4326,gcoord.EPSG3857);console.log(e,t)},beforeUpdate:function(){},updated:function(){},beforeDestroy:function(){},destroyed:function(){},activated:function(){}},a={render:function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"mapbox"},[i("div",{attrs:{id:"container"}}),e._v(" "),i("div",{attrs:{id:"mapbox"}},[i("div",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"},{name:"show",rawName:"v-show",value:e.canvasdisplay,expression:"canvasdisplay"}],attrs:{id:"map"}},[i("div",{staticClass:"mapdel",on:{click:function(t){return e.drawStart("Polygon")}}},[e._v("划分地块")]),e._v(" "),i("div",{staticClass:"mapdel2",on:{click:e.clealdraw}},[e._v("清除地块")])])]),e._v(" "),i("div",{staticClass:"listBox"},[i("div",{staticClass:"projectSearch"},[i("div",[e._v("基地列表")]),e._v(" "),i("div",[i("el-input",{attrs:{size:"small",placeholder:"请输入项目名称","suffix-icon":"el-icon-search",clearable:""},on:{change:e.getEquipList},model:{value:e.input,callback:function(t){e.input=t},expression:"input"}})],1)]),e._v(" "),i("div",{staticClass:"inner"},[i("div",{staticClass:"scroll"},[i("el-scrollbar",[i("div",{staticClass:"equipList"},[e._l(e.mapData,function(t,a){return i("div",{key:t.uuid,class:e.equipListactive==a?"item activetime":"item",on:{click:function(o){return e.equipLocate(t,a)},dblclick:function(o){return e.enterBase(t.uid)}}},[i("img",{attrs:{src:o("MMlr"),width:"25px",alt:""}}),e._v("\n "+e._s(t.projectname)+"\n ")])}),e._v(" "),e.mapData.length?e._e():i("div",{staticClass:"item noDate"},[e._v("暂无数据")])],2)])],1)])]),e._v(" "),i("el-dialog",{attrs:{title:"设备信息",visible:e.dialogbaseinfo,width:"30%",top:"15%"},on:{"update:visible":function(t){e.dialogbaseinfo=t}}},[i("div",{staticClass:"baseinfobox"},[i("p",[e._v("设备名称:"+e._s(e.deviceinfo.name))]),e._v(" "),i("p",[e._v("设备id:"+e._s(e.deviceinfo.device_id))]),e._v(" "),i("p",[e._v("地址:"+e._s(e.deviceinfo.city))])]),e._v(" "),i("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{on:{click:function(t){e.dialogbaseinfo=!1}}},[e._v("取 消")]),e._v(" "),i("el-button",{attrs:{type:"primary"},on:{click:function(t){e.dialogbaseinfo=!1}}},[e._v("确 定")])],1)])],1)},staticRenderFns:[]};var n=o("C7Lr")(i,a,!1,function(e){o("0iRj")},"data-v-337bd21a",null);t.default=n.exports}});
|