webpackJsonp([16],{jkqj:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=a("Dd8w"),i=a.n(n),o=a("mvHQ"),r=a.n(o),s=a("//Fk"),m=a.n(s),l={name:"MonitorMap",props:{mapUrl:{type:String,default:"http://www.962121.net/gis_system/smimap/index.html#/"},iconUrl:{type:String,default:"http://www.962121.net/hmfmstest/shanghaiwuye/web/dataV/propertyinspector/static/icons/"},mapJs:{type:String,default:"http://www.962121.net/gis_system/smimap/mapdebug/ShsmiGis.Bridge.js"}},data:function(){return{map:null}},mounted:function(){this.inject().then(this.initMap)},computed:{sizeRate:function(){return Math.floor(1.48*screen.height/100/11)}},methods:{inject:function(){var e=this;return new m.a(function(t,a){if(document.getElementById("_mapjs"))t();else{var n=document.createElement("script");n.type="text/javascript",n.src=e.mapJs,n.setAttribute("id","_mapjs"),document.head.appendChild(n),window.onload=function(){return t()}}})},initMap:function(){var e=this,t=window.ShsmiGis;this.map=new t.Bridge({id:"map",url:this.mapUrl,onReady:function(){e.addListener(),e.$emit("complete")}})},addListener:function(){var e=this;this.map.addEventListener(function(t){switch(t.action.toLowerCase()){case"selectfeatures":case"flashlayer":if(!t.layername)return;e.$emit("event",t)}},this)},addPoint:function(e){var t=e.name,a=e.mode,n=void 0===a?"add":a,i=e.key,o=e.data,s=e.labelKey,m=void 0===s?null:s,l=e.icon,d=void 0===l?"test.png":l,c=e.size,p=void 0===c?20:c,u=e.color,h=e.remove,f=void 0===h||h;if(this.map){f&&this.removePoint(t);var y=this.getMapParams({data:o,key:i,labelKey:m,icon:d,size:p,color:u});y.name=t,y.mode=n,this.map.Invoke({ActionName:"displayJsonData",Parameters:r()(y)})}},removePoint:function(e){this.map&&this.map.Invoke({ActionName:"displayJsonData",Parameters:r()({name:e,mode:"delete"})})},drawStreet:function(e,t){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"#00f2ff";this.map.Invoke({ActionName:"displayJsonData",Parameters:r()({name:e,mode:"add",dataArray:[{points:t.map(function(e){return{codX:e[0],codY:e[1],codZ:0}})}],popupEnabled:!1,legendVisible:!1,type:"polyline",renderer:{type:"unique-value",defaultSymbol:{type:"simple-line",color:a,width:3*this.sizeRate}}})})},getMapParams:function(e){var t=this,a=e.data,n=void 0===a?[]:a,o=e.key,r=e.labelKey,s=e.icon,m=e.size,l=e.color,d=void 0===l?"#47B3FF":l,c=[],p=[],u=[];for(var h in n[0])u.push({name:h,alias:h,type:"string"});return u.push({name:"name",alias:"标签",type:"string"}),n.forEach(function(e){var a={codX:e.X||e.x||e.gps_x,codY:e.Y||e.y||e.gps_y,codZ:0,attrs:i()({},e)};a.attrs.name=r?e[r]:"",c.push(a),p.push({value:e[o],label:(e[r]||e[o])+"",symbol:{type:"point-3d",symbolLayers:[{type:"icon",size:m*t.sizeRate,resource:{href:t.iconUrl+(e.icon||s)}}]}})}),{dataArray:c,popupEnabled:!1,legendVisible:!1,type:"point",fieldJsonArray:u,renderer:{type:"unique-value",field:o,defaultLabel:"无数据",uniqueValueInfos:p},labelsymbol:{symbol:{type:"text",color:d,haloSize:0,haloColor:"white"},labelPlacement:"center-right"}}},addGifPoint:function(e){var t=this,a=e.name,n=e.data,o=e.labelKey,s=e.icon,m=e.size,l=void 0===m?200:m,d=e.color,c=void 0===d?"#00FFFF":d;if(this.map){Array.isArray(n)||(n=[n]);var p={name:a,mode:"add",datas:n.map(function(e){return i()({name:o?e[o]:null,value:l*t.sizeRate,corrd:[e.X||e.x,e.Y||e.y],color:c},e)}),symbol:s?"image://"+this.iconUrl+s:"circle",position:"right"};this.map.Invoke({ActionName:"flashlayer",Parameters:r()(p)})}},removeGifPoint:function(e){this.map&&this.map.Invoke({ActionName:"flashlayer",Parameters:r()({name:e,mode:"delete"})})},focus:function(e,t){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:6;if(this.map&&e&&t){var n={codX:e,codY:t,zoomlevel:a};this.map.Invoke({ActionName:"goToPosition",Parameters:r()(n)})}else console.error("传入的坐标点不能为空")},zoomIn:function(){this.map.Invoke({ActionName:"mapzoom",Parameters:{zoommode:"zoomin"}})},zoomOut:function(){this.map.Invoke({ActionName:"mapzoom",Parameters:{zoommode:"zoomout"}})}}},d={render:function(){var e=this.$createElement;return(this._self._c||e)("iframe",{attrs:{id:"map",frameborder:"0",scrolling:"no",allowtransparency:"true"}})},staticRenderFns:[]};var c=a("VU/8")(l,d,!1,function(e){a("xQFR")},"data-v-378db2dc",null);t.default=c.exports},xQFR:function(e,t){}});
//# sourceMappingURL=16.71b39e7f56791784419e.js.map